This is an automated email from the ASF dual-hosted git repository.

dahn pushed a commit to branch 4.19
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.19 by this push:
     new a335feab6a3 fix allocation of vmfs storage pools (#10201)
a335feab6a3 is described below

commit a335feab6a366e196b9f92c0a86fbbcefaa8eae4
Author: Bernardo De Marco Gonçalves <bernardomg2...@gmail.com>
AuthorDate: Thu Jan 30 14:44:48 2025 -0300

    fix allocation of vmfs storage pools (#10201)
---
 .../storage/allocator/AbstractStoragePoolAllocator.java  | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git 
a/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
 
b/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
index 2a65fad8e8b..9e0a28875d1 100644
--- 
a/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
+++ 
b/engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java
@@ -126,18 +126,24 @@ public abstract class AbstractStoragePoolAllocator 
extends AdapterBase implement
     protected List<StoragePool> reorderPoolsByCapacity(DeploymentPlan plan, 
List<StoragePool> pools) {
         Long zoneId = plan.getDataCenterId();
         Long clusterId = plan.getClusterId();
-        short capacityType;
 
         if (CollectionUtils.isEmpty(pools)) {
             return null;
         }
 
-        if (pools.get(0).getPoolType().isShared()) {
+        short capacityType = Capacity.CAPACITY_TYPE_LOCAL_STORAGE;
+        String storageType = "local";
+        StoragePool storagePool = pools.get(0);
+        if (storagePool.isShared()) {
             capacityType = Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED;
-        } else {
-            capacityType = Capacity.CAPACITY_TYPE_LOCAL_STORAGE;
+            storageType = "shared";
         }
 
+        s_logger.debug(String.format(
+                "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.",
+                capacityType, storagePool.getName(), storagePool.getUuid(), 
storageType
+        ));
+
         List<Long> poolIdsByCapacity = 
capacityDao.orderHostsByFreeCapacity(zoneId, clusterId, capacityType);
 
         s_logger.debug(String.format("List of pools in descending order of 
available capacity [%s].", poolIdsByCapacity));
@@ -223,6 +229,8 @@ public abstract class AbstractStoragePoolAllocator extends 
AdapterBase implement
     }
 
     List<StoragePool> reorderStoragePoolsBasedOnAlgorithm(List<StoragePool> 
pools, DeploymentPlan plan, Account account) {
+        s_logger.debug(String.format("Using allocation algorithm [%s] to 
reorder pools.", allocationAlgorithm));
+
         if (allocationAlgorithm.equals("random") || 
allocationAlgorithm.equals("userconcentratedpod_random") || (account == null)) {
             reorderRandomPools(pools);
         } else if (StringUtils.equalsAny(allocationAlgorithm, 
"userdispersing", "firstfitleastconsumed")) {

Reply via email to