Bug 844440 - [engine-core] locking mechanism: able to perform live snapshot during hot-plug disk (also, clone vm from snapshot)
Summary: [engine-core] locking mechanism: able to perform live snapshot during hot-plu...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Virtualization Manager
Classification: Red Hat
Component: ovirt-engine
Version: 3.1.0
Hardware: x86_64
OS: Linux
unspecified
medium
Target Milestone: ---
: 3.1.0
Assignee: Tal Nisan
QA Contact: Dafna Ron
URL:
Whiteboard: storage
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-07-30 16:04 UTC by Haim
Modified: 2016-02-10 17:04 UTC (History)
14 users (show)

Fixed In Version: si20
Doc Type: Release Note
Doc Text:
Previously when hot plugging and unplugging disks the Manager did not lock the virtual machine being modified. As a result it was possible to initiate snapshot and clone operations while the state of the virtual machine was undefined. This is no longer the case.
Clone Of:
Environment:
Last Closed: 2012-12-04 20:06:41 UTC
oVirt Team: Storage
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
engine.log (150.49 KB, application/x-gzip)
2012-07-30 16:07 UTC, Haim
no flags Details
logs (1.86 MB, application/x-gzip)
2012-09-21 08:39 UTC, Dafna Ron
no flags Details

Description Haim 2012-07-30 16:04:03 UTC
Description of problem:

the above case should be handled as a part of our locking mechanism (or some can_do_action).

a case of running vm, I can run hot-unplug of my disk and create snapshot (snapshot creation would file) or do this permutation with clone vm from snapshot. 

attached backend log - very easy to reproduce.

Comment 1 Haim 2012-07-30 16:07:29 UTC
Created attachment 601306 [details]
engine.log

Comment 4 mkublin 2012-08-01 06:59:07 UTC
The issue is simple, hot plug can be done when vm is up, a create snaphsot can be run when vm is up . These is only one common limitation on both operations.
You shoud add a read lock on vm at hotPlug and write lock on vm at CreateAllSnapshots.
Good example to some one from storage team to start to use a locking mechanism at storage scenario when locking mechanism was developed by infra team

Comment 5 Stephen Gordon 2012-08-09 15:59:24 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
When hot plugging and unplugging disks the Manager does not correctly lock the virtual machine being modified. As a result it is currently possible to initiation snapshot and clone operations while the virtual machines state is undefined. This will be rectified in a future update.

Comment 6 Stephen Gordon 2012-08-09 16:01:08 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-When hot plugging and unplugging disks the Manager does not correctly lock the virtual machine being modified. As a result it is currently possible to initiation snapshot and clone operations while the virtual machines state is undefined. This will be rectified in a future update.+When hot plugging and unplugging disks the Manager does not lock the virtual machine being modified. As a result it is currently possible to initiation snapshot and clone operations while the virtual machines state is undefined. This will be rectified in a future update.

Comment 7 Stephen Gordon 2012-08-09 16:01:26 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-When hot plugging and unplugging disks the Manager does not lock the virtual machine being modified. As a result it is currently possible to initiation snapshot and clone operations while the virtual machines state is undefined. This will be rectified in a future update.+When hot plugging and unplugging disks the Manager does not lock the virtual machine being modified. As a result it is currently possible to initiate snapshot and clone operations while the virtual machines state is undefined. This will be rectified in a future update.

Comment 8 Stephen Gordon 2012-08-09 16:01:39 UTC
    Technical note updated. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    Diffed Contents:
@@ -1 +1 @@
-When hot plugging and unplugging disks the Manager does not lock the virtual machine being modified. As a result it is currently possible to initiate snapshot and clone operations while the virtual machines state is undefined. This will be rectified in a future update.+When hot plugging and unplugging disks the Manager does not lock the virtual machine being modified. As a result it is currently possible to initiate snapshot and clone operations while the virtual machine's state is undefined. This will be rectified in a future update.

Comment 9 Tal Nisan 2012-09-10 14:45:33 UTC
http://gerrit.ovirt.org/#/c/7805/

Comment 11 Dafna Ron 2012-09-21 08:38:48 UTC
tested on si18
i was able to send hotplug command to vdsm during snapshot create (it failed with unexpected exception in vdsm)
but the command was sent so the locking mechanism is not preventing both actions from running (will attach both vdsm and backend logs). 

