Arik Hadas has uploaded a new change for review.

Change subject: core: fix possible NPE on migration failure
......................................................................

core: fix possible NPE on migration failure

We recently added a call to decrease pending memory from the destination
VDS when migration ends. This code was added to the
MigrateVmCommand#reportCompleted method and we assume that the
destination VDS is not null when we reach that method, but in some cases
where the migration fails we might reach the reportCompleted method
after the destination VDS is set to null (see MigrateVmCommand#rerun).

This patch solves this issue by adding null-check which ensures that the
destination VDS is valid before calling to decrease its pending memory.

Change-Id: If5c975ba5a0824c80be36cb997b3b040b5191192
Bug-Url: https://bugzilla.redhat.com/1048790
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
1 file changed, 5 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/12/23812/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
index d51644e..56c5cb0 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/MigrateVmCommand.java
@@ -395,11 +395,11 @@
             super.reportCompleted();
         }
         finally {
-            /*
-             * Decrement the pending counters here as this is the only place 
which
-             * is called consistently regardless of the migration result.
-             */
-            decreasePendingVms(getVdsDestinationId());
+            // Decrement the pending counters here as this is the only place 
which
+            // is called consistently regardless of the migration result.
+            if (getVdsDestinationId() != null) {
+                decreasePendingVms(getVdsDestinationId());
+            }
 
             freeLock();
         }


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

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

Reply via email to