Arik Hadas has uploaded a new change for review.

Change subject: core: fix possible NPE on run/migrate commands
......................................................................

core: fix possible NPE on run/migrate commands

In some cases we might reach the runningFailed method when no host was
selected by the scheduler, so we could get NPE when trying to decrease
the pending memory. So null-check is added.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/17/31617/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
index a514e37..dcc195d 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommandBase.java
@@ -27,6 +27,7 @@
 import org.ovirt.engine.core.common.businessentities.LUNs;
 import org.ovirt.engine.core.common.businessentities.LunDisk;
 import org.ovirt.engine.core.common.businessentities.StorageServerConnections;
+import org.ovirt.engine.core.common.businessentities.VDS;
 import org.ovirt.engine.core.common.businessentities.VM;
 import org.ovirt.engine.core.common.businessentities.VMStatus;
 import org.ovirt.engine.core.common.businessentities.VmStatic;
@@ -227,7 +228,7 @@
                 @Override
                 public void run() {
                     for (Guid vdsId : getRunVdssList()) {
-                        if (!getCurrentVdsId().equals(vdsId)) {
+                        if (!vdsId.equals(getCurrentVdsId())) {
                             Backend.getInstance().getResourceManager()
                                     
.RunVdsCommand(VDSCommandType.FailedToRunVm, new 
FailedToRunVmVDSCommandParameters(vdsId));
                         }
@@ -272,7 +273,8 @@
     }
 
     protected Guid getCurrentVdsId() {
-        return getVds().getId();
+        VDS vds = getVds();
+        return vds != null ? vds.getId() : null;
     }
 
     @Override


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

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