Arik Hadas has uploaded a new change for review.

Change subject: core: cleanup MigrateVmToServerCommand#canDoAction
......................................................................

core: cleanup MigrateVmToServerCommand#canDoAction

Change-Id: Ida781a939463a29597944a9c5adf48cf539d621d
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmToServerCommand.java
1 file changed, 3 insertions(+), 9 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/70/34270/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 b8c360d..06f5eaf 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
@@ -10,9 +10,7 @@
 import org.ovirt.engine.core.common.action.LockProperties;
 import org.ovirt.engine.core.common.action.LockProperties.Scope;
 import org.ovirt.engine.core.common.action.MigrateVmToServerParameters;
-import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VDSStatus;
-import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.errors.VdcBllMessages;
 import org.ovirt.engine.core.compat.Guid;
 
@@ -34,9 +32,7 @@
 
     @Override
     protected boolean canDoAction() {
-        Guid destinationId = getDestinationVdsId();
-        VDS vds = getVdsDAO().get(destinationId);
-        if (vds == null) {
+        if (getDestinationVds() == null) {
             return failCanDoAction(VdcBllMessages.VDS_INVALID_SERVER_ID);
         }
 
@@ -49,13 +45,11 @@
             return false;
         }
 
-        VM vm = getVm();
-
-        if (vm.getRunOnVds() != null && 
vm.getRunOnVds().equals(destinationId)) {
+        if (getVm().getRunOnVds() != null && 
getVm().getRunOnVds().equals(getDestinationVdsId())) {
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MIGRATION_TO_SAME_HOST);
         }
 
-        if (!vm.getVdsGroupId().equals(getDestinationVds().getVdsGroupId())) {
+        if 
(!getVm().getVdsGroupId().equals(getDestinationVds().getVdsGroupId())) {
             return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_MIGRATE_BETWEEN_TWO_CLUSTERS);
         }
 


-- 
To view, visit http://gerrit.ovirt.org/34270
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ida781a939463a29597944a9c5adf48cf539d621d
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Arik Hadas <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to