Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
e7ff4ed
wip
shwstppr Jan 28, 2025
67042ce
ui: multi-arch improvements
shwstppr Jan 28, 2025
126dfa9
api,ui: filter resources by arch
shwstppr Jan 29, 2025
8f48da3
ui: show arch tag in infocard
shwstppr Jan 29, 2025
13f3f14
ui: add arch display and filter for kubernetes iso
shwstppr Jan 29, 2025
b017025
simulator: allow adding hosts with arch
shwstppr Jan 29, 2025
ee59e61
api,ui: allow filtering vms by arch
shwstppr Jan 29, 2025
13ced5e
ui: make arch filter a list
shwstppr Jan 29, 2025
16282dd
wip
shwstppr Feb 4, 2025
bed9666
wip
shwstppr Feb 5, 2025
969660a
change for downloading templates if allowed
shwstppr Feb 20, 2025
f74355f
move download method to httputils
shwstppr Feb 20, 2025
9073ec1
remove unnecssary
shwstppr Feb 21, 2025
48c9d29
fix build
shwstppr Feb 21, 2025
bc5f734
fix
shwstppr Feb 22, 2025
60dc9d9
remove unnecessary change
shwstppr Feb 22, 2025
0ac96d6
fixes
shwstppr Mar 6, 2025
33bb563
wip: try system vm deployment with different arch templates
shwstppr Mar 6, 2025
42598f7
fix checkstyle
shwstppr Mar 6, 2025
59f2608
wip: try VR deployment with arch specific template
shwstppr Mar 6, 2025
a2a7f5d
fix systemvm deployment retry
shwstppr Mar 10, 2025
582187a
preferred arch config
shwstppr Mar 11, 2025
6c95e90
ui: changes for arch auto selection in deploy vm
shwstppr Mar 11, 2025
3069929
CPUArch as an enum, make config select
shwstppr Mar 11, 2025
c98ef69
fix persiting ilbvm
shwstppr Mar 11, 2025
ce43205
refactor to use searchbuilder/critera for distinct pair
shwstppr Mar 12, 2025
5d696f0
cpu test
shwstppr Mar 12, 2025
a6bdd52
refactor fetch arch types
shwstppr Mar 12, 2025
499b861
fix
shwstppr Mar 12, 2025
c1750c8
fix
shwstppr Mar 13, 2025
ab07a12
fixes
shwstppr Mar 13, 2025
8d3d9eb
exception fix
shwstppr Mar 13, 2025
cac8a11
refactor and fixes
shwstppr Mar 13, 2025
27f3119
method rename
shwstppr Mar 13, 2025
8475604
refactor
shwstppr Mar 13, 2025
0003b96
add tests
shwstppr Mar 17, 2025
45fc1e1
Revert "add tests"
shwstppr Mar 17, 2025
f8ecb5d
add tests
shwstppr Mar 17, 2025
82ef924
more tests
shwstppr Mar 18, 2025
d86eb34
Merge branch '4.20' into multiarchzones-improvements
shwstppr Mar 18, 2025
6b374a6
fix trailing space
shwstppr Mar 18, 2025
8c8a56a
fix tests
shwstppr Mar 18, 2025
d81d77b
Merge remote-tracking branch 'apache/4.20' into multiarchzones-improv…
shwstppr Mar 19, 2025
38a4fe6
more tests
shwstppr Mar 19, 2025
a04a3a1
add tests
shwstppr Mar 19, 2025
4ff7c4a
change preferred arch config default
shwstppr Mar 19, 2025
11d5ba9
allow same name template for different arch
shwstppr Mar 19, 2025
affd3d8
address config comment, refactor, add arch to sysvm, routers
shwstppr Mar 19, 2025
f0cc075
fix
shwstppr Mar 19, 2025
aface0e
user vm arch
shwstppr Mar 19, 2025
d81283a
set permissions for systemvm template folder
shwstppr Mar 20, 2025
8f3099d
own templates directory itself
shwstppr Mar 24, 2025
ca02558
Update packaging/el8/cloud.spec
shwstppr Mar 27, 2025
68eb611
fix
shwstppr Mar 27, 2025
a096439
change perm on upgrade
shwstppr Mar 27, 2025
f940220
fix for k8s iso arch
shwstppr Apr 10, 2025
b62472d
fix k8s iso response
shwstppr Apr 10, 2025
f58253c
fix tests
shwstppr Apr 10, 2025
daac0d9
fix for cluster arch change
shwstppr Apr 23, 2025
8ce28e7
fix lint
shwstppr Apr 23, 2025
69db12a
allow specifying arch for edge cluster
shwstppr Apr 23, 2025
a15aeb3
fix DISTINCT class field
shwstppr Apr 23, 2025
3807f17
tests
shwstppr Apr 23, 2025
d8da081
Merge remote-tracking branch 'apache/4.20' into multiarchzones-improv…
shwstppr Apr 24, 2025
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
57 changes: 30 additions & 27 deletions api/src/main/java/com/cloud/cpu/CPU.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,52 +16,55 @@
// under the License.
package com.cloud.cpu;

