Repository: cloudstack Updated Branches: refs/heads/master d64adf591 -> 1f7a81844
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/1f7a8184 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/1f7a8184 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/1f7a8184 Branch: refs/heads/master Commit: 1f7a818440b40659be8882e2d52a043d099940e0 Parents: d64adf5 Author: Nitin Mehta <nitin.me...@citrix.com> Authored: Wed Jul 2 13:12:49 2014 -0700 Committer: Nitin Mehta <nitin.me...@citrix.com> Committed: Wed Jul 2 13:13:51 2014 -0700 ---------------------------------------------------------------------- .../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/1f7a8184/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 11362e4..5c114c5 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/1f7a8184/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 b11d27b..ba3d63a 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();