Maor Lipchuk has uploaded a new change for review.

Change subject: core: Snapshot should not be update after rollback.
......................................................................

core: Snapshot should not be update after rollback.

Once createAllSnapshotCommand execution encountered a rollback,
The new snapshot is deleted as part of the compensation scenario.

That will cause the end method to get null value for the snapshotId and
will cause an sql exception when it will be updated.

The update phase should be only when the tasks failed but
also when command finished successfully and the snapshot was already
created in the DB.

Change-Id: Ia96cd0958dcdb34d590a160b422b3b2562149344
Signed-off-by: Maor Lipchuk <mlipc...@redhat.com>
Bug-Url: https://bugzilla.redhat.com/917719
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
1 file changed, 4 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/31/12731/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
index 67ce42f..76aa476 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CreateAllSnapshotsFromVmCommand.java
@@ -254,8 +254,10 @@
      *            The snapshot ID to return to being active.
      */
     protected void revertToActiveSnapshot(Guid createdSnapshotId) {
-        getSnapshotDao().remove(createdSnapshotId);
-        getSnapshotDao().updateId(getSnapshotDao().getId(getVmId(), 
SnapshotType.ACTIVE), createdSnapshotId);
+        if (createdSnapshotId != null) {
+            getSnapshotDao().remove(createdSnapshotId);
+            getSnapshotDao().updateId(getSnapshotDao().getId(getVmId(), 
SnapshotType.ACTIVE), createdSnapshotId);
+        }
         setSucceeded(false);
     }
 


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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia96cd0958dcdb34d590a160b422b3b2562149344
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Maor Lipchuk <mlipc...@redhat.com>
_______________________________________________
Engine-patches mailing list
Engine-patches@ovirt.org
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to