You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by an...@apache.org on 2020/04/01 12:24:50 UTC

[cloudstack] 01/01: Move the snapshotDao.remove(snapshotId);

This is an automated email from the ASF dual-hosted git repository.

andrijapanic pushed a commit to branch andrijapanicsb-patch-3
in repository https://gitbox.apache.org/repos/asf/cloudstack.git

commit 631cb83d9076a281deaf68617bbb9b83efc4db3d
Author: Andrija Panic <45...@users.noreply.github.com>
AuthorDate: Wed Apr 1 14:24:37 2020 +0200

    Move the snapshotDao.remove(snapshotId);
---
 .../org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java
index 219c2e8..fba2674 100644
--- a/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/main/java/org/apache/cloudstack/storage/snapshot/DefaultSnapshotStrategy.java
@@ -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;