[Users] Unable to import VM

Eli Mesika emesika at redhat.com
Mon Nov 12 02:21:54 UTC 2012



----- Original Message -----
> From: "Daniel Rowe" <daniel.fathom13 at gmail.com>
> To: users at ovirt.org
> Sent: Monday, November 12, 2012 2:01:19 AM
> Subject: Re: [Users] Unable to import VM
> 
> 
> On Mon, Nov 12, 2012 at 7:49 AM, Daniel Rowe <
> daniel.fathom13 at gmail.com > wrote:
> 
> 
> 
> 
> Hi
> 
> I was able to import one VM from libvirt. I am able to get the VM
> into the export storage fine.
> 
> Any VMs I try and import after the first one fails and I get below in
> the logs any way to work around this?

Hi Daniel
This seems to me as a bug 
It seems that the Export command did not store the correct snapshot id or that the Import command didn't succeed/tried to get it from the OVF , therefore, an empty Guid was generated and inserted to the snapshot table, this of course succeeded only once as you stated since the second attempt to insert an empty Guid will be rejected by the database since this snapshot_id is the key of the table.

Scenario to reproduce (please verify):
1) Export two VMs that has each at least one snapshot
2) Try to import those VMs

Can you please open a BZ on that?


> 
> 2012-11-12 07:44:56,366 ERROR
> [org.ovirt.engine.core.bll.ImportVmCommand] (pool-3-thread-46)
> [7c3538ee] Command org.ovirt.engine.core.bll.ImportVmCommand throw
> exception: org.springframework.dao.DataIntegrityViolationException:
> CallableStatementCallback; SQL [{call insertsnapshot(?, ?, ?, ?, ?,
> ?, ?, ?)}]; ERROR: duplicate key value violates unique constraint
> "pk_snapshots"
> Detail: Key (snapshot_id)=(00000000-0000-0000-0000-000000000000)
> already exists.
> Where: SQL statement "INSERT INTO snapshots(
> snapshot_id,
> status,
> vm_id,
> snapshot_type,
> description,
> creation_date,
> app_list,
> vm_configuration)
> VALUES(
> v_snapshot_id,
> v_status,
> v_vm_id,
> v_snapshot_type,
> v_description,
> v_creation_date,
> v_app_list,
> v_vm_configuration)"
> PL/pgSQL function "insertsnapshot" line 3 at SQL statement; nested
> exception is org.postgresql.util.PSQLException: ERROR: duplicate key
> value violates unique constraint "pk_snapshots"
> Detail: Key (snapshot_id)=(00000000-0000-0000-0000-000000000000)
> already exists.
> Where: SQL statement "INSERT INTO snapshots(
> snapshot_id,
> status,
> vm_id,
> snapshot_type,
> description,
> creation_date,
> app_list,
> vm_configuration)
> VALUES(
> v_snapshot_id,
> v_status,
> v_vm_id,
> v_snapshot_type,
> v_description,
> v_creation_date,
> v_app_list,
> v_vm_configuration)"
> PL/pgSQL function "insertsnapshot" line 3 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.DefaultGenericDaoDbFacade.save(DefaultGenericDaoDbFacade.java:93)
> [engine-dal.jar:]
> at
> org.ovirt.engine.core.bll.ImportVmCommand.addVmImagesAndSnapshots(ImportVmCommand.java:615)
> [engine-bll.jar:]
> at
> org.ovirt.engine.core.bll.ImportVmCommand.access$200(ImportVmCommand.java:76)
> [engine-bll.jar:]
> at
> org.ovirt.engine.core.bll.ImportVmCommand$4.runInTransaction(ImportVmCommand.java:501)
> [engine-bll.jar:]
> at
> org.ovirt.engine.core.bll.ImportVmCommand$4.runInTransaction(ImportVmCommand.java:497)
> [engine-bll.jar:]
> at
> org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInNewTransaction(TransactionSupport.java:204)
> [engine-utils.jar:]
> at
> org.ovirt.engine.core.bll.ImportVmCommand.processImages(ImportVmCommand.java:497)
> [engine-bll.jar:]
> at
> org.ovirt.engine.core.bll.ImportVmCommand.executeCommand(ImportVmCommand.java:477)
> [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.executeInSuppressed(TransactionSupport.java:168)
> [engine-utils.jar:]
> at
> org.ovirt.engine.core.utils.transaction.TransactionSupport.executeInScope(TransactionSupport.java:107)
> [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_09-icedtea]
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
> [rt.jar:1.7.0_09-icedtea]
> at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> [rt.jar:1.7.0_09-icedtea]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> [rt.jar:1.7.0_09-icedtea]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> [rt.jar:1.7.0_09-icedtea]
> at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_09-icedtea]
> Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key
> value violates unique constraint "pk_snapshots"
> Detail: Key (snapshot_id)=(00000000-0000-0000-0000-000000000000)
> already exists.
> Where: SQL statement "INSERT INTO snapshots(
> snapshot_id,
> status,
> vm_id,
> snapshot_type,
> description,
> creation_date,
> app_list,
> vm_configuration)
> VALUES(
> v_snapshot_id,
> v_status,
> v_vm_id,
> v_snapshot_type,
> v_description,
> v_creation_date,
> v_app_list,
> v_vm_configuration)"
> PL/pgSQL function "insertsnapshot" line 3 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]
> ... 31 more
> 
> Regards
> Daniel
> 
> Doing a select * from snapshots; there is indeed a snapshot with that
> ID. I took a punt and and did a delete from snapshots where
> snapshot_id = '00000000-0000-0000-0000-000000000000'; and I can now
> import VMs again.
> 
> _______________________________________________
> Users mailing list
> Users at ovirt.org
> http://lists.ovirt.org/mailman/listinfo/users
> 



More information about the Users mailing list