mirror of https://github.com/apache/cloudstack.git
Cleanup userconcentratedpod_random and userconcentratedpod_firstfit allocation algorithms (#12233)
* Cleanup userconcentratedpod_random and userconcentratedpod_firstfit allocation algorithm * use firstfit instead of random for userconcentratedpod_firstfit
This commit is contained in:
parent
22da57f922
commit
e0c13cc3ec
|
|
@ -62,11 +62,11 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
|
||||||
"vm.allocation.algorithm",
|
"vm.allocation.algorithm",
|
||||||
"Advanced",
|
"Advanced",
|
||||||
"random",
|
"random",
|
||||||
"Order in which hosts within a cluster will be considered for VM allocation. The value can be 'random', 'firstfit', 'userdispersing', 'userconcentratedpod_random', 'userconcentratedpod_firstfit', or 'firstfitleastconsumed'.",
|
"Order in which hosts within a cluster will be considered for VM allocation. The value can be 'random', 'firstfit', 'userdispersing', or 'firstfitleastconsumed'.",
|
||||||
true,
|
true,
|
||||||
ConfigKey.Scope.Global, null, null, null, null, null,
|
ConfigKey.Scope.Global, null, null, null, null, null,
|
||||||
ConfigKey.Kind.Select,
|
ConfigKey.Kind.Select,
|
||||||
"random,firstfit,userdispersing,userconcentratedpod_random,userconcentratedpod_firstfit,firstfitleastconsumed");
|
"random,firstfit,userdispersing,firstfitleastconsumed");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is called to determine list of possible clusters where a virtual
|
* This is called to determine list of possible clusters where a virtual
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@ public interface DeploymentPlanner extends Adapter {
|
||||||
boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
|
boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
|
||||||
|
|
||||||
public enum AllocationAlgorithm {
|
public enum AllocationAlgorithm {
|
||||||
random, firstfit, userdispersing, userconcentratedpod_random, userconcentratedpod_firstfit;
|
random, firstfit, userdispersing;
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum PlannerResourceUsage {
|
public enum PlannerResourceUsage {
|
||||||
|
|
|
||||||
|
|
@ -90,11 +90,11 @@ public interface VolumeOrchestrationService {
|
||||||
"volume.allocation.algorithm",
|
"volume.allocation.algorithm",
|
||||||
"Advanced",
|
"Advanced",
|
||||||
"random",
|
"random",
|
||||||
"Order in which storage pool within a cluster will be considered for volume allocation. The value can be 'random', 'firstfit', 'userdispersing', 'userconcentratedpod_random', 'userconcentratedpod_firstfit', or 'firstfitleastconsumed'.",
|
"Order in which storage pool within a cluster will be considered for volume allocation. The value can be 'random', 'firstfit', 'userdispersing', or 'firstfitleastconsumed'.",
|
||||||
true,
|
true,
|
||||||
ConfigKey.Scope.Global, null, null, null, null, null,
|
ConfigKey.Scope.Global, null, null, null, null, null,
|
||||||
ConfigKey.Kind.Select,
|
ConfigKey.Kind.Select,
|
||||||
"random,firstfit,userdispersing,userconcentratedpod_random,userconcentratedpod_firstfit,firstfitleastconsumed");
|
"random,firstfit,userdispersing,firstfitleastconsumed");
|
||||||
|
|
||||||
VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType)
|
VolumeInfo moveVolume(VolumeInfo volume, long destPoolDcId, Long destPoolPodId, Long destPoolClusterId, HypervisorType dataDiskHyperType)
|
||||||
throws ConcurrentOperationException, StorageUnavailableException;
|
throws ConcurrentOperationException, StorageUnavailableException;
|
||||||
|
|
|
||||||
|
|
@ -1195,9 +1195,9 @@ public class Upgrade410to420 extends DbUpgradeAbstractImpl {
|
||||||
plannerName = "FirstFitPlanner";
|
plannerName = "FirstFitPlanner";
|
||||||
} else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.firstfit.toString())) {
|
} else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.firstfit.toString())) {
|
||||||
plannerName = "FirstFitPlanner";
|
plannerName = "FirstFitPlanner";
|
||||||
} else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.userconcentratedpod_firstfit.toString())) {
|
} else if (globalValue.equals("userconcentratedpod_firstfit")) {
|
||||||
plannerName = "UserConcentratedPodPlanner";
|
plannerName = "UserConcentratedPodPlanner";
|
||||||
} else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.userconcentratedpod_random.toString())) {
|
} else if (globalValue.equals("userconcentratedpod_random")) {
|
||||||
plannerName = "UserConcentratedPodPlanner";
|
plannerName = "UserConcentratedPodPlanner";
|
||||||
} else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.userdispersing.toString())) {
|
} else if (globalValue.equals(DeploymentPlanner.AllocationAlgorithm.userdispersing.toString())) {
|
||||||
plannerName = "UserDispersingPlanner";
|
plannerName = "UserDispersingPlanner";
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,10 @@
|
||||||
// under the License.
|
// under the License.
|
||||||
package com.cloud.upgrade.dao;
|
package com.cloud.upgrade.dao;
|
||||||
|
|
||||||
|
import java.io.InputStream;
|
||||||
|
|
||||||
|
import com.cloud.utils.exception.CloudRuntimeException;
|
||||||
|
|
||||||
public class Upgrade42210to42300 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate {
|
public class Upgrade42210to42300 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -27,4 +31,15 @@ public class Upgrade42210to42300 extends DbUpgradeAbstractImpl implements DbUpgr
|
||||||
public String getUpgradedVersion() {
|
public String getUpgradedVersion() {
|
||||||
return "4.23.0.0";
|
return "4.23.0.0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InputStream[] getPrepareScripts() {
|
||||||
|
final String scriptFile = "META-INF/db/schema-42210to42300.sql";
|
||||||
|
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
|
||||||
|
if (script == null) {
|
||||||
|
throw new CloudRuntimeException("Unable to find " + scriptFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new InputStream[] {script};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,3 +18,8 @@
|
||||||
--;
|
--;
|
||||||
-- Schema upgrade from 4.22.1.0 to 4.23.0.0
|
-- Schema upgrade from 4.22.1.0 to 4.23.0.0
|
||||||
--;
|
--;
|
||||||
|
|
||||||
|
-- Update value to random for the config 'vm.allocation.algorithm' or 'volume.allocation.algorithm' if configured as userconcentratedpod_random
|
||||||
|
-- Update value to firstfit for the config 'vm.allocation.algorithm' or 'volume.allocation.algorithm' if configured as userconcentratedpod_firstfit
|
||||||
|
UPDATE `cloud`.`configuration` SET value='random' WHERE name IN ('vm.allocation.algorithm', 'volume.allocation.algorithm') AND value='userconcentratedpod_random';
|
||||||
|
UPDATE `cloud`.`configuration` SET value='firstfit' WHERE name IN ('vm.allocation.algorithm', 'volume.allocation.algorithm') AND value='userconcentratedpod_firstfit';
|
||||||
|
|
|
||||||
|
|
@ -241,7 +241,7 @@ public abstract class AbstractStoragePoolAllocator extends AdapterBase implement
|
||||||
List<StoragePool> reorderStoragePoolsBasedOnAlgorithm(List<StoragePool> pools, DeploymentPlan plan, Account account) {
|
List<StoragePool> reorderStoragePoolsBasedOnAlgorithm(List<StoragePool> pools, DeploymentPlan plan, Account account) {
|
||||||
String volumeAllocationAlgorithm = VolumeOrchestrationService.VolumeAllocationAlgorithm.value();
|
String volumeAllocationAlgorithm = VolumeOrchestrationService.VolumeAllocationAlgorithm.value();
|
||||||
logger.debug("Using volume allocation algorithm {} to reorder pools.", volumeAllocationAlgorithm);
|
logger.debug("Using volume allocation algorithm {} to reorder pools.", volumeAllocationAlgorithm);
|
||||||
if (volumeAllocationAlgorithm.equals("random") || volumeAllocationAlgorithm.equals("userconcentratedpod_random") || (account == null)) {
|
if (volumeAllocationAlgorithm.equals("random") || (account == null)) {
|
||||||
reorderRandomPools(pools);
|
reorderRandomPools(pools);
|
||||||
} else if (StringUtils.equalsAny(volumeAllocationAlgorithm, "userdispersing", "firstfitleastconsumed")) {
|
} else if (StringUtils.equalsAny(volumeAllocationAlgorithm, "userdispersing", "firstfitleastconsumed")) {
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ public class FirstFitAllocator extends AdapterBase implements HostAllocator {
|
||||||
protected List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, ServiceOffering offering, VMTemplateVO template, ExcludeList avoid, List<? extends Host> hosts, int returnUpTo,
|
protected List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, ServiceOffering offering, VMTemplateVO template, ExcludeList avoid, List<? extends Host> hosts, int returnUpTo,
|
||||||
boolean considerReservedCapacity, Account account) {
|
boolean considerReservedCapacity, Account account) {
|
||||||
String vmAllocationAlgorithm = DeploymentClusterPlanner.VmAllocationAlgorithm.value();
|
String vmAllocationAlgorithm = DeploymentClusterPlanner.VmAllocationAlgorithm.value();
|
||||||
if (vmAllocationAlgorithm.equals("random") || vmAllocationAlgorithm.equals("userconcentratedpod_random")) {
|
if (vmAllocationAlgorithm.equals("random")) {
|
||||||
// Shuffle this so that we don't check the hosts in the same order.
|
// Shuffle this so that we don't check the hosts in the same order.
|
||||||
Collections.shuffle(hosts);
|
Collections.shuffle(hosts);
|
||||||
} else if (vmAllocationAlgorithm.equals("userdispersing")) {
|
} else if (vmAllocationAlgorithm.equals("userdispersing")) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue