Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix volume allocation on local VMFS storage #10201

Open
wants to merge 1 commit into
base: 4.19
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,24 @@
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()) {
weizhouapache marked this conversation as resolved.
Show resolved Hide resolved
short capacityType = Capacity.CAPACITY_TYPE_LOCAL_STORAGE;
String storageType = "local";
StoragePool storagePool = pools.get(0);

Check warning on line 136 in engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java

View check run for this annotation

Codecov / codecov/patch

engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java#L134-L136

Added lines #L134 - L136 were not covered by tests
if (storagePool.isShared()) {
capacityType = Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED;
} else {
capacityType = Capacity.CAPACITY_TYPE_LOCAL_STORAGE;
storageType = "shared";

Check warning on line 139 in engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java

View check run for this annotation

Codecov / codecov/patch

engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java#L139

Added line #L139 was not covered by tests
}

s_logger.debug(String.format(

Check warning on line 142 in engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java

View check run for this annotation

Codecov / codecov/patch

engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java#L142

Added line #L142 was not covered by tests
"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

Check warning on line 144 in engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java

View check run for this annotation

Codecov / codecov/patch

engine/storage/src/main/java/org/apache/cloudstack/storage/allocator/AbstractStoragePoolAllocator.java#L144

Added line #L144 was not covered by tests
));

List<Long> poolIdsByCapacity = capacityDao.orderHostsByFreeCapacity(zoneId, clusterId, capacityType);

s_logger.debug(String.format("List of pools in descending order of available capacity [%s].", poolIdsByCapacity));
Expand Down Expand Up @@ -223,6 +229,8 @@
}

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")) {
Expand Down