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.
Created attachment 601306 [details] engine.log
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
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.
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.
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.
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.
http://gerrit.ovirt.org/#/c/7805/
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 ]
Created attachment 615306 [details] logs
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
http://gerrit.ovirt.org/#/c/8298/
merged change id I4980c8cff7aec9bd10bba344f9592bbbf1c20b8d
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