Repository: cloudstack Updated Branches: refs/heads/4.4-forward a28d65fc4 -> 63c4f0289
CLOUDSTACK-7000: Fix bugs in ListSnapshotPolicy and updateSnapshotPolicy command Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/63c4f028 Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/63c4f028 Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/63c4f028 Branch: refs/heads/4.4-forward Commit: 63c4f028971f80a9dfa32125a3eed71468209497 Parents: a28d65f 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:12:49 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/63c4f028/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/63c4f028/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();