import com.cloud.utils.exception.CloudRuntimeException;
import org.apache.commons.lang3.StringUtils;

import java.util.LinkedHashMap;
import java.util.Map;

public class CPU {
public enum CPUArch {
x86("i686", 32),
amd64("x86_64", 64),
arm64("aarch64", 64);

public static final String archX86Identifier = "i686";
public static final String archX86_64Identifier = "x86_64";
public static final String archARM64Identifier = "aarch64";

public static class CPUArch {
private static final Map<String, CPUArch> cpuArchMap = new LinkedHashMap<>();

public static final CPUArch archX86 = new CPUArch(archX86Identifier, 32);
public static final CPUArch amd64 = new CPUArch(archX86_64Identifier, 64);
public static final CPUArch arm64 = new CPUArch(archARM64Identifier, 64);
private final String type;
private final int bits;

private String type;
private int bits;

public CPUArch(String type, int bits) {
CPUArch(String type, int bits) {
this.type = type;
this.bits = bits;
cpuArchMap.put(type, this);
}

public static CPUArch getDefault() {
return amd64;
}

public String getType() {
return this.type;
return type;
}

public int getBits() {
return this.bits;
return bits;
}

public static CPUArch fromType(String type) {
if (StringUtils.isBlank(type)) {
return amd64;
return getDefault();
}
for (CPUArch arch : values()) {
if (arch.type.equals(type)) {
return arch;
}
}
throw new IllegalArgumentException("Unsupported arch type: " + type);
}

public static String getTypesAsCSV() {
StringBuilder sb = new StringBuilder();
for (CPUArch arch : values()) {
sb.append(arch.getType()).append(",");
}
switch (type) {
case archX86Identifier: return archX86;
case archX86_64Identifier: return amd64;
case archARM64Identifier: return arm64;
default: throw new CloudRuntimeException(String.format("Unsupported arch type: %s", type));
if (sb.length() > 0) {
sb.setLength(sb.length() - 1);
}
return sb.toString();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.List;


import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
Expand All @@ -28,7 +27,9 @@
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.lang3.StringUtils;

import com.cloud.cpu.CPU;
import com.cloud.org.Cluster;
import com.cloud.utils.Pair;

Expand Down Expand Up @@ -68,6 +69,11 @@
@Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the clusters")
private Boolean showCapacities;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "CPU arch of the clusters",
since = "4.20.1")
private String arch;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -112,6 +118,10 @@
return showCapacities;
}

public CPU.CPUArch getArch() {

Check warning on line 121 in api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java#L121

Added line #L121 was not covered by tests
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
}

Check warning on line 123 in api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java#L123

Added line #L123 was not covered by tests

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.List;
import java.util.Map;


import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
Expand All @@ -34,7 +33,9 @@
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.lang3.StringUtils;

import com.cloud.cpu.CPU;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
Expand Down Expand Up @@ -105,6 +106,9 @@
@Parameter(name = ApiConstants.HYPERVISOR, type = CommandType.STRING, description = "hypervisor type of host: XenServer,KVM,VMware,Hyperv,BareMetal,Simulator")
private String hypervisor;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, description = "CPU Arch of the host", since = "4.20.1")
private String arch;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -189,6 +193,10 @@
return outOfBandManagementPowerState;
}

public CPU.CPUArch getArch() {

Check warning on line 196 in api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L196 was not covered by tests
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
}

Check warning on line 198 in api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L198 was not covered by tests

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
// under the License.
package org.apache.cloudstack.api.command.admin.router;

import org.apache.commons.lang.BooleanUtils;

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
Expand All @@ -32,7 +30,10 @@
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.lang.BooleanUtils;
import org.apache.commons.lang3.StringUtils;

import com.cloud.cpu.CPU;
import com.cloud.network.router.VirtualRouter.Role;
import com.cloud.vm.VirtualMachine;

Expand Down Expand Up @@ -86,6 +87,11 @@
description = "if true is passed for this parameter, also fetch last executed health check results for the router. Default is false")
private Boolean fetchHealthCheckResults;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "CPU arch of the router",
since = "4.20.1")
private String arch;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -146,6 +152,10 @@
return BooleanUtils.isTrue(fetchHealthCheckResults);
}

