CLOUDSTACK-7000: Fix bugs in ListSnapshotPolicy and updateSnapshotPolicy command

(cherry picked from commit 63c4f028971f80a9dfa32125a3eed71468209497)
This commit is contained in:
Nitin Mehta 2014-07-02 13:12:49 -07:00
parent d64adf5912
commit 1f7a818440
2 changed files with 7 additions and 3 deletions

View File

@ -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);

View File

@ -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();