Skip to content

Commit ea6f7f1

Browse files
Fix to remove the duplicate zone wide pools listed while finding storage pools for migration
1 parent 1c16a1f commit ea6f7f1

1 file changed

Lines changed: 9 additions & 15 deletions

File tree

server/src/main/java/com/cloud/server/ManagementServerImpl.java

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1508,7 +1508,7 @@ public Pair<List<? extends StoragePool>, List<? extends StoragePool>> listStorag
15081508
}
15091509

15101510
StoragePool srcVolumePool = _poolDao.findById(volume.getPoolId());
1511-
allPools = getAllStoragePoolCompatileWithVolumeSourceStoragePool(srcVolumePool);
1511+
allPools = getAllStoragePoolsCompatibleWithVolumeSourceStoragePool(srcVolumePool);
15121512
if (vm != null) {
15131513
suitablePools = findAllSuitableStoragePoolsForVm(volume, vm, srcVolumePool);
15141514
} else {
@@ -1546,23 +1546,17 @@ private void abstractDataStoreClustersList(List<StoragePool> storagePools, List<
15461546
* <li>We also all storage available filtering by data center, pod and cluster as the current storage pool used by the given volume.</li>
15471547
* </ul>
15481548
*/
1549-
private List<? extends StoragePool> getAllStoragePoolCompatileWithVolumeSourceStoragePool(StoragePool srcVolumePool) {
1549+
private List<? extends StoragePool> getAllStoragePoolsCompatibleWithVolumeSourceStoragePool(StoragePool srcVolumePool) {
15501550
List<StoragePoolVO> storagePools = new ArrayList<>();
1551-
List<StoragePoolVO> clusterAndLocalStoragePools = _poolDao.listBy(srcVolumePool.getDataCenterId(), srcVolumePool.getPodId(), srcVolumePool.getClusterId(), null);
1552-
if (CollectionUtils.isNotEmpty(clusterAndLocalStoragePools)) {
1553-
clusterAndLocalStoragePools.remove(srcVolumePool);
1554-
storagePools.addAll(clusterAndLocalStoragePools);
1555-
}
1556-
if (srcVolumePool.getClusterId() == null) {
1557-
// Return the pools as the above storage pools list would also contain zone wide pools when srcVolumePool is a zone wide pool
1558-
return storagePools;
1551+
// Storage pool with Zone Scope holds valid DataCenter Id only, Pod Id and Cluster Id are null
1552+
// Storage pool with Cluster/Host Scope holds valid DataCenter Id, Pod Id and Cluster Id
1553+
// Below methods call returns all the compatible pools with scope : ZONE, CLUSTER, HOST (as they are listed with Scope: null here)
1554+
List<StoragePoolVO> compatibleStoragePools = _poolDao.listBy(srcVolumePool.getDataCenterId(), srcVolumePool.getPodId(), srcVolumePool.getClusterId(), null);
1555+
if (CollectionUtils.isNotEmpty(compatibleStoragePools)) {
1556+
compatibleStoragePools.remove(srcVolumePool);
1557+
storagePools.addAll(compatibleStoragePools);
15591558
}
15601559

1561-
List<StoragePoolVO> zoneWideStoragePools = _poolDao.findZoneWideStoragePoolsByTags(srcVolumePool.getDataCenterId(), null);
1562-
if (CollectionUtils.isNotEmpty(zoneWideStoragePools)) {
1563-
zoneWideStoragePools.remove(srcVolumePool);
1564-
storagePools.addAll(zoneWideStoragePools);
1565-
}
15661560
return storagePools;
15671561
}
15681562

0 commit comments

Comments
 (0)