public CPU.CPUArch getArch() {

Check warning on line 155 in api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java#L155

Added line #L155 was not covered by tests
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
}

Check warning on line 157 in api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java#L157

Added line #L157 was not covered by tests


/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
import java.util.ArrayList;
import java.util.List;


import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
import org.apache.cloudstack.api.ApiConstants;
Expand All @@ -31,7 +30,9 @@
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.lang3.StringUtils;

import com.cloud.cpu.CPU;
import com.cloud.utils.Pair;
import com.cloud.vm.VirtualMachine;

Expand Down Expand Up @@ -74,6 +75,11 @@
since = "3.0.1")
private Long storageId;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "CPU arch of the system VM",
since = "4.20.1")
private String arch;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -110,6 +116,10 @@
return storageId;
}

public CPU.CPUArch getArch() {

Check warning on line 119 in api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java#L119

Added line #L119 was not covered by tests
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
}

Check warning on line 121 in api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java#L121

Added line #L121 was not covered by tests

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,11 @@
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.BooleanUtils;
import org.apache.commons.lang3.StringUtils;

import com.cloud.cpu.CPU;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.server.ResourceIcon;
import com.cloud.server.ResourceTag;
Expand Down Expand Up @@ -153,6 +155,11 @@
@Parameter(name = ApiConstants.USER_DATA_ID, type = CommandType.UUID, entityType = UserDataResponse.class, required = false, description = "the instances by userdata", since = "4.20.1")
private Long userdataId;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "CPU arch of the VM",
since = "4.20.1")
private String arch;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -292,6 +299,10 @@
return isVnf;
}

public CPU.CPUArch getArch() {

Check warning on line 302 in api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java#L302

Added line #L302 was not covered by tests
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
}

Check warning on line 304 in api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java#L304

Added line #L304 was not covered by tests

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,10 @@
@Param(description = "the version of the code / software in the router")
private String softwareVersion;

@SerializedName(ApiConstants.ARCH)
@Param(description = "CPU arch of the router", since = "4.20.1")
private String arch;

public DomainRouterResponse() {
nics = new LinkedHashSet<NicResponse>();
}
Expand Down Expand Up @@ -518,4 +522,8 @@
public void setSoftwareVersion(String softwareVersion) {
this.softwareVersion = softwareVersion;
}

public void setArch(String arch) {
this.arch = arch;
}

Check warning on line 528 in api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/DomainRouterResponse.java#L526-L528

Added lines #L526 - L528 were not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@
@Param(description = "the name of the service offering of the system virtual machine.")
private String serviceOfferingName;

@SerializedName(ApiConstants.ARCH)
@Param(description = "CPU arch of the system VM", since = "4.20.1")
private String arch;

@Override
public String getObjectId() {
return this.getId();
Expand Down Expand Up @@ -490,4 +494,8 @@
public void setServiceOfferingName(String serviceOfferingName) {
this.serviceOfferingName = serviceOfferingName;
}

public void setArch(String arch) {
this.arch = arch;
}

Check warning on line 500 in api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/SystemVmResponse.java#L498-L500

Added lines #L498 - L500 were not covered by tests
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponseWithTagInformation;
import org.apache.cloudstack.api.EntityReference;
import org.apache.commons.collections.CollectionUtils;

import com.cloud.network.router.VirtualRouter;
import com.cloud.serializer.Param;
import com.cloud.uservm.UserVm;
import com.cloud.vm.VirtualMachine;
import com.google.gson.annotations.SerializedName;
import org.apache.commons.collections.CollectionUtils;

@SuppressWarnings("unused")
@EntityReference(value = {VirtualMachine.class, UserVm.class, VirtualRouter.class})
Expand Down Expand Up @@ -396,6 +396,10 @@
@Param(description = "User VM type", since = "4.20.0")
private String vmType;

@SerializedName(ApiConstants.ARCH)
@Param(description = "CPU arch of the VM", since = "4.20.1")
private String arch;

public UserVmResponse() {
securityGroupList = new LinkedHashSet<>();
nics = new TreeSet<>(Comparator.comparingInt(x -> Integer.parseInt(x.getDeviceId())));
Expand Down Expand Up @@ -1169,4 +1173,12 @@
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}

public String getArch() {
return arch;
}

Check warning on line 1179 in api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java#L1177-L1179

Added lines #L1177 - L1179 were not covered by tests

public void setArch(String arch) {

Check warning on line 1181 in api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

View check run for this annotation

Codecov / codecov/patch

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java#L1181

Added line #L1181 was not covered by tests
this.arch = arch;
}
}
Loading
Loading