You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cloudstack.apache.org by "Wei Zhou (JIRA)" <ji...@apache.org> on 2016/03/02 11:46:18 UTC

[jira] [Comment Edited] (CLOUDSTACK-9297) delete snapshot without id is failing with Unable to determine the storage pool of the snapshot

    [ https://issues.apache.org/jira/browse/CLOUDSTACK-9297?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15175327#comment-15175327 ] 

Wei Zhou edited comment on CLOUDSTACK-9297 at 3/2/16 10:46 AM:
---------------------------------------------------------------

[~mike-tutkowski] you are the author of StorageSystemSnapshotStrategy.java. can you have a look ?



was (Author: weizhou):
we have two solutions to fix it.

1. 
{code}
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/Stora
index d1470e4..ae1be51 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
@@ -449,21 +449,8 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
                 return StrategyPriority.CANT_HANDLE;
         }

-        long storagePoolId;
-
-        if (volumeVO == null) {
-            SnapshotDataStoreVO snapshotStore = _snapshotStoreDao.findBySnapshot(snapshot.getId(), DataStoreRole.Primary);
-
-            if (snapshotStore != null) {
-                storagePoolId = snapshotStore.getDataStoreId();
-            }
-            else {
-                throw new CloudRuntimeException("Unable to determine the storage pool of the snapshot");
-            }
-        }
-        else {
-            storagePoolId = volumeVO.getPoolId();
-        }
+        volumeVO = _volumeDao.findByIdIncludingRemoved(volumeId);
+        long storagePoolId = volumeVO.getPoolId();

         DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
{code}

2. 
{code}
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/Stora
index d1470e4..14b3d60 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/StorageSystemSnapshotStrategy.java
@@ -458,7 +458,8 @@ public class StorageSystemSnapshotStrategy extends SnapshotStrategyBase {
                 storagePoolId = snapshotStore.getDataStoreId();
             }
             else {
-                throw new CloudRuntimeException("Unable to determine the storage pool of the snapshot");
+                volumeVO = _volumeDao.findByIdIncludingRemoved(volumeId);
+                storagePoolId = volumeVO.getPoolId();
             }
         }
         else {
{code}

[~mike-tutkowski] you are the author of StorageSystemSnapshotStrategy.java. can you have a look ?


> delete snapshot without id is failing with Unable to determine the storage pool of the snapshot
> -----------------------------------------------------------------------------------------------
>
>                 Key: CLOUDSTACK-9297
>                 URL: https://issues.apache.org/jira/browse/CLOUDSTACK-9297
>             Project: CloudStack
>          Issue Type: Bug
>      Security Level: Public(Anyone can view this level - this is the default.) 
>          Components: API
>    Affects Versions: 4.8.0
>         Environment: Ubuntu 14.04.3 management + kvm
>            Reporter: Özhan Rüzgar Karaman
>




--
This message was sent by Atlassian JIRA
(v6.3.4#6332)