Move the snapshotDao.remove(snapshotId); (#4006)

This commit is contained in:
Andrija Panic 2020-04-01 14:27:27 +02:00 committed by GitHub
parent 7121967892
commit 3eafab4221
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -267,6 +267,7 @@ public class DefaultSnapshotStrategy extends SnapshotStrategyBase {
boolean deletedOnSecondary = false;
if (snapshotOnImage == null) {
s_logger.debug(String.format("Can't find snapshot [snapshot id: %d] on backup storage", snapshotId));
snapshotDao.remove(snapshotId);
} else {
SnapshotObject obj = (SnapshotObject)snapshotOnImage;
try {
@ -326,7 +327,6 @@ public class DefaultSnapshotStrategy extends SnapshotStrategyBase {
if (isSnapshotOnPrimaryStorage(snapshotId) && snapshotSvr.deleteSnapshot(snapshotOnPrimaryInfo)) {
snapshotOnPrimary.setState(State.Destroyed);
snapshotStoreDao.update(snapshotOnPrimary.getId(), snapshotOnPrimary);
snapshotDao.remove(snapshotId);
return true;
}
return false;