@@ -145,10 +145,10 @@ protected List<StoragePool> reorderPoolsByCapacity(DeploymentPlan plan, List<Sto
145145 storageType = "shared" ;
146146 }
147147
148- logger .debug ( String . format (
149- "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." ,
148+ logger .info (
149+ "Filtering storage pools by capacity type [{} ] as the first storage pool of the list, with name [{} ] and ID [{} ], is a [{} ] storage." ,
150150 capacityType , storagePool .getName (), storagePool .getUuid (), storageType
151- )) ;
151+ );
152152
153153 Pair <List <Long >, Map <Long , Double >> result = capacityDao .orderHostsByFreeCapacity (zoneId , clusterId , capacityType );
154154 List <Long > poolIdsByCapacity = result .first ();
@@ -185,7 +185,7 @@ protected List<StoragePool> reorderPoolsByNumberOfVolumes(DeploymentPlan plan, L
185185 Long clusterId = plan .getClusterId ();
186186
187187 List <Long > poolIdsByVolCount = volumeDao .listPoolIdsByVolumeCount (dcId , podId , clusterId , account .getAccountId ());
188- logger .debug (String . format ( "List of pools in ascending order of number of volumes for account [%s ] is [%s ]." , account , poolIdsByVolCount ) );
188+ logger .debug ("List of pools in ascending order of number of volumes for account [{} ] is [{} ]." , account , poolIdsByVolCount );
189189
190190 // now filter the given list of Pools by this ordered list
191191 Map <Long , StoragePool > poolMap = new HashMap <>();
@@ -206,16 +206,11 @@ protected List<StoragePool> reorderPoolsByNumberOfVolumes(DeploymentPlan plan, L
206206
207207 @ Override
208208 public List <StoragePool > reorderPools (List <StoragePool > pools , VirtualMachineProfile vmProfile , DeploymentPlan plan , DiskProfile dskCh ) {
209- if (logger .isTraceEnabled ()) {
210- logger .trace ("reordering pools" );
211- }
212209 if (pools == null ) {
213- logger .trace ("There are no pools to reorder; returning null ." );
210+ logger .info ("There are no pools to reorder." );
214211 return null ;
215212 }
216- if (logger .isTraceEnabled ()) {
217- logger .trace (String .format ("reordering %d pools" , pools .size ()));
218- }
213+ logger .info ("Reordering [{}] pools" , pools .size ());
219214 Account account = null ;
220215 if (vmProfile .getVirtualMachine () != null ) {
221216 account = vmProfile .getOwner ();
@@ -224,9 +219,7 @@ public List<StoragePool> reorderPools(List<StoragePool> pools, VirtualMachinePro
224219 pools = reorderStoragePoolsBasedOnAlgorithm (pools , plan , account );
225220
226221 if (vmProfile .getVirtualMachine () == null ) {
227- if (logger .isTraceEnabled ()) {
228- logger .trace ("The VM is null, skipping pools reordering by disk provisioning type." );
229- }
222+ logger .info ("The VM is null, skipping pool reordering by disk provisioning type." );
230223 return pools ;
231224 }
232225
@@ -240,14 +233,10 @@ public List<StoragePool> reorderPools(List<StoragePool> pools, VirtualMachinePro
240233
241234 List <StoragePool > reorderStoragePoolsBasedOnAlgorithm (List <StoragePool > pools , DeploymentPlan plan , Account account ) {
242235 String volumeAllocationAlgorithm = VolumeOrchestrationService .VolumeAllocationAlgorithm .value ();
243- logger .debug ("Using volume allocation algorithm {} to reorder pools." , volumeAllocationAlgorithm );
236+ logger .info ("Using volume allocation algorithm {} to reorder pools." , volumeAllocationAlgorithm );
244237 if (volumeAllocationAlgorithm .equals ("random" ) || volumeAllocationAlgorithm .equals ("userconcentratedpod_random" ) || (account == null )) {
245238 reorderRandomPools (pools );
246239 } else if (StringUtils .equalsAny (volumeAllocationAlgorithm , "userdispersing" , "firstfitleastconsumed" )) {
247- if (logger .isTraceEnabled ()) {
248- logger .trace ("Using reordering algorithm {}" , volumeAllocationAlgorithm );
249- }
250-
251240 if (volumeAllocationAlgorithm .equals ("userdispersing" )) {
252241 pools = reorderPoolsByNumberOfVolumes (plan , pools , account );
253242 } else {
@@ -259,16 +248,15 @@ List<StoragePool> reorderStoragePoolsBasedOnAlgorithm(List<StoragePool> pools, D
259248
260249 void reorderRandomPools (List <StoragePool > pools ) {
261250 StorageUtil .traceLogStoragePools (pools , logger , "pools to choose from: " );
262- if (logger .isTraceEnabled ()) {
263- logger .trace ("Shuffle this so that we don't check the pools in the same order. Algorithm == 'random' (or no account?)" );
264- }
265- StorageUtil .traceLogStoragePools (pools , logger , "pools to shuffle: " );
251+ logger .trace ("Shuffle this so that we don't check the pools in the same order. Algorithm == 'random' (or no account?)" );
252+ logger .debug ("Pools to shuffle: [{}]" , pools );
266253 Collections .shuffle (pools , secureRandom );
267- StorageUtil . traceLogStoragePools ( pools , logger , "shuffled list of pools to choose from: " );
254+ logger . debug ( "Shuffled list of pools to choose from: [{}]" , pools );
268255 }
269256
270257 private List <StoragePool > reorderPoolsByDiskProvisioningType (List <StoragePool > pools , DiskProfile diskProfile ) {
271258 if (diskProfile != null && diskProfile .getProvisioningType () != null && !diskProfile .getProvisioningType ().equals (Storage .ProvisioningType .THIN )) {
259+ logger .info ("Reordering [{}] pools by disk provisioning type [{}]." , pools .size (), diskProfile .getProvisioningType ());
272260 List <StoragePool > reorderedPools = new ArrayList <>();
273261 int preferredIndex = 0 ;
274262 for (StoragePool pool : pools ) {
@@ -282,22 +270,28 @@ private List<StoragePool> reorderPoolsByDiskProvisioningType(List<StoragePool> p
282270 reorderedPools .add (preferredIndex ++, pool );
283271 }
284272 }
273+ logger .debug ("Reordered list of pools by disk provisioning type [{}]: [{}]" , diskProfile .getProvisioningType (), reorderedPools );
285274 return reorderedPools ;
286275 } else {
276+ if (diskProfile == null ) {
277+ logger .info ("Reordering pools by disk provisioning type wasn't necessary, since no disk profile was found." );
278+ } else {
279+ logger .debug ("Reordering pools by disk provisioning type wasn't necessary, since the provisioning type is [{}]." , diskProfile .getProvisioningType ());
280+ }
287281 return pools ;
288282 }
289283 }
290284
291285 protected boolean filter (ExcludeList avoid , StoragePool pool , DiskProfile dskCh , DeploymentPlan plan ) {
292- logger .debug (String . format ( "Checking if storage pool [%s ] is suitable to disk [%s ]." , pool , dskCh ) );
286+ logger .debug ("Checking if storage pool [{} ] is suitable to disk [{} ]." , pool , dskCh );
293287 if (avoid .shouldAvoid (pool )) {
294- logger .debug (String . format ( "StoragePool [%s ] is in avoid set, skipping this pool to allocation of disk [%s ]." , pool , dskCh ) );
288+ logger .debug ("StoragePool [{} ] is in avoid set, skipping this pool to allocation of disk [{} ]." , pool , dskCh );
295289 return false ;
296290 }
297291
298292 if (dskCh .requiresEncryption () && !pool .getPoolType ().supportsEncryption ()) {
299293 if (logger .isDebugEnabled ()) {
300- logger .debug (String . format ( "Storage pool type '%s ' doesn't support encryption required for volume, skipping this pool" , pool .getPoolType () ));
294+ logger .debug ("Storage pool type '[{}] ' doesn't support encryption required for volume, skipping this pool" , pool .getPoolType ());
301295 }
302296 return false ;
303297 }
@@ -319,8 +313,8 @@ protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh,
319313 }
320314
321315 if (!checkDiskProvisioningSupport (dskCh , pool )) {
322- logger .debug (String . format ( "Storage pool [%s ] does not have support to disk provisioning of disk [%s ]." , pool , ReflectionToStringBuilderUtils .reflectOnlySelectedFields (dskCh ,
323- "type" , "name" , "diskOfferingId" , "templateId" , "volumeId" , "provisioningType" , "hyperType" ))) ;
316+ logger .debug ("Storage pool [{} ] does not have support to disk provisioning of disk [{} ]." , pool , ReflectionToStringBuilderUtils .reflectOnlySelectedFields (dskCh ,
317+ "type" , "name" , "diskOfferingId" , "templateId" , "volumeId" , "provisioningType" , "hyperType" ));
324318 return false ;
325319 }
326320
@@ -332,7 +326,7 @@ protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh,
332326 HostVO plannedHost = hostDao .findById (plan .getHostId ());
333327 if (!storageMgr .checkIfHostAndStoragePoolHasCommonStorageAccessGroups (plannedHost , pool )) {
334328 if (logger .isDebugEnabled ()) {
335- logger .debug (String . format ( "StoragePool %s and host %s does not have matching storage access groups" , pool , plannedHost ) );
329+ logger .debug ("StoragePool [{}] and host [{}] does not have matching storage access groups" , pool , plannedHost );
336330 }
337331 return false ;
338332 }
@@ -343,13 +337,13 @@ protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh,
343337 if (!isTempVolume ) {
344338 volume = volumeDao .findById (dskCh .getVolumeId ());
345339 if (!storageMgr .storagePoolCompatibleWithVolumePool (pool , volume )) {
346- logger .debug (String . format ( "Pool [%s ] is not compatible with volume [%s ], skipping it." , pool , volume ) );
340+ logger .debug ("Pool [{} ] is not compatible with volume [{} ], skipping it." , pool , volume );
347341 return false ;
348342 }
349343 }
350344
351345 if (pool .isManaged () && !storageUtil .managedStoragePoolCanScale (pool , plan .getClusterId (), plan .getHostId ())) {
352- logger .debug (String . format ( "Cannot allocate pool [%s ] to volume [%s ] because the max number of managed clustered filesystems has been exceeded." , pool , volume ) );
346+ logger .debug ("Cannot allocate pool [{} ] to volume [{} ] because the max number of managed clustered filesystems has been exceeded." , pool , volume );
353347 return false ;
354348 }
355349
@@ -358,13 +352,13 @@ protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh,
358352 requestVolumeDiskProfilePairs .add (new Pair <>(volume , dskCh ));
359353 if (dskCh .getHypervisorType () == HypervisorType .VMware ) {
360354 if (pool .getPoolType () == Storage .StoragePoolType .DatastoreCluster && storageMgr .isStoragePoolDatastoreClusterParent (pool )) {
361- logger .debug (String . format ( "Skipping allocation of pool [%s ] to volume [%s ] because this pool is a parent datastore cluster." , pool , volume ) );
355+ logger .debug ("Skipping allocation of pool [{} ] to volume [{} ] because this pool is a parent datastore cluster." , pool , volume );
362356 return false ;
363357 }
364358 if (pool .getParent () != 0L ) {
365359 StoragePoolVO datastoreCluster = storagePoolDao .findById (pool .getParent ());
366360 if (datastoreCluster == null || (datastoreCluster != null && datastoreCluster .getStatus () != StoragePoolStatus .Up )) {
367- logger .debug (String . format ( "Skipping allocation of pool [%s ] to volume [%s ] because this pool is not in [%s ] state." , datastoreCluster , volume , StoragePoolStatus .Up ) );
361+ logger .debug ("Skipping allocation of pool [{} ] to volume [{} ] because this pool is not in [{} ] state." , datastoreCluster , volume , StoragePoolStatus .Up );
368362 return false ;
369363 }
370364 }
@@ -374,11 +368,11 @@ protected boolean filter(ExcludeList avoid, StoragePool pool, DiskProfile dskCh,
374368 storageMgr .isStoragePoolCompliantWithStoragePolicy (dskCh .getDiskOfferingId (), pool ) :
375369 storageMgr .isStoragePoolCompliantWithStoragePolicy (requestVolumeDiskProfilePairs , pool );
376370 if (!isStoragePoolStoragePolicyCompliance ) {
377- logger .debug (String . format ( "Skipping allocation of pool [%s ] to volume [%s ] because this pool is not compliant with the storage policy required by the volume." , pool , volume ) );
371+ logger .debug ("Skipping allocation of pool [{} ] to volume [{} ] because this pool is not compliant with the storage policy required by the volume." , pool , volume );
378372 return false ;
379373 }
380374 } catch (StorageUnavailableException e ) {
381- logger .warn (String . format ( "Could not verify storage policy compliance against storage pool %s due to exception %s " , pool .getUuid (), e .getMessage () ));
375+ logger .warn ("Could not verify storage policy compliance against storage pool [{}] due to exception [{}] " , pool .getUuid (), e .getMessage ());
382376 return false ;
383377 }
384378 }
@@ -427,19 +421,19 @@ private boolean checkHypervisorCompatibility(HypervisorType hyperType, Volume.Ty
427421 protected void logDisabledStoragePools (long dcId , Long podId , Long clusterId , ScopeType scope ) {
428422 List <StoragePoolVO > disabledPools = storagePoolDao .findDisabledPoolsByScope (dcId , podId , clusterId , scope );
429423 if (disabledPools != null && !disabledPools .isEmpty ()) {
430- logger .trace (String . format ( "Ignoring pools [%s ] as they are in disabled state." , ReflectionToStringBuilderUtils .reflectOnlySelectedFields (disabledPools ) ));
424+ logger .trace ("Ignoring pools [{} ] as they are in disabled state." , ReflectionToStringBuilderUtils .reflectOnlySelectedFields (disabledPools ));
431425 }
432426 }
433427
434428 protected void logStartOfSearch (DiskProfile dskCh , VirtualMachineProfile vmProfile , DeploymentPlan plan , int returnUpTo ,
435429 boolean bypassStorageTypeCheck ){
436- logger .trace (String . format ( "%s is looking for storage pools that match the VM's disk profile [%s ], virtual machine profile [%s ] and "
437- + "deployment plan [%s ]. Returning up to [%d ] and bypassStorageTypeCheck [%s ]." , this .getClass ().getSimpleName (), dskCh , vmProfile , plan , returnUpTo , bypassStorageTypeCheck ) );
430+ logger .trace ("[{}] is looking for storage pools that match the VM's disk profile [{} ], virtual machine profile [{} ] and "
431+ + "deployment plan [{} ]. Returning up to [{} ] and bypassStorageTypeCheck [{} ]." , this .getClass ().getSimpleName (), dskCh , vmProfile , plan , returnUpTo , bypassStorageTypeCheck );
438432 }
439433
440434 protected void logEndOfSearch (List <StoragePool > storagePoolList ) {
441- logger .debug (String . format ( "%s is returning [%s ] suitable storage pools [%s ]." , this .getClass ().getSimpleName (), storagePoolList .size (),
442- Arrays .toString (storagePoolList .toArray ()))) ;
435+ logger .debug ("[{}] is returning [{} ] suitable storage pools [{} ]." , this .getClass ().getSimpleName (), storagePoolList .size (),
436+ Arrays .toString (storagePoolList .toArray ()));
443437 }
444438
445439}
0 commit comments