Arik Hadas has uploaded a new change for review.

Change subject: core: refactoring memory removal from active snapshot (2)
......................................................................

core: refactoring memory removal from active snapshot (2)

Change RunVmCommand#removeMemoryFromActiveSnapshot such that it will
first clear the memory from the active snapshot and only then remove the
volumes.

Change-Id: I1b29ed8bb22ab8011bd4d89fcc08942323f1bf6f
Signed-off-by: Arik Hadas <[email protected]>
---
M 
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
1 file changed, 4 insertions(+), 3 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/66/37066/1

diff --git 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
index 0680429..6a63925 100644
--- 
a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
+++ 
b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java
@@ -1050,11 +1050,12 @@
             return;
         }
 
-        // If the active snapshot is the only one that points to the memory 
volume we can remove it
-        if (getSnapshotDAO().getNumOfSnapshotsByMemory(memory) == 1) {
+        getSnapshotDAO().removeMemoryFromActiveSnapshot(getVmId());
+
+        // If the memory volumes are not used by any other snapshot, we can 
remove them
+        if (getSnapshotDAO().getNumOfSnapshotsByMemory(memory) == 0) {
             removeMemoryVolumes(memory, getActionType(), true);
         }
-        getSnapshotDAO().removeMemoryFromActiveSnapshot(getVmId());
     }
 
     /**


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

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

Reply via email to