cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject git commit: updated refs/heads/master to 92d9ef9
Date Thu, 06 Nov 2014 23:04:49 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 455ffc334 -> 92d9ef9c1


Handle the case where a snapshot is associated with a deleted volume

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/92d9ef9c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/92d9ef9c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/92d9ef9c

Branch: refs/heads/master
Commit: 92d9ef9c1725cc1c50dbcb1570ce0926a61c5b76
Parents: 455ffc3
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Thu Nov 6 15:34:39 2014 -0700
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Thu Nov 6 15:34:39 2014 -0700

----------------------------------------------------------------------
 .../cloudstack/storage/test/EndpointSelectorTest.java  |  3 ---
 server/src/com/cloud/api/ApiResponseHelper.java        | 13 ++++++++++---
 2 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92d9ef9c/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
----------------------------------------------------------------------
diff --git a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
index f81b8fe..29acf94 100644
--- a/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
+++ b/engine/storage/integration-test/test/org/apache/cloudstack/storage/test/EndpointSelectorTest.java
@@ -54,7 +54,6 @@ import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreDao;
 import org.apache.cloudstack.storage.datastore.db.ImageStoreVO;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 
 import com.cloud.agent.AgentManager;
@@ -101,8 +100,6 @@ public class EndpointSelectorTest {
     @Inject
     PrimaryDataStoreProvider primaryDataStoreProvider;
     @Inject
-    SnapshotDataStoreDao snapshotDataStoreDao;
-    @Inject
     VolumeDao volumeDao;
     @Inject
     VolumeService volumeService;

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/92d9ef9c/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 38784ae..4c22127 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -149,6 +149,8 @@ import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
 import org.apache.cloudstack.region.PortableIp;
 import org.apache.cloudstack.region.PortableIpRange;
 import org.apache.cloudstack.region.Region;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.SnapshotDataStoreVO;
 import org.apache.cloudstack.usage.Usage;
 import org.apache.cloudstack.usage.UsageService;
 import org.apache.cloudstack.usage.UsageTypes;
@@ -330,6 +332,8 @@ public class ApiResponseHelper implements ResponseGenerator {
     private VolumeDao _volumeDao;
     @Inject
     private DataStoreManager _dataStoreMgr;
+    @Inject
+    SnapshotDataStoreDao _snapshotStoreDao;
 
     @Override
     public UserResponse createUserResponse(User user) {
@@ -497,10 +501,13 @@ public class ApiResponseHelper implements ResponseGenerator {
     }
 
     private DataStoreRole getDataStoreRole(Snapshot snapshot) {
-        long volumeId = snapshot.getVolumeId();
-        VolumeVO volumeVO = _volumeDao.findById(volumeId);
+        SnapshotDataStoreVO snapshotStore = _snapshotStoreDao.findBySnapshot(snapshot.getId(),
DataStoreRole.Primary);
+
+        if (snapshotStore == null) {
+            return DataStoreRole.Image;
+        }
 
-        long storagePoolId = volumeVO.getPoolId();
+        long storagePoolId = snapshotStore.getDataStoreId();
         DataStore dataStore = _dataStoreMgr.getDataStore(storagePoolId, DataStoreRole.Primary);
 
         Map<String, String> mapCapabilities = dataStore.getDriver().getCapabilities();


Mime
View raw message