Bug 800279 - [ovirt] [engine-core] delete vm fails: update or delete on table "vm_static" violates foreign key constraint "fk_snapshot_vm" on table "snapshots"
[ovirt] [engine-core] delete vm fails: update or delete on table "vm_static" ...
Status: CLOSED CURRENTRELEASE
Product: oVirt
Classification: Community
Component: ovirt-engine-core (Show other bugs)
unspecified
Unspecified Unspecified
unspecified Severity unspecified
: ---
: 3.1
Assigned To: mkublin
storage
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-03-06 03:21 EST by Haim
Modified: 2016-02-10 12:03 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-08-09 04:05:04 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: Storage
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Haim 2012-03-06 03:21:04 EST
Description of problem:

scenario: 

trying to delete vm with one disk and several snapshots

result - nested exception:

2012-03-06 09:58:12,077 ERROR [org.ovirt.engine.core.bll.EntityAsyncTask] (pool-5-thread-8) EntityAsyncTask::EndCommandAction [within thread]: EndAction for action type RemoveVm threw an exception: org.springframework.dao.DataIntegrityViolationException: CallableStatementCallback; SQL [{call deletevmstatic(?)}]; ERROR: update or delete on table "vm_static" violates foreign key constraint "fk_snapshot_vm" on table "snapshots"
  Detail: Key (vm_guid)=(e29a7247-0388-4c99-9a5f-e2858beac1af) is still referenced from table "snapshots".
  Where: SQL statement "DELETE FROM vm_static
      WHERE vm_guid = v_vm_guid
      AND   entity_type = 'VM'"
PL/pgSQL function "deletevmstatic" line 8 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "vm_static" violates foreign key constraint "fk_snapshot_vm" on table "snapshots"
  Detail: Key (vm_guid)=(e29a7247-0388-4c99-9a5f-e2858beac1af) is still referenced from table "snapshots".
  Where: SQL statement "DELETE FROM vm_static
      WHERE vm_guid = v_vm_guid
      AND   entity_type = 'VM'"
PL/pgSQL function "deletevmstatic" line 8 at SQL statement
	at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:228) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:368) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:342) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:164) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:112) [engine-dal.jar:]
	at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeModification(SimpleJdbcCallsHandler.java:39) [engine-dal.jar:]
	at org.ovirt.engine.core.dao.VmStaticDAODbFacadeImpl.remove(VmStaticDAODbFacadeImpl.java:134) [engine-dal.jar:]
	at org.ovirt.engine.core.dao.VmStaticDAODbFacadeImpl.remove(VmStaticDAODbFacadeImpl.java:18) [engine-dal.jar:]
	at org.ovirt.engine.core.bll.VmCommand.RemoveVmStatic(VmCommand.java:240) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.RemoveVmCommand.RemoveVmFromDb(RemoveVmCommand.java:208) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.RemoveVmCommand.EndVmCommand(RemoveVmCommand.java:221) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.VmCommand.EndSuccessfully(VmCommand.java:296) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.CommandBase.InternalEndSuccessfully(CommandBase.java:391) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.CommandBase.endActionInTransactionScope(CommandBase.java:346) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1070) [engine-bll.jar:]
	at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:204) [engine-utils.jar:]
	at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInRequired(TransactionSupport.java:142) [engine-utils.jar:]
	at org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:109) [engine-utils.jar:]
	at org.ovirt.engine.core.bll.CommandBase.EndAction(CommandBase.java:301) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.Backend.endAction(Backend.java:343) [engine-bll.jar:]
	at sun.reflect.GeneratedMethodAccessor180.invoke(Unknown Source) [:1.6.0_22]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_22]
	at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_22]
	at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.InterceptorContext$Invocation.proceed(InterceptorContext.java:374) [jboss-invocation-1.1.1.Final.jar:]
	at org.ovirt.engine.core.utils.ThreadLocalSessionCleanerInterceptor.injectWebContextToThreadLocal(ThreadLocalSessionCleanerInterceptor.java:11) [engine-utils.jar:]
	at sun.reflect.GeneratedMethodAccessor58.invoke(Unknown Source) [:1.6.0_22]
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [:1.6.0_22]
	at java.lang.reflect.Method.invoke(Method.java:616) [:1.6.0_22]
	at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:123) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ejb3.component.singleton.SingletonComponentInstanceAssociationInterceptor.processInvocation(SingletonComponentInstanceAssociationInterceptor.java:53) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInNoTx(CMTTxInterceptor.java:221) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.supports(CMTTxInterceptor.java:367) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
	at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:205) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:44) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:55) [jboss-as-ejb3-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:]
	at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.0.Beta1b.jar:]
	at org.ovirt.engine.core.bll.interfaces.BackendInternal$$$view11.endAction(Unknown Source) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.EntityAsyncTask.EndCommandAction(EntityAsyncTask.java:143) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.EntityAsyncTask.access$000(EntityAsyncTask.java:23) [engine-bll.jar:]
	at org.ovirt.engine.core.bll.EntityAsyncTask$1.run(EntityAsyncTask.java:104) [engine-bll.jar:]
	at org.ovirt.engine.core.utils.threadpool.ThreadPoolUtil$InternalWrapperRunnable.run(ThreadPoolUtil.java:64) [engine-utils.jar:]
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [:1.6.0_22]
	at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [:1.6.0_22]
	at java.util.concurrent.FutureTask.run(FutureTask.java:166) [:1.6.0_22]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [:1.6.0_22]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [:1.6.0_22]
	at java.lang.Thread.run(Thread.java:679) [:1.6.0_22]
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "vm_static" violates foreign key constraint "fk_snapshot_vm" on table "snapshots"
  Detail: Key (vm_guid)=(e29a7247-0388-4c99-9a5f-e2858beac1af) is still referenced from table "snapshots".
  Where: SQL statement "DELETE FROM vm_static
      WHERE vm_guid = v_vm_guid
      AND   entity_type = 'VM'"
