Liron Aravot has uploaded a new change for review.

Change subject: core : Preview snapshot - NPE after engine crash
......................................................................

core : Preview snapshot - NPE after engine crash

TryBackToAllSnapshotsOfVmCommand creates a new snapshot for each of the
snapshots disks. If there is an engine failure during the creation of
the tasks, when engine starts again compensation runs and then
endSuccesffuly() may be called by AsyncTaskManager as the tasks there
were created had succeeded in vdsm.

When performing the mentioned scenario, the run of endSuccesfully() will
cause to NPE as it try to perform operations on entites that were
deleted during compensation on the engine startup.

This patch adds a check to verify that the entites weren't deleted from
the DB (meaning - there was no engine failure) and only then proceed to
perform operation on them.

Change-Id: Ia4ddecc990fbca23fb98e8ab42cb1eb039e1fb59
Signed-off-by: Liron Aravot <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
1 file changed, 6 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/73/9073/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
index d8c0882..c462861 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/TryBackToAllSnapshotsOfVmCommand.java
@@ -86,7 +86,12 @@
 
         if (getVm() != null) {
             VmHandler.unlockVm(getVm(), getCompensationContext());
-            restoreVmConfigFromSnapshot();
+            // TODO : this line is temporary until AsyncTaskManager issues 
(missing tasks) would be solved,
+            // as of today - endSuccessfully() will be called also in case 
that tasks were initiated for some of the
+            // disks regardless if there was a failure during the 
initializtion of it.
+            if (getSnapshotDao().get(getParameters().getDstSnapshotId())!= 
null) {
+                restoreVmConfigFromSnapshot();
+            }
         } else {
             setCommandShouldBeLogged(false);
             log.warn("VmCommand::EndVmCommand: Vm is null - not performing 
EndAction on Vm");


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

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

Reply via email to