Skip to content

Commit

Permalink
snapshot: don't schedule next snapshot job for a removed volume (apac…
Browse files Browse the repository at this point in the history
…he#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>
  • Loading branch information
rohityadavcloud authored Mar 19, 2024
1 parent 9d748f0 commit 720407b
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,13 @@ public Date scheduleNextSnapshotJob(final SnapshotPolicyVO policy) {
if (policyId == Snapshot.MANUAL_POLICY_ID) {
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);
SnapshotScheduleVO spstSchedVO = _snapshotScheduleDao.findOneByVolumePolicy(policy.getVolumeId(), policy.getId());
if (spstSchedVO == null) {
Expand Down

0 comments on commit 720407b

Please sign in to comment.