Arik Hadas has uploaded a new change for review.

Change subject: core: fix possible NPE in internal migration
......................................................................

core: fix possible NPE in internal migration

The check for migration support uses the VM and it was executed before
the VM was validated (that it is not null). Thus, this patch changes the
order of the checks, so that the migration support check will be
executed after the checks in MigrateVmCommand are executed.

Change-Id: I1c287d989e62daa43e834d9f9657dac9820764a3
Signed-off-by: Arik Hadas <aha...@redhat.com>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InternalMigrateVmCommand.java
1 file changed, 7 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/86/18586/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InternalMigrateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InternalMigrateVmCommand.java
index a27e029..a453aac 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InternalMigrateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/InternalMigrateVmCommand.java
@@ -31,10 +31,14 @@
      */
     @Override
     protected boolean canDoAction() {
-        if (getVm().getMigrationSupport() == MigrationSupport.MIGRATABLE) {
-            return super.canDoAction();
+        if (!super.canDoAction()) {
+            return false;
         }
 
-        return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NON_MIGRTABLE);
+        if (getVm().getMigrationSupport() != MigrationSupport.MIGRATABLE) {
+            return 
failCanDoAction(VdcBllMessages.ACTION_TYPE_FAILED_VM_IS_NON_MIGRTABLE);
+        }
+
+        return true;
     }
 }


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I1c287d989e62daa43e834d9f9657dac9820764a3
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

Reply via email to