Skip to content

Commit 1979f2a

Browse files
authored
Merge branch 'main' into feature-kms
2 parents 33f3d3d + 1e512ab commit 1979f2a

66 files changed

Lines changed: 3098 additions & 1267 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

api/src/main/java/com/cloud/agent/manager/allocator/HostAllocator.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -22,19 +22,11 @@
2222
import com.cloud.deploy.DeploymentPlanner.ExcludeList;
2323
import com.cloud.host.Host;
2424
import com.cloud.host.Host.Type;
25-
import com.cloud.offering.ServiceOffering;
2625
import com.cloud.utils.component.Adapter;
27-
import com.cloud.vm.VirtualMachine;
2826
import com.cloud.vm.VirtualMachineProfile;
2927

3028
public interface HostAllocator extends Adapter {
3129

32-
/**
33-
* @param UserVm vm
34-
* @param ServiceOffering offering
35-
**/
36-
boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering);
37-
3830
/**
3931
* Determines which physical hosts are suitable to
4032
* allocate the guest virtual machines on
@@ -49,31 +41,6 @@ public interface HostAllocator extends Adapter {
4941

5042
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo);
5143

52-
/**
53-
* Determines which physical hosts are suitable to allocate the guest
54-
* virtual machines on
55-
*
56-
* Allocators must set any other hosts not considered for allocation in the
57-
* ExcludeList avoid. Thus the avoid set and the list of hosts suitable,
58-
* together must cover the entire host set in the cluster.
59-
*
60-
* @param VirtualMachineProfile
61-
* vmProfile
62-
* @param DeploymentPlan
63-
* plan
64-
* @param GuestType
65-
* type
66-
* @param ExcludeList
67-
* avoid
68-
* @param int returnUpTo (use -1 to return all possible hosts)
69-
* @param boolean considerReservedCapacity (default should be true, set to
70-
* false if host capacity calculation should not look at reserved
71-
* capacity)
72-
* @return List<Host> List of hosts that are suitable for VM allocation
73-
**/
74-
75-
public List<Host> allocateTo(VirtualMachineProfile vmProfile, DeploymentPlan plan, Type type, ExcludeList avoid, int returnUpTo, boolean considerReservedCapacity);
76-
7744
/**
7845
* Determines which physical hosts are suitable to allocate the guest
7946
* virtual machines on

api/src/main/java/com/cloud/deploy/DeploymentPlanner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public interface DeploymentPlanner extends Adapter {
7070
boolean canHandle(VirtualMachineProfile vm, DeploymentPlan plan, ExcludeList avoid);
7171

7272
public enum AllocationAlgorithm {
73-
random, firstfit, userdispersing;
73+
random, firstfit, userdispersing, firstfitleastconsumed;
7474
}
7575

7676
public enum PlannerResourceUsage {

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,7 @@ public class ApiConstants {
157157
public static final String CUSTOM_ID = "customid";
158158
public static final String CUSTOM_ACTION_ID = "customactionid";
159159
public static final String CUSTOM_JOB_ID = "customjobid";
160+
public static final String CURRENCY = "currency";
160161
public static final String CURRENT_START_IP = "currentstartip";
161162
public static final String CURRENT_END_IP = "currentendip";
162163
public static final String ENCRYPT = "encrypt";
@@ -542,6 +543,7 @@ public class ApiConstants {
542543
public static final String SESSIONKEY = "sessionkey";
543544
public static final String SHOW_CAPACITIES = "showcapacities";
544545
public static final String SHOW_REMOVED = "showremoved";
546+
public static final String SHOW_RESOURCES = "showresources";
545547
public static final String SHOW_RESOURCE_ICON = "showicon";
546548
public static final String SHOW_INACTIVE = "showinactive";
547549
public static final String SHOW_UNIQUE = "showunique";
@@ -607,9 +609,11 @@ public class ApiConstants {
607609
public static final String TENANT_NAME = "tenantname";
608610
public static final String TOTAL = "total";
609611
public static final String TOTAL_SUBNETS = "totalsubnets";
612+
public static final String TOTAL_QUOTA = "totalquota";
610613
public static final String TYPE = "type";
611614
public static final String TRUST_STORE = "truststore";
612615
public static final String TRUST_STORE_PASSWORD = "truststorepass";
616+
public static final String UNIT = "unit";
613617
public static final String URL = "url";
614618
public static final String USAGE_INTERFACE = "usageinterface";
615619
public static final String USED = "used";
@@ -1308,6 +1312,8 @@ public class ApiConstants {
13081312
public static final String OBJECT_LOCKING = "objectlocking";
13091313
public static final String ENCRYPTION = "encryption";
13101314
public static final String QUOTA = "quota";
1315+
public static final String QUOTA_CONSUMED = "quotaconsumed";
1316+
public static final String QUOTA_USAGE = "quotausage";
13111317
public static final String ACCESS_KEY = "accesskey";
13121318

13131319
public static final String SOURCE_NAT_IP = "sourcenatipaddress";

api/src/main/java/org/apache/cloudstack/api/command/admin/host/FindHostsForMigrationCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void execute() {
7878
for (Host host : result.first()) {
7979
HostForMigrationResponse hostResponse = _responseGenerator.createHostForMigrationResponse(host);
8080
Boolean suitableForMigration = false;
81-
if (hostsWithCapacity.contains(host)) {
81+
if (hostsWithCapacity != null && hostsWithCapacity.contains(host)) {
8282
suitableForMigration = true;
8383
}
8484
hostResponse.setSuitableForMigration(suitableForMigration);

api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ protected ListResponse<HostResponse> getHostResponses() {
252252
for (Host host : result.first()) {
253253
HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails());
254254
Boolean suitableForMigration = false;
255-
if (hostsWithCapacity.contains(host)) {
255+
if (hostsWithCapacity != null && hostsWithCapacity.contains(host)) {
256256
suitableForMigration = true;
257257
}
258258
hostResponse.setSuitableForMigration(suitableForMigration);

client/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -387,11 +387,6 @@
387387
<artifactId>cloud-plugin-explicit-dedication</artifactId>
388388
<version>${project.version}</version>
389389
</dependency>
390-
<dependency>
391-
<groupId>org.apache.cloudstack</groupId>
392-
<artifactId>cloud-plugin-host-allocator-random</artifactId>
393-
<version>${project.version}</version>
394-
</dependency>
395390
<dependency>
396391
<groupId>org.apache.cloudstack</groupId>
397392
<artifactId>cloud-plugin-outofbandmanagement-driver-ipmitool</artifactId>

engine/api/src/main/java/com/cloud/vm/VirtualMachineManager.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,6 @@ void orchestrateStart(String vmUuid, Map<VirtualMachineProfile.Param, Object> pa
181181
void advanceReboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException,
182182
ConcurrentOperationException, OperationTimedoutException;
183183

184-
/**
185-
* Check to see if a virtual machine can be upgraded to the given service offering
186-
*
187-
* @param vm
188-
* @param offering
189-
* @return true if the host can handle the upgrade, false otherwise
190-
*/
191-
boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering);
192-
193184
VirtualMachine findById(long vmId);
194185

195186
void storageMigration(String vmUuid, Map<Long, Long> volumeToPool);

engine/orchestration/src/main/java/com/cloud/vm/VirtualMachineManagerImpl.java

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4017,19 +4017,6 @@ protected void runInContext() {
40174017
}
40184018
}
40194019

4020-
@Override
4021-
public boolean isVirtualMachineUpgradable(final VirtualMachine vm, final ServiceOffering offering) {
4022-
boolean isMachineUpgradable = true;
4023-
for (final HostAllocator allocator : hostAllocators) {
4024-
isMachineUpgradable = allocator.isVirtualMachineUpgradable(vm, offering);
4025-
if (!isMachineUpgradable) {
4026-
break;
4027-
}
4028-
}
4029-
4030-
return isMachineUpgradable;
4031-
}
4032-
40334020
@Override
40344021
public void reboot(final String vmUuid, final Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException {
40354022
try {
@@ -4469,11 +4456,6 @@ public void checkIfCanUpgrade(final VirtualMachine vmInstance, final ServiceOffe
44694456
throw new InvalidParameterValueException("isSystem property is different for current service offering and new service offering");
44704457
}
44714458

4472-
if (!isVirtualMachineUpgradable(vmInstance, newServiceOffering)) {
4473-
throw new InvalidParameterValueException("Unable to upgrade virtual machine, not enough resources available " + "for an offering of " +
4474-
newServiceOffering.getCpu() + " cpu(s) at " + newServiceOffering.getSpeed() + " Mhz, and " + newServiceOffering.getRamSize() + " MB of memory");
4475-
}
4476-
44774459
final List<String> currentTags = StringUtils.csvTagsToList(currentDiskOffering.getTags());
44784460
final List<String> newTags = StringUtils.csvTagsToList(newDiskOffering.getTags());
44794461
if (VolumeApiServiceImpl.MatchStoragePoolTagsWithDiskOffering.valueIn(vmInstance.getDataCenterId())) {

engine/schema/src/main/java/com/cloud/host/dao/HostDao.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ int countHostsByMsResourceStateTypeAndHypervisorType(long msId, List<ResourceSta
218218
*/
219219
List<String> listOrderedHostsHypervisorVersionsInDatacenter(long datacenterId, HypervisorType hypervisorType);
220220

221-
List<HostVO> findHostsWithTagRuleThatMatchComputeOferringTags(String computeOfferingTags);
221+
List<HostVO> findHostsWithTagRuleThatMatchComputeOfferingTags(String computeOfferingTags);
222222

223223
List<Long> findClustersThatMatchHostTagRule(String computeOfferingTags);
224224

engine/schema/src/main/java/com/cloud/host/dao/HostDaoImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1520,7 +1520,7 @@ private List<Long> findHostIdsByHostTags(String hostTags){
15201520
}
15211521
}
15221522

1523-
public List<HostVO> findHostsWithTagRuleThatMatchComputeOferringTags(String computeOfferingTags) {
1523+
public List<HostVO> findHostsWithTagRuleThatMatchComputeOfferingTags(String computeOfferingTags) {
15241524
List<HostTagVO> hostTagVOList = _hostTagsDao.findHostRuleTags();
15251525
List<HostVO> result = new ArrayList<>();
15261526
for (HostTagVO rule: hostTagVOList) {
@@ -1534,7 +1534,7 @@ public List<HostVO> findHostsWithTagRuleThatMatchComputeOferringTags(String comp
15341534

15351535
public List<Long> findClustersThatMatchHostTagRule(String computeOfferingTags) {
15361536
Set<Long> result = new HashSet<>();
1537-
List<HostVO> hosts = findHostsWithTagRuleThatMatchComputeOferringTags(computeOfferingTags);
1537+
List<HostVO> hosts = findHostsWithTagRuleThatMatchComputeOfferingTags(computeOfferingTags);
15381538
for (HostVO host: hosts) {
15391539
result.add(host.getClusterId());
15401540
}

0 commit comments

Comments
 (0)