Skip to content

Commit 88c0804

Browse files
committed
minor changes
1 parent 10cd150 commit 88c0804

File tree

5 files changed

+16
-4
lines changed

5 files changed

+16
-4
lines changed

engine/components-api/src/main/java/com/cloud/configuration/ConfigurationManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public interface ConfigurationManager {
6565
"allow.non.rfc1918.compliant.ips", "Advanced", "false",
6666
"Allows non-compliant RFC 1918 IPs for Shared, Isolated networks and VPCs", true, null);
6767

68-
ConfigKey<Float> HostCapacityTypeCpuMemoryWeight = new ConfigKey<Float>(ConfigKey.CATEGORY_ADVANCED, Float.class, "host.capacityType.to.order.clusters.cputomemoryweight",
68+
ConfigKey<Float> HostCapacityTypeCpuMemoryWeight = new ConfigKey<>(ConfigKey.CATEGORY_ADVANCED, Float.class, "host.capacityType.to.order.clusters.cputomemoryweight",
6969
"0.5",
7070
"CPU to Memory weight used for COMBINED capacityTye to order cluster and host",
7171
true, ConfigKey.Scope.Global);

engine/schema/src/main/java/com/cloud/capacity/dao/CapacityDaoImpl.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1073,9 +1073,11 @@ public List<CapacityVO> listHostCapacityByCapacityTypes(Long zoneId, Long cluste
10731073
sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
10741074
sb.and("clusterId", sb.entity().getClusterId(), SearchCriteria.Op.EQ);
10751075
sb.and("capacityTypes", sb.entity().getCapacityType(), SearchCriteria.Op.IN);
1076+
sb.and("capacityState", sb.entity().getCapacityState(), Op.EQ);
10761077
sb.done();
10771078

10781079
SearchCriteria<CapacityVO> sc = sb.create();
1080+
sc.setParameters("capacityState", "Enabled");
10791081
if (zoneId != null) {
10801082
sc.setParameters("zoneId", zoneId);
10811083
}
@@ -1091,8 +1093,10 @@ public List<CapacityVO> listPodCapacityByCapacityTypes(Long zoneId, List<Short>
10911093
SearchBuilder<CapacityVO> sb = createSearchBuilder();
10921094
sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
10931095
sb.and("capacityTypes", sb.entity().getCapacityType(), SearchCriteria.Op.IN);
1096+
sb.and("capacityState", sb.entity().getCapacityState(), Op.EQ);
10941097
sb.done();
10951098
SearchCriteria<CapacityVO> sc = sb.create();
1099+
sc.setParameters("capacityState", "Enabled");
10961100
if (zoneId != null) {
10971101
sc.setParameters("zoneId", zoneId);
10981102
}
@@ -1106,9 +1110,11 @@ public List<CapacityVO> listClusterCapacityByCapacityTypes(Long zoneId, Long pod
11061110
sb.and("zoneId", sb.entity().getDataCenterId(), SearchCriteria.Op.EQ);
11071111
sb.and("podId", sb.entity().getPodId(), SearchCriteria.Op.EQ);
11081112
sb.and("capacityTypes", sb.entity().getCapacityType(), SearchCriteria.Op.IN);
1113+
sb.and("capacityState", sb.entity().getCapacityState(), Op.EQ);
11091114
sb.done();
11101115

11111116
SearchCriteria<CapacityVO> sc = sb.create();
1117+
sc.setParameters("capacityState", "Enabled");
11121118
if (zoneId != null) {
11131119
sc.setParameters("zoneId", zoneId);
11141120
}

engine/schema/src/main/resources/META-INF/db/schema-42010to42100.sql

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,9 @@ CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host', 'storage_access_groups', 'var
8080
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.cluster', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the cluster"');
8181
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.host_pod_ref', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the pod"');
8282
CALL `cloud`.`IDEMPOTENT_ADD_COLUMN`('cloud.data_center', 'storage_access_groups', 'varchar(255) DEFAULT NULL COMMENT "storage access groups for the hosts in the zone"');
83+
84+
-- Update description for configuration: host.capacityType.to.order.clusters
85+
UPDATE `cloud`.`configuration` SET
86+
`description` = 'The host capacity type (CPU, RAM or COMBINED) is used by deployment planner to order clusters during VM resource allocation'
87+
WHERE `name` = 'host.capacityType.to.order.clusters'
88+
AND `description` = 'The host capacity type (CPU or RAM) is used by deployment planner to order clusters during VM resource allocation';

server/src/main/java/com/cloud/agent/manager/allocator/impl/FirstFitAllocator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ protected List<Host> allocateTo(DeploymentPlan plan, ServiceOffering offering, V
299299
Collections.shuffle(hosts);
300300
} else if (vmAllocationAlgorithm.equals("userdispersing")) {
301301
hosts = reorderHostsByNumberOfVms(plan, hosts, account);
302-
}else if(vmAllocationAlgorithm.equals("firstfitleastconsumed")){
302+
} else if(vmAllocationAlgorithm.equals("firstfitleastconsumed")){
303303
hosts = reorderHostsByCapacity(plan, hosts);
304304
}
305305

server/src/main/java/com/cloud/deploy/FirstFitPlanner.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -558,8 +558,8 @@ private Pair<List<Long>, Map<Long, Double>> getOrderedClustersByCapacity(long id
558558
List<CapacityVO> capacities = capacityDao.listClusterCapacityByCapacityTypes(zoneId, podId, vmId,
559559
List.of(Capacity.CAPACITY_TYPE_CPU, Capacity.CAPACITY_TYPE_MEMORY));
560560

561-
Map<Long, Double> podsByCombinedCapacities = getClusterByCombinedCapacities(capacities, cpuToMemoryWeight);
562-
return new Pair<>(new ArrayList<>(podsByCombinedCapacities.keySet()), podsByCombinedCapacities);
561+
Map<Long, Double> clusterByCombinedCapacities = getClusterByCombinedCapacities(capacities, cpuToMemoryWeight);
562+
return new Pair<>(new ArrayList<>(clusterByCombinedCapacities.keySet()), clusterByCombinedCapacities);
563563
}
564564

565565
private Map<Long, Double> getClusterByCombinedCapacities(List<CapacityVO> capacities, double cpuToMemoryWeight) {

0 commit comments

Comments
 (0)