Repository: cloudstack
Updated Branches:
  refs/heads/4.3 5cd4c4105 -> 720315b8d


CLOUDSTACK-4725: if storage pool has different path, but the uuid is the same, 
then treat them as the same storage pool


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

Branch: refs/heads/4.3
Commit: 720315b8d1f7b9eaea67845fa96ae1da565b285b
Parents: 5cd4c41
Author: Edison Su <[email protected]>
Authored: Wed Jul 16 16:30:15 2014 -0700
Committer: Edison Su <[email protected]>
Committed: Wed Jul 16 16:30:15 2014 -0700

----------------------------------------------------------------------
 .../storage/datastore/db/PrimaryDataStoreDaoImpl.java       | 4 +++-
 server/src/com/cloud/storage/StorageManagerImpl.java        | 9 +++++++++
 2 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/720315b8/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git 
a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
 
b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index eea0762..d6631fc 100644
--- 
a/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ 
b/engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -205,7 +205,9 @@ public class PrimaryDataStoreDaoImpl extends 
GenericDaoBase<StoragePoolVO, Long>
     public StoragePoolVO findPoolByHostPath(long datacenterId, Long podId, 
String host, String path, String uuid) {
         SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
         sc.setParameters("hostAddress", host);
-        sc.setParameters("path", path);
+        if (path != null) {
+            sc.setParameters("path", path);
+        }
         sc.setParameters("datacenterId", datacenterId);
         sc.setParameters("podId", podId);
         sc.setParameters("uuid", uuid);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/720315b8/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java 
b/server/src/com/cloud/storage/StorageManagerImpl.java
index 0b8e7ff..49132e4 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -543,6 +543,15 @@ public class StorageManagerImpl extends ManagerBase 
implements StorageManager, C
                     pool = 
_storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), 
pInfo.getHost(), "", pInfo.getUuid());
                 }
             }
+            if (pool == null) {
+                //the path can be different, but if they have the same uuid, 
assume they are the same storage
+                pool = 
_storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), 
pInfo.getHost(), null,
+                        pInfo.getUuid());
+                if (pool != null) {
+                    s_logger.debug("Found a storage pool: " + pInfo.getUuid() 
+ ", but with different hostpath " + pInfo.getHostPath() + ", still treat it as 
the same pool");
+                }
+            }
+
             DataStoreProvider provider = 
dataStoreProviderMgr.getDefaultPrimaryDataStoreProvider();
             DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
             if (pool == null) {

Reply via email to