Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
3 changes: 2 additions & 1 deletion api/src/main/java/com/cloud/cpu/CPU.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ public class CPU {
public enum CPUArch {
x86("i686", 32),
amd64("x86_64", 64),
arm64("aarch64", 64);
arm64("aarch64", 64),
s390x("s390x", 64);

private final String type;
private final int bits;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
private Boolean cleanupDetails;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the template/ISO. Valid options are: x86_64, aarch64",
description = "the CPU arch of the template/ISO. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public class AddClusterCmd extends BaseCmd {
private String hypervisor;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the cluster. Valid options are: x86_64, aarch64",
description = "the CPU arch of the cluster. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class UpdateClusterCmd extends BaseCmd {
private String managedState;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the cluster. Valid options are: x86_64, aarch64",
description = "the CPU arch of the cluster. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd implements UserCmd {
private Boolean showIcon;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64",
description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public class RegisterIsoCmd extends BaseCmd implements UserCmd {
private Boolean passwordEnabled;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64",
description = "the CPU arch of the ISO. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd {
private String accountName;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the template. Valid options are: x86_64, aarch64. Defaults to x86_64",
description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x. Defaults to x86_64",
since = "4.20.2")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
private Long osTypeId;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the template. Valid options are: x86_64, aarch64",
description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public class ListTemplatesCmd extends BaseListTaggedResourcesCmd implements User
private Boolean forCks;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the template. Valid options are: x86_64, aarch64",
description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd {
private String templateType;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the template. Valid options are: x86_64, aarch64",
description = "the CPU arch of the template. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
5 changes: 4 additions & 1 deletion api/src/test/java/com/cloud/cpu/CPUTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,23 @@ public void testCPUArchGetType() {
assertEquals("i686", CPU.CPUArch.x86.getType());
assertEquals("x86_64", CPU.CPUArch.amd64.getType());
assertEquals("aarch64", CPU.CPUArch.arm64.getType());
assertEquals("s390x", CPU.CPUArch.s390x.getType());
}

@Test
public void testCPUArchGetBits() {
assertEquals(32, CPU.CPUArch.x86.getBits());
assertEquals(64, CPU.CPUArch.amd64.getBits());
assertEquals(64, CPU.CPUArch.arm64.getBits());
assertEquals(64, CPU.CPUArch.s390x.getBits());
}

@Test
public void testCPUArchFromTypeWithValidValues() {
assertEquals(CPU.CPUArch.x86, CPU.CPUArch.fromType("i686"));
assertEquals(CPU.CPUArch.amd64, CPU.CPUArch.fromType("x86_64"));
assertEquals(CPU.CPUArch.arm64, CPU.CPUArch.fromType("aarch64"));
assertEquals(CPU.CPUArch.s390x, CPU.CPUArch.fromType("s390x"));
}

@Test
Expand All @@ -61,7 +64,7 @@ public void testCPUArchFromTypeWithInvalidValue() {

@Test
public void testCPUArchGetTypesAsCSV() {
String expectedCSV = "i686,x86_64,aarch64";
String expectedCSV = "i686,x86_64,aarch64,s390x";
assertEquals(expectedCSV, CPU.CPUArch.getTypesAsCSV());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,9 @@ public String toString() {
guestDef.append("<boot dev='" + bo + "'/>\n");
}
}
guestDef.append("<smbios mode='sysinfo'/>\n");
if (!(_arch != null && _arch.equals("s390x"))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!(_arch != null && _arch.equals("s390x"))) {
if (!CPU.CPUArch.s390x.getType().equalsIgnoreCase(_arch)) {

guestDef.append("<smbios mode='sysinfo'/>\n");
}
guestDef.append("</os>\n");
if (iothreads) {
guestDef.append(String.format("<iothreads>%s</iothreads>", NUMBER_OF_IOTHREADS));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -865,7 +865,9 @@ private void verifyPoliticOn_(Document domainDoc) {
private void verifyFeatures(Document domainDoc) {
assertNodeExists(domainDoc, "/domain/features/pae");
assertNodeExists(domainDoc, "/domain/features/apic");
assertNodeExists(domainDoc, "/domain/features/acpi");
if (!"s390x".equals(System.getProperty("os.arch"))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!"s390x".equals(System.getProperty("os.arch"))) {
if (!CPU.CPUArch.s390x.getType().equalsIgnoreCase(System.getProperty("os.arch"))) {

assertNodeExists(domainDoc, "/domain/features/acpi");
}
}

private void verifyHeader(Document domainDoc, String hvsType, String name, String uuid, String os) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public class AddKubernetesSupportedVersionCmd extends BaseCmd implements AdminCm
private Boolean directDownload;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the Kubernetes ISO. Valid options are: x86_64, aarch64",
description = "the CPU arch of the Kubernetes ISO. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class ListKubernetesSupportedVersionsCmd extends BaseListCmd {
private Long minimumKubernetesVersionId;

@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
description = "the CPU arch of the binaries ISO. Valid options are: x86_64, aarch64",
description = "the CPU arch of the binaries ISO. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;

Expand Down
3 changes: 3 additions & 0 deletions ui/src/components/view/DeployVMFromBackup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,9 @@ export default {
}, {
id: 'aarch64',
description: 'ARM 64 bits (aarch64)'
}, {
id: 's390x',
description: 'IBM Z 64 bits (s390x)'
}
]
}
Expand Down
3 changes: 2 additions & 1 deletion ui/src/utils/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -557,7 +557,8 @@ export const cpuArchitectureUtilPlugin = {
app.config.globalProperties.$fetchCpuArchitectureTypes = function () {
const architectures = [
{ id: 'x86_64', name: 'Intel/AMD 64 bits (x86_64)' },
{ id: 'aarch64', name: 'ARM 64 bits (aarch64)' }
{ id: 'aarch64', name: 'ARM 64 bits (aarch64)' },
{ id: 's390x', name: 'IBM Z/Architecture 64 bits (s390x)' }
]
return architectures.map(item => ({ ...item, description: item.name }))
}
Expand Down
4 changes: 4 additions & 0 deletions ui/src/views/infra/ClusterUpdate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ export default {
id: 'aarch64',
description: 'ARM 64 bits (aarch64)'
})
typesList.push({
id: 's390x',
description: 'S390X 64 bits (s390x)'
})
this.architectureTypes.opts = typesList
},
fetchExtensionResourceMapDetails () {
Expand Down
3 changes: 3 additions & 0 deletions ui/src/views/infra/zone/ZoneWizardAddResources.vue
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ export default {
}, {
id: 'aarch64',
description: 'ARM 64 bits (aarch64)'
}, {
id: 's390x',
description: 'S390X 64 bits (s390x)'
}],
storageProviders: [],
currentStep: null,
Expand Down
Loading