Liron Aravot has posted comments on this change.
Change subject: core: WIP : RemoveImageDisk - race when updating snapshots ovf
(#828192)
......................................................................
Patch Set 13: (4 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveImageCommand.java
Line 112: VM vm = getVmForNonShareableDiskImage(diskImage);
Line 113: lockVmSnapshotsWithWait(vm);
Line 114: updatedSnapshots =
prepareSnapshotConfigWithoutImage(diskImage.getId());
Line 115: } else {
Line 116: updatedSnapshots = null;
Done
Line 117: }
Line 118:
Line 119:
TransactionSupport.executeInScope(TransactionScopeOption.Required,
Line 120: new TransactionMethod<Object>() {
Line 160: }
Line 161: }
Line 162: }
Line 163:
Line 164: EngineLock snapshotsEngineLock = new EngineLock();
Done
Line 165:
Line 166: private void lockVmSnapshotsWithWait(VM vm) {
Line 167: Map<String, String> snapshotsExlusiveLockMap = new
HashMap<String, String>();
Line 168: snapshotsExlusiveLockMap.put(vm.getId().toString(),
LockingGroup.VM_SNAPSHOTS.name());
Line 164: EngineLock snapshotsEngineLock = new EngineLock();
Line 165:
Line 166: private void lockVmSnapshotsWithWait(VM vm) {
Line 167: Map<String, String> snapshotsExlusiveLockMap = new
HashMap<String, String>();
Line 168: snapshotsExlusiveLockMap.put(vm.getId().toString(),
LockingGroup.VM_SNAPSHOTS.name());
Done
Line 169:
snapshotsEngineLock.setExclusiveLocks(snapshotsExlusiveLockMap);
Line 170: getLockManager().acquireLockWait(snapshotsEngineLock);
Line 171: }
Line 172:
Line 182: */
Line 183: private VM getVmForNonShareableDiskImage(DiskImage disk) {
Line 184: if (!disk.isShareable()) {
Line 185: List<VM> vms = getVmDAO().getVmsListForDisk(disk.getId());
Line 186: if (vms != null && !vms.isEmpty()) {
Done
Line 187: return vms.get(0);
Line 188: }
Line 189: }
Line 190: return null;
--
To view, visit http://gerrit.ovirt.org/7482
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: Iccb44f1aa9d204477955343167133849a4146753
Gerrit-PatchSet: 13
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Liron Aravot <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: Ayal Baron <[email protected]>
Gerrit-Reviewer: Daniel Erez <[email protected]>
Gerrit-Reviewer: Liron Aravot <[email protected]>
Gerrit-Reviewer: Maor Lipchuk <[email protected]>
Gerrit-Reviewer: Michael Kublin <[email protected]>
Gerrit-Reviewer: Tal Nisan <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches