Bug 833077 - [Storage] Exception when trying to attach the same shared disk to the same VM more than once.
[Storage] Exception when trying to attach the same shared disk to the same VM...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
3.1.0
Unspecified Unspecified
unspecified Severity high
: ---
: 3.1.0
Assigned To: Maor
Leonid Natapov
storage
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-18 10:27 EDT by Leonid Natapov
Modified: 2016-02-10 11:27 EST (History)
12 users (show)

See Also:
Fixed In Version: SI7
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-12-04 14:58:05 EST
Type: Bug
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 Leonid Natapov 2012-06-18 10:27:23 EDT
[Storage] Exception when trying to attach shared disk to VM more than 1 time.
------

2012-06-18 17:16:10,707 INFO  [org.ovirt.engine.core.bll.AttachDiskToVmCommand] (pool-3-thread-46) [5e837ef7] Running command: AttachDiskToVmCommand internal: false. Entities affected :  ID: 3dc3930b-9b80-4eab-b9d1-269d061fab10 Type: VM,  ID: 6344ecb1-902e-480f-9c32-9dd6cf3dd977 Type: Disk
2012-06-18 17:16:10,715 ERROR [org.ovirt.engine.core.bll.AttachDiskToVmCommand] (pool-3-thread-46) [5e837ef7] Command org.ovirt.engine.core.bll.AttachDiskToVmCommand throw exception: org.springframework.dao.DataIntegrityViolationException: CallableStatementCallback; SQL [{call insertvmdevice(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)}]; ERROR: duplicate key value violates unique constraint "pk_vm_device"
  Where: SQL statement "INSERT INTO vm_device( device_id, vm_id , device , type, address , boot_order , spec_params, is_managed, is_plugged, is_readonly, alias) VALUES(  $1  ,  $2  ,  $3  ,  $4  ,  $5  ,  $6  ,  $7 ,  $8 ,  $9 ,  $10 ,  $11 )"
PL/pgSQL function "insertvmdevice" line 2 at SQL statement; nested exception is org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_vm_device"
  Where: SQL statement "INSERT INTO vm_device( device_id, vm_id , device , type, address , boot_order , spec_params, is_managed, is_plugged, is_readonly, alias) VALUES(  $1  ,  $2  ,  $3  ,  $4  ,  $5  ,  $6  ,  $7 ,  $8 ,  $9 ,  $10 ,  $11 )"
PL/pgSQL function "insertvmdevice" line 2 at SQL statement
        at org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator.doTranslate(SQLErrorCodeSQLExceptionTranslator.java:228) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.jdbc.support.AbstractFallbackSQLExceptionTranslator.translate(AbstractFallbackSQLExceptionTranslator.java:72) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:952) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.jdbc.core.JdbcTemplate.call(JdbcTemplate.java:985) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.executeCallInternal(AbstractJdbcCall.java:368) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.jdbc.core.simple.AbstractJdbcCall.doExecute(AbstractJdbcCall.java:342) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        at org.springframework.jdbc.core.simple.SimpleJdbcCall.execute(SimpleJdbcCall.java:164) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        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.AttachDiskToVmCommand.ExecuteVmCommand(AttachDiskToVmCommand.java:87) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.VmCommand.executeCommand(VmCommand.java:100) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteWithoutTransaction(CommandBase.java:757) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.executeActionInTransactionScope(CommandBase.java:849) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.runInTransaction(CommandBase.java:1149) [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:864) [engine-bll.jar:]
        at org.ovirt.engine.core.bll.CommandBase.ExecuteAction(CommandBase.java:269) [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.6.0_24]
        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.6.0_24]
        at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.6.0_24]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110) [rt.jar:1.6.0_24]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603) [rt.jar:1.6.0_24]
        at java.lang.Thread.run(Thread.java:679) [rt.jar:1.6.0_24]
Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "pk_vm_device"
  Where: SQL statement "INSERT INTO vm_device( device_id, vm_id , device , type, address , boot_order , spec_params, is_managed, is_plugged, is_readonly, alias) VALUES(  $1  ,  $2  ,  $3  ,  $4  ,  $5  ,  $6  ,  $7 ,  $8 ,  $9 ,  $10 ,  $11 )"
PL/pgSQL function "insertvmdevice" line 2 at SQL statement
        at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2062)
        at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1795)
        at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:479)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:367)
        at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:360)
        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.SEC03.jar:2.5.6.SEC03]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:936) [spring-jdbc-2.5.6.SEC03.jar:2.5.6.SEC03]
        ... 27 more

2012-06-18 17:16:10,738 ERROR [org.ovirt.engine.core.vdsbroker.VDSCommandBase] (QuartzScheduler_Worker-78) [12a4fca8] Command SpmStatusVDS execution
Comment 1 Maor 2012-06-18 10:52:29 EDT
Suggestion solution posted at: http://gerrit.ovirt.org/#/c/5444/
Comment 2 Maor 2012-06-20 04:07:14 EDT
Fixed and merged at commit #cbbce9af3bc1b4df0553d78aa60b7fd27336ccc5
Comment 3 Gilad Chaplik 2012-06-26 03:49:30 EDT
because of fixing bug 833076, verification can be done only via REST-API.
Comment 4 Leonid Natapov 2012-07-01 10:49:42 EDT
fixed. si8.

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