Arik Hadas has uploaded a new change for review. Change subject: core: check vds status on resume paused VM ......................................................................
core: check vds status on resume paused VM Checking whether the VDS that the VM is going to be resumed on is up was missing when resuming a paused VM (regression). Change-Id: Iac123f1758e5ed3dcedab335546df322fd76a0af Signed-off-by: Arik Hadas <aha...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java 2 files changed, 14 insertions(+), 5 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/45/18245/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java index d5b3af3..09607f3 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java @@ -754,8 +754,9 @@ RunVmValidator runVmValidator = getRunVmValidator(); if (vm.getStatus() == VMStatus.Paused) { - // if VM is paused, it was already checked before that it is capable to run - return true; + // if the VM is paused, we should only check the VDS status + // as the rest of the checks were already checked before + return validate(runVmValidator.validateVdsStatus()); } if (!runVmValidator.canRunVm( diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java index 8d7d5a7..5a591fd 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/RunVmValidator.java @@ -143,6 +143,10 @@ return ValidationResult.VALID; } + public ValidationResult validateVdsStatus() { + return validateVdsStatus(vm); + } + /////////////////////////////////// /// Internal validation methods /// /////////////////////////////////// @@ -271,9 +275,9 @@ protected ValidationResult validateVdsStatus(VM vm) { if (vm.getStatus() == VMStatus.Paused && vm.getRunOnVds() != null) { - VDS vds = getVdsDao().get(new Guid(vm.getRunOnVds().toString())); - if (vds.getStatus() != VDSStatus.Up) { - return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL, + if (getVds(vm.getRunOnVds()).getStatus() != VDSStatus.Up) { + return new ValidationResult( + VdcBllMessages.ACTION_TYPE_FAILED_VDS_STATUS_ILLEGAL, VdcBllMessages.VAR__HOST_STATUS__UP.toString()); } } @@ -479,6 +483,10 @@ return map; } + private VDS getVds(Guid vdsId) { + return getVdsDao().get(vdsId); + } + private List<Disk> getVmDisks() { if (cachedVmDisks == null) { cachedVmDisks = getDiskDao().getAllForVm(vm.getId(), true); -- To view, visit http://gerrit.ovirt.org/18245 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Iac123f1758e5ed3dcedab335546df322fd76a0af Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Arik Hadas <aha...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches