You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/07/17 10:11:20 UTC

[36/39] git commit: updated refs/heads/vpc-toolkit-hugo to 34bed5f

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/771b53b3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/771b53b3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/771b53b3

Branch: refs/heads/vpc-toolkit-hugo
Commit: 771b53b3421fcde27e882a022e4f1b43146ca0e4
Parents: 2f2efb0
Author: Edison Su <su...@gmail.com>
Authored: Wed Jul 16 16:30:15 2014 -0700
Committer: Edison Su <su...@gmail.com>
Committed: Wed Jul 16 16:38:17 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/771b53b3/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 cb8ec31..0c372a5 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
@@ -184,7 +184,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/771b53b3/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 06f2718..2246387 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -554,6 +554,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) {