diff --git a/server/src/main/java/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java b/server/src/main/java/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java index a9c402c86be..d4fe08397f9 100644 --- a/server/src/main/java/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java +++ b/server/src/main/java/com/cloud/storage/snapshot/SnapshotSchedulerImpl.java @@ -378,6 +378,13 @@ public class SnapshotSchedulerImpl extends ManagerBase implements SnapshotSchedu 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) {