reproduce: 
1. open two sessions and run a vm with OS installed with virtIO disk
2. in one session create a snapshot
3. in second session deactivate the disk

results: 

2012-09-21 11:29:19,475 ERROR [org.ovirt.engine.core.vdsbroker.vdsbroker.BrokerCommandBase] (pool-4-thread-45) [45b9ec9c] Failed in HotPlugDiskVDS method
2012-09-21 11:29:19,475 ERROR [org.ovirt.engine.core.vdsbroker.vdsbroker.BrokerCommandBase] (pool-4-thread-45) [45b9ec9c] Error code unexpected and error message VDSGenericExce
ption: VDSErrorException: Failed to HotPlugDiskVDS, error = Unexpected exception
2012-09-21 11:29:19,475 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.BrokerCommandBase] (pool-4-thread-45) [45b9ec9c] Command org.ovirt.engine.core.vdsbroker.vdsbroker.HotP
lugDiskVDSCommand return value 
 Class Name: org.ovirt.engine.core.vdsbroker.vdsbroker.StatusOnlyReturnForXmlRpc
mStatus                       Class Name: org.ovirt.engine.core.vdsbroker.vdsbroker.StatusForXmlRpc
mCode                         16
mMessage                      Unexpected exception


2012-09-21 11:29:19,475 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.BrokerCommandBase] (pool-4-thread-45) [45b9ec9c] Vds: gold-vdsd
2012-09-21 11:29:19,475 ERROR [org.ovirt.engine.core.vdsbroker.VDSCommandBase] (pool-4-thread-45) [45b9ec9c] Command HotPlugDiskVDS execution failed. Exception: VDSErrorException: VDSGenericException: VDSErrorException: Failed to HotPlugDiskVDS, error = Unexpected exception
2012-09-21 11:29:19,475 INFO  [org.ovirt.engine.core.vdsbroker.vdsbroker.HotPlugDiskVDSCommand] (pool-4-thread-45) [45b9ec9c] FINISH, HotPlugDiskVDSCommand, log id: abcaf65
2012-09-21 11:29:19,476 ERROR [org.ovirt.engine.core.bll.HotPlugDiskToVmCommand] (pool-4-thread-45) [45b9ec9c] Command org.ovirt.engine.core.bll.HotPlugDiskToVmCommand throw Vdc Bll exception. With error message VdcBLLException: org.ovirt.engine.core.vdsbroker.vdsbroker.VDSErrorException: VDSGenericException: VDSErrorException: Failed to HotPlugDiskVDS, error = Unexpected exception
2012-09-21 11:29:19,478 INFO  [org.ovirt.engine.core.bll.HotPlugDiskToVmCommand] (pool-4-thread-45) [45b9ec9c] Lock freed to object EngineLock [exclusiveLocks= , sharedLocks= key: a5e725b4-262d-407b-8071-41f5a4ff4794 value: VM
]

Comment 12 Dafna Ron 2012-09-21 08:39:57 UTC
Created attachment 615306 [details]
logs

Comment 13 Tal Nisan 2012-09-27 18:00:29 UTC
The bug was about being able to create a snapshot during hot plug/unplug of a disk, you are talking about the reverse scenario, I think another bug should be opened instead of reopening this one

Comment 14 Tal Nisan 2012-10-02 11:18:53 UTC
http://gerrit.ovirt.org/#/c/8298/

Comment 16 Allon Mureinik 2012-10-02 17:51:20 UTC
merged change id I4980c8cff7aec9bd10bba344f9592bbbf1c20b8d

Comment 17 Dafna Ron 2012-10-07 10:53:20 UTC
verified on si12
we are getting CanDoAction on deactivate disk:

2012-10-07 12:47:54,657 WARN  [org.ovirt.engine.core.bll.HotUnPlugDiskFromVmCommand] (ajp-/127.0.0.1:8702-9) CanDoAction of action HotUnPlugDiskFromVm failed. Reasons:VAR__ACTION__HOT_UNPLUG,VAR__TYPE__VM_DISK,ACTION_TYPE_FAILED_VM_IS_DURING_SNAPSHOT


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