Allon Mureinik has uploaded a new change for review. Change subject: core: RemoveDisk preview validation ......................................................................
core: RemoveDisk preview validation In RemoveDisk, moved the validation that the VM is not in preview from ImagesHandler to SnapshotValidator, which is a more logical place for it. This patch does not only clean up the code, it also solves a subtle bug in RemoveDisk's flow. Before this patch, the VM's preview status was checked only for plugged image disks. However, since removing a disk needs to update all of the VM's OVFs and remove it from them, it would have performed incorrectly if used on a VM during preview mode. Note: This patch is part of a series of patches aimed at removing the preview validation from ImagesHandler altogether. Change-Id: Iefbea2785b3637ea5df3953d6e8f1a24765742a0 Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java 1 file changed, 14 insertions(+), 13 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/83/11183/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java index 5d739f5..7a2aa29 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveDiskCommand.java @@ -227,19 +227,20 @@ SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); List<Disk> diskList = Arrays.asList(getDisk()); for (VM vm : listVms) { - VmDevice vmDevice = getVmDeviceDAO().get(new VmDeviceId(getDisk().getId(), vm.getId())); - if (!validate(snapshotsValidator.vmNotDuringSnapshot(vm.getId())) || !ImagesHandler.PerformImagesChecks(vm, - getReturnValue().getCanDoActionMessages(), - vm.getStoragePoolId(), - getParameters().getStorageDomainId(), - false, - firstTime, - false, - false, - vmDevice.getIsPlugged() && getDisk().isAllowSnapshot(), - false, - firstTime, - diskList)) { + if (!validate(snapshotsValidator.vmNotDuringSnapshot(vm.getId())) || + !validate(snapshotsValidator.vmNotInPreview(vm.getId())) || + !ImagesHandler.PerformImagesChecks(vm, + getReturnValue().getCanDoActionMessages(), + vm.getStoragePoolId(), + getParameters().getStorageDomainId(), + false, + firstTime, + false, + false, + false, + false, + firstTime, + diskList)) { return false; } firstTime = false; -- To view, visit http://gerrit.ovirt.org/11183 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iefbea2785b3637ea5df3953d6e8f1a24765742a0 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Allon Mureinik <[email protected]> _______________________________________________ Engine-patches mailing list [email protected] http://lists.ovirt.org/mailman/listinfo/engine-patches
