Bug 834888 - ovirt-engine-backend [Direct Lun] [RACE]: we can attach direct lun to more than one vm even if its not shared
ovirt-engine-backend [Direct Lun] [RACE]: we can attach direct lun to more th...
Status: CLOSED CURRENTRELEASE
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine (Show other bugs)
3.1.0
x86_64 Linux
high Severity high
: ---
: 3.1.0
Assigned To: Tal Nisan
vvyazmin@redhat.com
storage
:
Depends On: 852451 853724
Blocks:
  Show dependency treegraph
 
Reported: 2012-06-24 11:10 EDT by Dafna Ron
Modified: 2016-02-10 12:12 EST (History)
11 users (show)

See Also:
Fixed In Version: si16
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
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)
log (20.88 KB, application/x-xz)
2012-06-24 11:10 EDT, Dafna Ron
no flags Details

  None (edit)
Description Dafna Ron 2012-06-24 11:10:23 EDT
Created attachment 594013 [details]
log

Description of problem:

we need to add object lock on attach of direct lun to a vm since we currently have a race. 
since UI does not refresh the quesy fast enough we are able to attach the same lun to morethan one vm when the lun does not have the share tag. 

we get an sql duplicate key violation error in log. 

Version-Release number of selected component (if applicable):

si6

How reproducible:

100%

Steps to Reproduce:
1. create a few direct luns
2. attach all of the luns to a vm
3. attach as many as you can from the luns to a second vm 
  
Actual results:

we are able to connect to same luns from different vms 

Expected results:

we should not be able to connect to the same lun from different vms unless it has the share tag. 

Additional info: full log

tachDiskToVmCommand] (pool-3-thread-47) [e3d11d4] 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
Comment 1 Tal Nisan 2012-08-20 06:55:00 EDT
http://gerrit.ovirt.org/7337
Comment 2 Tal Nisan 2012-08-26 06:47:39 EDT
Change-Id: Ib9e47fe370b230b4bd69f108954031cda3bba6a3
Comment 3 Allon Mureinik 2012-08-26 08:19:32 EDT
merged
Comment 4 vvyazmin@redhat.com 2012-10-02 11:40:48 EDT
Verified on RHEVM 3.1 - SI19

RHEVM: rhevm-3.1.0-18.el6ev.noarch
VDSM: vdsm-4.9.6-36.0.el6_3.x86_64
LIBVIRT: libvirt-0.9.10-21.el6_3.4.x86_64
QEMU & KVM: qemu-kvm-rhev-0.12.1.2-2.295.el6_3.2.x86_64
SANLOCK: sanlock-2.3-4.el6_3.x86_64

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