Allon Mureinik has uploaded a new change for review. Change subject: core: Consolidate vm down check when removing disk ......................................................................
core: Consolidate vm down check when removing disk Both removing an image and a LUN disk had to check that the VM is down, and this check was done in two separate places. This patch consolidates this treatment to one function and stops using ImagesHandler to perform this check for images. Note: This patch is part of a series intended to remove the VM status check from ImagesHandler. Change-Id: Ia1a23e1f8d129bf19c1d217c7b9201dc17a2d2c0 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, 6 insertions(+), 7 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/13/11013/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 78e4253..a4b7844 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 @@ -78,15 +78,14 @@ } buildSharedLockMap(); - if (!acquireLockInternal()) { - return false; - } - return (disk.getDiskStorageType() == DiskStorageType.IMAGE ? - canRemoveDiskBasedOnImageStorageCheck() : canRemoveLunDisk()); + return acquireLockInternal() && + validateAllVmsForDiskAreDown() && + disk.getDiskStorageType() == DiskStorageType.IMAGE ? + canRemoveDiskBasedOnImageStorageCheck() : true; } - private boolean canRemoveLunDisk() { + private boolean validateAllVmsForDiskAreDown() { if (disk.getVmEntityType() == VmEntityType.VM) { for (VM vm : getVmsForDiskId()) { if (vm.getStatus() != VMStatus.Down) { @@ -229,7 +228,7 @@ false, false, vmDevice.getIsPlugged() && disk.isAllowSnapshot(), - vmDevice.getIsPlugged(), + false, false, firstTime, diskList)) { -- To view, visit http://gerrit.ovirt.org/11013 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ia1a23e1f8d129bf19c1d217c7b9201dc17a2d2c0 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
