You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/30 13:33:36 UTC

[2/2] git commit: updated refs/heads/4.4 to 6d0e43d

CLOUDSTACK-7000: Fix bugs in ListSnapshotPolicy and updateSnapshotPolicy command

(cherry picked from commit 63c4f028971f80a9dfa32125a3eed71468209497)


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/6d0e43d3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/6d0e43d3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/6d0e43d3

Branch: refs/heads/4.4
Commit: 6d0e43d36b191d0359d1f679cb3296429c7a17a4
Parents: 9d4d018
Author: Nitin Mehta <ni...@citrix.com>
Authored: Wed Jul 2 13:12:49 2014 -0700
Committer: Daan Hoogland <da...@onecht.net>
Committed: Wed Jul 30 13:33:22 2014 +0200

----------------------------------------------------------------------
 .../src/com/cloud/storage/snapshot/SnapshotManagerImpl.java   | 7 +++++--
 .../src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java | 3 ++-
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d0e43d3/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 71cf083..446699f 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -281,8 +281,11 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         Boolean display = cmd.getDisplay();
 
         SnapshotPolicyVO policyVO = _snapshotPolicyDao.findById(id);
-        if(display != null)
+        if(display != null){
+            boolean previousDisplay = policyVO.isDisplay();
             policyVO.setDisplay(display);
+            _snapSchedMgr.scheduleOrCancelNextSnapshotJobOnDisplayChange(policyVO, previousDisplay);
+        }
 
         if(customUUID != null)
             policyVO.setUuid(customUUID);
@@ -752,7 +755,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             result = _snapshotPolicyDao.listAndCountById(id, display, null);
             if(result != null && result.first() != null && !result.first().isEmpty()){
                 SnapshotPolicyVO snapshotPolicy = result.first().get(0);
-                volumeId = snapshotPolicy.getId();
+                volumeId = snapshotPolicy.getVolumeId();
             }
         }
         VolumeVO volume = _volsDao.findById(volumeId);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6d0e43d3/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
index 5ffc8e4..1090dcb 100644
--- a/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java
@@ -305,9 +305,10 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
             return null;
         }
 
-        // If display attribute is false then remove schedules if any.
+        // If display attribute is false then remove schedules if any and return.
         if(!policy.isDisplay()){
             removeSchedule(policy.getVolumeId(), policy.getId());
+            return null;
         }
 
         final long policyId = policy.getId();