Skip to content

Commit 720315b

Browse files
committed
CLOUDSTACK-4725: if storage pool has different path, but the uuid is the same, then treat them as the same storage pool
1 parent 5cd4c41 commit 720315b

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

‎engine/schema/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ public List<StoragePoolVO> listByStatusInZone(long dcId, StoragePoolStatus statu
205205
public StoragePoolVO findPoolByHostPath(long datacenterId, Long podId, String host, String path, String uuid) {
206206
SearchCriteria<StoragePoolVO> sc = AllFieldSearch.create();
207207
sc.setParameters("hostAddress", host);
208-
sc.setParameters("path", path);
208+
if (path != null) {
209+
sc.setParameters("path", path);
210+
}
209211
sc.setParameters("datacenterId", datacenterId);
210212
sc.setParameters("podId", podId);
211213
sc.setParameters("uuid", uuid);

‎server/src/com/cloud/storage/StorageManagerImpl.java‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -543,6 +543,15 @@ public DataStore createLocalStorage(Host host, StoragePoolInfo pInfo) throws Con
543543
pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), "", pInfo.getUuid());
544544
}
545545
}
546+
if (pool == null) {
547+
//the path can be different, but if they have the same uuid, assume they are the same storage
548+
pool = _storagePoolDao.findPoolByHostPath(host.getDataCenterId(), host.getPodId(), pInfo.getHost(), null,
549+
pInfo.getUuid());
550+
if (pool != null) {
551+
s_logger.debug("Found a storage pool: " + pInfo.getUuid() + ", but with different hostpath " + pInfo.getHostPath() + ", still treat it as the same pool");
552+
}
553+
}
554+
546555
DataStoreProvider provider = dataStoreProviderMgr.getDefaultPrimaryDataStoreProvider();
547556
DataStoreLifeCycle lifeCycle = provider.getDataStoreLifeCycle();
548557
if (pool == null) {

0 commit comments

Comments
 (0)