cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chipchild...@apache.org
Subject git commit: updated refs/heads/master to 6bad34c
Date Wed, 03 Jul 2013 13:50:08 GMT
Updated Branches:
  refs/heads/master 141fbc7ef -> 6bad34c50


CLOUDSTACK-3110: [VMWARE]NPE while adding primary storage(scope=cluster) with Invalid hostname

Description:

    When retrieving primary datastore, handle case for non-existing datastores/hosts.
    Throw exception and handle the exception in datastore mgmt layer and pass onward
    to create storage pool API.


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

Branch: refs/heads/master
Commit: 6bad34c50996217688b55f69433ddbb0aeb3911b
Parents: 141fbc7
Author: Vijayendra Bhamidipati <vijayendra.bhamidipati@citrix.com>
Authored: Tue Jul 2 10:52:41 2013 -0700
Committer: Chip Childers <chipchilders@apache.org>
Committed: Wed Jul 3 09:43:00 2013 -0400

----------------------------------------------------------------------
 .../storage/datastore/DataStoreManagerImpl.java     | 16 ++++++++++------
 .../PrimaryDataStoreProviderManagerImpl.java        |  4 ++++
 2 files changed, 14 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6bad34c5/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
index 71df262..2d7e99e 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/DataStoreManagerImpl.java
@@ -40,12 +40,16 @@ public class DataStoreManagerImpl implements DataStoreManager {
 
     @Override
     public DataStore getDataStore(long storeId, DataStoreRole role) {
-        if (role == DataStoreRole.Primary) {
-            return primaryStoreMgr.getPrimaryDataStore(storeId);
-        } else if (role == DataStoreRole.Image) {
-            return imageDataStoreMgr.getImageStore(storeId);
-        } else if (role == DataStoreRole.ImageCache) {
-            return imageDataStoreMgr.getImageStore(storeId);
+        try {
+            if (role == DataStoreRole.Primary) {
+                return primaryStoreMgr.getPrimaryDataStore(storeId);
+            } else if (role == DataStoreRole.Image) {
+                return imageDataStoreMgr.getImageStore(storeId);
+            } else if (role == DataStoreRole.ImageCache) {
+                return imageDataStoreMgr.getImageStore(storeId);
+            }
+        } catch (CloudRuntimeException e) {
+            throw e;
         }
         throw new CloudRuntimeException("un recognized type" + role);
     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/6bad34c5/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
index 06b54e0..db14f6d 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/datastore/manager/PrimaryDataStoreProviderManagerImpl.java
@@ -36,6 +36,7 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.springframework.stereotype.Component;
 
 import com.cloud.storage.StorageManager;
+import com.cloud.utils.exception.CloudRuntimeException;
 
 @Component
 public class PrimaryDataStoreProviderManagerImpl implements PrimaryDataStoreProviderManager
{
@@ -55,6 +56,9 @@ public class PrimaryDataStoreProviderManagerImpl implements PrimaryDataStoreProv
     @Override
     public PrimaryDataStore getPrimaryDataStore(long dataStoreId) {
         StoragePoolVO dataStoreVO = dataStoreDao.findById(dataStoreId);
+        if (dataStoreVO == null) {
+            throw new CloudRuntimeException("Unable to locate datastore with id " + dataStoreId);
+        }
         String providerName = dataStoreVO.getStorageProviderName();
         DataStoreProvider provider = providerManager.getDataStoreProvider(providerName);
         PrimaryDataStoreImpl dataStore = PrimaryDataStoreImpl.createDataStore(dataStoreVO,


Mime
View raw message