mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 10:32:34 +01:00
snapshot: don't schedule next snapshot job for a removed volume (#8735)
* snapshot: don't schedule next snapshot job for a removed volume When management server starts, it starts the snapshot scheduler. In case there is a volume snapshot policy which exists for a volume which does not exist, it can cause SQL constraint issue and cause the management server to break from starting its various components and cause HTTP 503 error. Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com> * remove schedule on missing volume --------- Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
This commit is contained in:
parent
9d748f0837
commit
720407ba73
@ -378,6 +378,13 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu
|
|||||||
if (policyId == Snapshot.MANUAL_POLICY_ID) {
|
if (policyId == Snapshot.MANUAL_POLICY_ID) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_volsDao.findById(policy.getVolumeId()) == null) {
|
||||||
|
s_logger.warn("Found snapshot policy ID: " + policyId + " for volume ID: " + policy.getVolumeId() + " that does not exist or has been removed");
|
||||||
|
removeSchedule(policy.getVolumeId(), policy.getId());
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
final Date nextSnapshotTimestamp = getNextScheduledTime(policyId, _currentTimestamp);
|
final Date nextSnapshotTimestamp = getNextScheduledTime(policyId, _currentTimestamp);
|
||||||
SnapshotScheduleVO spstSchedVO = _snapshotScheduleDao.findOneByVolumePolicy(policy.getVolumeId(), policy.getId());
|
SnapshotScheduleVO spstSchedVO = _snapshotScheduleDao.findOneByVolumePolicy(policy.getVolumeId(), policy.getId());
|
||||||
if (spstSchedVO == null) {
|
if (spstSchedVO == null) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user