@@ -126,18 +126,24 @@ public List<StoragePool> allocateToPool(DiskProfile dskCh, VirtualMachineProfile
126126 protected List <StoragePool > reorderPoolsByCapacity (DeploymentPlan plan , List <StoragePool > pools ) {
127127 Long zoneId = plan .getDataCenterId ();
128128 Long clusterId = plan .getClusterId ();
129- short capacityType ;
130129
131130 if (CollectionUtils .isEmpty (pools )) {
132131 return null ;
133132 }
134133
135- if (pools .get (0 ).getPoolType ().isShared ()) {
134+ short capacityType = Capacity .CAPACITY_TYPE_LOCAL_STORAGE ;
135+ String storageType = "local" ;
136+ StoragePool storagePool = pools .get (0 );
137+ if (storagePool .isShared ()) {
136138 capacityType = Capacity .CAPACITY_TYPE_STORAGE_ALLOCATED ;
137- } else {
138- capacityType = Capacity .CAPACITY_TYPE_LOCAL_STORAGE ;
139+ storageType = "shared" ;
139140 }
140141
142+ s_logger .debug (String .format (
143+ "Filtering storage pools by capacity type [%s] as the first storage pool of the list, with name [%s] and ID [%s], is a [%s] storage." ,
144+ capacityType , storagePool .getName (), storagePool .getUuid (), storageType
145+ ));
146+
141147 List <Long > poolIdsByCapacity = capacityDao .orderHostsByFreeCapacity (zoneId , clusterId , capacityType );
142148
143149 s_logger .debug (String .format ("List of pools in descending order of available capacity [%s]." , poolIdsByCapacity ));
@@ -223,6 +229,8 @@ public List<StoragePool> reorderPools(List<StoragePool> pools, VirtualMachinePro
223229 }
224230
225231 List <StoragePool > reorderStoragePoolsBasedOnAlgorithm (List <StoragePool > pools , DeploymentPlan plan , Account account ) {
232+ s_logger .debug (String .format ("Using allocation algorithm [%s] to reorder pools." , allocationAlgorithm ));
233+
226234 if (allocationAlgorithm .equals ("random" ) || allocationAlgorithm .equals ("userconcentratedpod_random" ) || (account == null )) {
227235 reorderRandomPools (pools );
228236 } else if (StringUtils .equalsAny (allocationAlgorithm , "userdispersing" , "firstfitleastconsumed" )) {
0 commit comments