Arik Hadas has uploaded a new change for review. Change subject: core: reorder checks in migrate vm to server command ......................................................................
core: reorder checks in migrate vm to server command Rearrange the order of the checks which are carried out in MigrationVmToServerCommand#canDoAction method, such that checks which are use the VM will be executed after the VM is validated in MigrateVmCommand#canDoAction. Change-Id: Icc96ecb14eb0350823dc7ea2fd95a2b56ca2ec41 Signed-off-by: Arik Hadas <aha...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java 1 file changed, 8 insertions(+), 4 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/74/18474/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java index a1829e2..eae49ce 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java @@ -5,7 +5,6 @@ import org.ovirt.engine.core.common.businessentities.VM; import org.ovirt.engine.core.common.errors.VdcBllMessages; import org.ovirt.engine.core.compat.Guid; -import org.ovirt.engine.core.dal.dbbroker.DbFacade; @LockIdNameAttribute(isReleaseAtEndOfExecute = false) public class MigrateVmToServerCommand<T extends MigrateVmToServerParameters> extends MigrateVmCommand<T> { @@ -16,12 +15,17 @@ @Override protected boolean canDoAction() { - VM vm = getVm(); Guid destinationId = getVdsDestinationId(); - VDS vds = DbFacade.getInstance().getVdsDao().get(destinationId); + VDS vds = getVdsDAO().get(destinationId); if (vds == null) { return failCanDoAction(VdcBllMessages.VDS_INVALID_SERVER_ID); } + + if (!super.canDoAction()) { + return false; + } + + VM vm = getVm(); if (vm.getRunOnVds() != null && vm.getRunOnVds().equals(destinationId)) { return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MIGRATION_TO_SAME_HOST); @@ -31,7 +35,7 @@ return failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MIGRATE_BETWEEN_TWO_CLUSTERS); } - return super.canDoAction(); + return true; } /** -- To view, visit http://gerrit.ovirt.org/18474 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Icc96ecb14eb0350823dc7ea2fd95a2b56ca2ec41 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