Bug 979162

Summary: Unable to remove host
Product: [Retired] oVirt Reporter: Christian <5.elements>
Component: ovirt-engine-coreAssignee: Nobody's working on this, feel free to take it <nobody>
Status: CLOSED INSUFFICIENT_DATA QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 3.1 GACC: 5.elements, acathrow, emesika, iheim, jkt
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard: infra
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-11 21:21:34 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Christian 2013-06-27 19:12:54 UTC
Description of problem:
Getting errors when trying to remove a host

Version-Release number of selected component (if applicable):
3.1.0-2.fc17

How reproducible:
Not known.  I had two of 4 hosts that I was unable to remove from the system.  They were both in maintenance mode.  I reactivated one and set it back in maintenace and was able to remove it.  The other I am completely unable to remove.

Steps to Reproduce:
1. set to maintenance mode
2. attempt to remove
3.

Actual results:
Errors out on removal

Expected results:
Host is removed

Additional info:

2013-06-27 14:10:27,365 ERROR [org.ovirt.engine.core.bll.RemoveVdsCommand] (pool-3-thread-42) [10ef094d] Command org.ovirt.engine.core.bll.RemoveVdsCommand throw exception: org.springframework.dao.DataIntegrityViolationException: CallableStatementCallback; SQL [{call deletevdsstatic(?)}]; ERROR: update or delete on table "vds_static" violates foreign key constraint "vds_static_vm_dynamic_m" on table "vm_dynamic"
  Detail: Key (vds_id)=(6dd15c06-a764-11e2-b1ee-00266cff0d88) is still referenced from table "vm_dynamic".
  Where: SQL statement "DELETE FROM vds_static
      WHERE vds_id = v_vds_id"
PL/pgSQL function "deletevdsstatic" line 12 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: update or delete on table "vds_static" violates foreign key constraint "vds_static_vm_dynamic_m" on table "vm_dynamic"
  Detail: Key (vds_id)=(6dd15c06-a764-11e2-b1ee-00266cff0d88) is still referenced from table "vm_dynamic".
  Where: SQL statement "DELETE FROM vds_static
      WHERE vds_id = v_vds_id"
PL/pgSQL function "deletevdsstatic" line 12 at SQL statement
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:228) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:368) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:342) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:164) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeImpl(SimpleJdbcCallsHandler.java:124) [engine-dal.jar:]
        at org.ovirt.engine.core.dal.dbbroker.SimpleJdbcCallsHandler.executeModification(SimpleJdbcCallsHandler.java:37) [engine-dal.jar:]
        at org.ovirt.engine.core.dao.VdsStaticDAODbFacadeImpl.remove(VdsStaticDAODbFacadeImpl.java:109) [engine-dal.jar:]
        at org.ovirt.engine.core.dao.VdsStaticDAODbFacadeImpl.remove(VdsStaticDAODbFacadeImpl.java:27) [engine-dal.jar:]
        at org.ovirt.engine.core.bll.RemoveVdsCommand.RemoveVdsStaticFromDb(RemoveVdsCommand.java:119) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.RemoveVdsCommand.executeCommand(RemoveVdsCommand.java:42) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteWithoutTransaction(CommandBase.java:804) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:896) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1203) [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.Execute(CommandBase.java:911) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteAction(CommandBase.java:268) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.MultipleActionsRunner.executeValidatedCommands(MultipleActionsRunner.java:182) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.MultipleActionsRunner.RunCommands(MultipleActionsRunner.java:162) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.MultipleActionsRunner$1.run(MultipleActionsRunner.java:84) [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) [rt.jar:1.7.0_19]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_19]
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_19]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_19]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_19]
        at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_19]
Caused by: org.postgresql.util.PSQLException: ERROR: update or delete on table "vds_static" violates foreign key constraint "vds_static_vm_dynamic_m" on table "vm_dynamic"
  Detail: Key (vds_id)=(6dd15c06-a764-11e2-b1ee-00266cff0d88) is still referenced from table "vm_dynamic".
  Where: SQL statement "DELETE FROM vds_static
      WHERE vds_id = v_vds_id"
PL/pgSQL function "deletevdsstatic" line 12 at SQL statement
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2103)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1836)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:512)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:381)
        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:2.5.6.SEC02]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:936) [spring-jdbc-2.5.6.SEC02.jar:2.5.6.SEC02]
        ... 28 more

2013-06-27 14:10:27,375 ERROR [org.ovirt.engine.core.bll.RemoveVdsCommand] (pool-3-thread-42) [10ef094d] Transaction rolled-back for command: org.ovirt.engine.core.bll.RemoveVdsCommand.

Comment 1 Itamar Heim 2013-07-11 17:55:26 UTC
Christian - do you maybe have a VM pinned to that host, or a VM which is still depicted as running on that host (this what the foreign key implies)?