Allon Mureinik has uploaded a new change for review. Change subject: core: RemoveVm preview validation ......................................................................
core: RemoveVm preview validation In RemoveVm, moved the validation that the VM is not in preview from ImagesHandler to SnapshotValidator, which is a more logical place for it. Note: VM preview validation is done only if getForce()==true. This is done to keep consistency with the current behavior, which has been in place since this git repository was established. Whether or not it is correct is a different question, which warrants inspection in an additional patch. Note: This patch is part of a series of patches aimed at removing the preview validation from ImagesHandler altogether. Change-Id: If49d2094589c639736649ee2eadcd45df9872826 Signed-off-by: Allon Mureinik <[email protected]> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java 1 file changed, 8 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/87/11187/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java index e7d42e7..adcb51e 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RemoveVmCommand.java @@ -136,10 +136,13 @@ } // enable to remove vms without images - ValidationResult vmDuringSnapshotResult = - new SnapshotsValidator().vmNotDuringSnapshot(getVm().getId()); - if (!vmDuringSnapshotResult.isValid()) { - return failCanDoAction(vmDuringSnapshotResult.getMessage()); + SnapshotsValidator snapshotsValidator = new SnapshotsValidator(); + if (!validate(snapshotsValidator.vmNotDuringSnapshot(getVmId()))) { + return false; + } + + if (getParameters().getForce() && !validate(snapshotsValidator.vmNotInPreview(getVmId()))) { + return false; } if (!ImagesHandler.PerformImagesChecks(getVm(), @@ -150,7 +153,7 @@ !getParameters().getForce(), false, false, - getParameters().getForce(), + false, !getVm().getDiskMap().values().isEmpty(), true, getVm().getDiskMap().values())) { -- To view, visit http://gerrit.ovirt.org/11187 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: If49d2094589c639736649ee2eadcd45df9872826 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
