ravening commented on a change in pull request #5249:
URL: https://github.com/apache/cloudstack/pull/5249#discussion_r685172349
##########
File path:
engine/orchestration/src/main/java/org/apache/cloudstack/engine/orchestration/VolumeOrchestrator.java
##########
@@ -321,9 +347,13 @@ public StoragePool findStoragePool(DiskProfile dskCh,
DataCenter dc, Pod pod, Lo
}
DataCenterDeployment plan = new DataCenterDeployment(dc.getId(),
podId, clusterId, hostId, null, null);
- final List<StoragePool> poolList = allocator.allocateToPool(dskCh,
profile, plan, avoidList, 1);
+ final List<StoragePool> poolList = allocator.allocateToPool(dskCh,
profile, plan, avoidList, StoragePoolAllocator.RETURN_UPTO_ALL);
if (poolList != null && !poolList.isEmpty()) {
- return
(StoragePool)dataStoreMgr.getDataStore(poolList.get(0).getId(),
DataStoreRole.Primary);
+ // Check if the preferred storage pool can be used. If yes,
use it.
+ Optional<StoragePool> storagePool =
getPreferredStoragePool(poolList, vm);
+
+ return (storagePool.isPresent()) ? (StoragePool)
this.dataStoreMgr.getDataStore(storagePool.get().getId(),
DataStoreRole.Primary) :
+
(StoragePool)dataStoreMgr.getDataStore(poolList.get(0).getId(),
DataStoreRole.Primary);
Review comment:
@DaanHoogland
This code is inside the for loop. So as soon as we found the first suitable
pool, we need to return it. If I have just one exit point after the for loop
then the first selected might be overwritten by the pool which can be selected
later in the for loop.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]