Skip to content

Commit 720407b

Browse files
authored
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>
1 parent 9d748f0 commit 720407b

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

server/src/main/java/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,13 @@ public Date scheduleNextSnapshotJob(final SnapshotPolicyVO policy) {
378378
if (policyId == Snapshot.MANUAL_POLICY_ID) {
379379
return null;
380380
}
381+
382+
if (_volsDao.findById(policy.getVolumeId()) == null) {
383+
s_logger.warn("Found snapshot policy ID: " + policyId + " for volume ID: " + policy.getVolumeId() + " that does not exist or has been removed");
384+
removeSchedule(policy.getVolumeId(), policy.getId());
385+
return null;
386+
}
387+
381388
final Date nextSnapshotTimestamp = getNextScheduledTime(policyId, _currentTimestamp);
382389
SnapshotScheduleVO spstSchedVO = _snapshotScheduleDao.findOneByVolumePolicy(policy.getVolumeId(), policy.getId());
383390
if (spstSchedVO == null) {

0 commit comments

Comments
 (0)