PL/pgSQL function "deletevmstatic" line 8 at SQL statement
	at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2077)
	at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1810)
	at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:498)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:386)
	at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:379)
	at org.jboss.jca.adapters.jdbc.CachedPreparedStatement.execute(CachedPreparedStatement.java:297)
	at org.jboss.jca.adapters.jdbc.WrappedPreparedStatement.execute(WrappedPreparedStatement.java:404)
	at org.springframework.jdbc.core.JdbcTemplate$5.doInCallableStatement(JdbcTemplate.java:987) [spring-jdbc-2.5.6.SEC02.jar:]
	at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:936) [spring-jdbc-2.5.6.SEC02.jar:]
	... 70 more

2012-03-06 09:58:12,088 INFO  [org.ovirt.engine.core.bll.EntityAsyncTask] (pool-5-thread-8) EntityAsyncTask::HandleEndActionResult [within thread]: EndAction for action type RemoveVm completed, handling the result.
2012-03-06 09:58:12,088 INFO  [org.ovirt.engine.core.bll.EntityAsyncTask] (pool-5-thread-8) EntityAsyncTask::HandleEndActionResult [within thread]: EndAction for action type RemoveVm hasnt succeeded, not clearing tasks, will attempt again next polling


[root@rami-upstream ~]# cat kaka2 
               vm_guid                |     vm_name     | mem_size_mb |               vmt_guid               | os | description |             vds_group_id             | domain |     creation_date      | num_of_monitors | is_initialized | is_auto_suspend | num_of_sockets | cpu_per_socket | usb_policy | time_zone | is_stateless | fail_back |         _create_date          |         _update_date          | dedicated_vm_for_vds | auto_startup | vm_type | hypervisor_type | operation_mode | nice_level | default_boot_sequence | default_display_type | priority | iso_path | origin | initrd_url | kernel_url | kernel_params | migration_support | userdefined_properties | predefined_properties | min_allocated_mem | entity_type | child_count | template_status | quota_id 
--------------------------------------+-----------------+-------------+--------------------------------------+----+-------------+--------------------------------------+--------+------------------------+-----------------+----------------+-----------------+----------------+----------------+------------+-----------+--------------+-----------+-------------------------------+-------------------------------+----------------------+--------------+---------+-----------------+----------------+------------+-----------------------+----------------------+----------+----------+--------+------------+------------+---------------+-------------------+------------------------+-----------------------+-------------------+-------------+-------------+-----------------+----------
 e29a7247-0388-4c99-9a5f-e2858beac1af | VmWithAgent-001 |         512 | 00000000-0000-0000-0000-000000000000 |  0 |             | 25c5ba28-5c70-11e1-95d7-abbe435375fe |        | 2012-02-28 17:10:53+02 |               1 | t              | f               |              1 |              1 |          0 |           | f            | f         | 2012-02-28 17:10:53.756453+02 | 2012-02-29 15:13:59.495577+02 |                      | f            |       0 |               0 |              0 |          0 |                     0 |                    1 |        1 |          |      3 |            |            |               |                 0 |                        |                       |               128 | VM 


               vm_guid                | status | vm_ip | vm_host | vm_pid | vm_last_up_time | vm_last_boot_time | guest_cur_user_name | guest_cur_user_id | guest_last_login_time | guest_last_logout_time | guest_os | run_on_vds | migrati
ng_to_vds | app_list | display | acpi_enable | session |           display_ip            | display_type | kvm_enable | display_secure_port | utc_diff | last_vds_run_on | client_ip | guest_requested_memory | hibernation_vol_handle | boot
_sequence | exit_status | pause_status | exit_message | hash 
--------------------------------------+--------+-------+---------+--------+-----------------+-------------------+---------------------+-------------------+-----------------------+------------------------+----------+------------+--------
----------+----------+---------+-------------+---------+---------------------------------+--------------+------------+---------------------+----------+-----------------+-----------+------------------------+------------------------+-----
----------+-------------+--------------+--------------+------
 e29a7247-0388-4c99-9a5f-e2858beac1af |     15 |       |         |        |                 |                   |                     |                   |                       |                        |          |            |        
          |          |    5900 | t           |       0 | nott-vds2.qa.lab.tlv.redhat.com |            1 | t          |                5901 |        0 |                 |           |                        |                        |     
        0 |           0 |            0 |              | 
(1 row)
Comment 1 mkublin 2012-06-13 08:34:39 EDT
The commit 26538573ec9ea66516fb1997fd846b4126d5f135 fixed that bug
Comment 2 Itamar Heim 2012-08-09 04:05:04 EDT
closing ON_QA bugs as oVirt 3.1 was released:
http://www.ovirt.org/get-ovirt/

Note You need to log in before you can comment on or make changes to this bug.