Arik Hadas has uploaded a new change for review.

Change subject: core: fix stateless VM which was reverted to ram snapshot
......................................................................

core: fix stateless VM which was reverted to ram snapshot

We were removing the memory volumes from snapshots in case the live part
of the snapshot did not happen and the snapshot is set to include
memory. This logic is not good because when it comes to stateless
snapshots, the snapshots contain memory (the memory that was associated
with the active snapshot) and it is not a live snapshot, but we don't
want to remove the memory associated with it.

Therefore, this patch changes the logic that is used to determine
whether or not to remove the memory which is associated with snapshot
when the live part of the snapshot doesn't happen, such that we'll also
ask if the memory was created as part of this snapshot and only if it
is, we will delete it.

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


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/54/21254/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 b115817..ebc0ad2 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
@@ -245,7 +245,7 @@
                     } else {
                         // If the created snapshot contains memory, remove the 
memory volumes as
                         // they are not in use since no live snapshot was 
created
-                        if (!createdSnapshot.getMemoryVolume().isEmpty()) {
+                        if (getParameters().isSaveMemory() && 
!createdSnapshot.getMemoryVolume().isEmpty()) {
                             logMemorySavingFailed();
                             if (!removeMemoryFromSnapshot(createdSnapshot, 
true)) {
                                 log.errorFormat("Failed to remove unused 
memory {0} of snapshot {1}",
@@ -258,9 +258,11 @@
                         revertToActiveSnapshot(createdSnapshot.getId());
                         // If the removed snapshot contained memory, remove 
the memory volumes
                         // Note that the memory volumes might not have been 
created
-                        if (!removeMemoryFromSnapshot(createdSnapshot, false)) 
{
-                            log.warnFormat("Failed to remove memory {0} of 
snapshot {1}",
-                                    createdSnapshot.getMemoryVolume(), 
createdSnapshot.getId());
+                        if (getParameters().isSaveMemory() && 
!createdSnapshot.getMemoryVolume().isEmpty()) {
+                            if (!removeMemoryFromSnapshot(createdSnapshot, 
false)) {
+                                log.warnFormat("Failed to remove memory {0} of 
snapshot {1}",
+                                        createdSnapshot.getMemoryVolume(), 
createdSnapshot.getId());
+                            }
                         }
                     } else {
                         log.warnFormat("No snapshot was created for VM {0} 
which is in LOCKED status", getVmId());
@@ -268,7 +270,6 @@
                 }
 
                 incrementVmGeneration();
-
                 endActionOnDisks();
                 setSucceeded(taskGroupSucceeded);
                 getReturnValue().setEndActionTryAgain(false);


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

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

Reply via email to