Feature s390x multiarch support (#12214)

Signed-off-by: Niyam Siwach <niyam@ibm.com>
Signed-off-by: Viddya K <viddya.k@ibm.com>
Co-authored-by: root <root@c32379v1.fyre.ibm.com>
This commit is contained in:
K Viddya 2025-12-19 14:36:58 +05:30 committed by GitHub
parent 13f805fbf3
commit 558232e8e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
19 changed files with 37 additions and 16 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -28,6 +28,7 @@ public class CPUTest {
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
@ -35,6 +36,7 @@ public class CPUTest {
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
@ -42,6 +44,7 @@ public class CPUTest {
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
@ -61,7 +64,7 @@ public class CPUTest {
@Test
public void testCPUArchGetTypesAsCSV() {
String expectedCSV = "i686,x86_64,aarch64";
String expectedCSV = "i686,x86_64,aarch64,s390x";
assertEquals(expectedCSV, CPU.CPUArch.getTypesAsCSV());
}
}

View File

@ -27,6 +27,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.cloud.cpu.CPU;
import org.apache.cloudstack.api.ApiConstants.IoDriverPolicy;
import org.apache.cloudstack.utils.qemu.QemuObject;
import org.apache.commons.lang.StringEscapeUtils;
@ -420,7 +421,9 @@ public class LibvirtVMDef {
guestDef.append("<boot dev='" + bo + "'/>\n");
}
}
guestDef.append("<smbios mode='sysinfo'/>\n");
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));

View File

@ -61,6 +61,7 @@ import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathExpressionException;
import javax.xml.xpath.XPathFactory;
import com.cloud.cpu.CPU;
import com.cloud.utils.net.NetUtils;
import com.cloud.vm.VmDetailConstants;
@ -865,7 +866,9 @@ public class LibvirtComputingResourceTest {
private void verifyFeatures(Document domainDoc) {
assertNodeExists(domainDoc, "/domain/features/pae");
assertNodeExists(domainDoc, "/domain/features/apic");
assertNodeExists(domainDoc, "/domain/features/acpi");
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) {

View File

@ -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;

View File

@ -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;

View File

@ -975,6 +975,9 @@ export default {
}, {
id: 'aarch64',
description: 'ARM 64 bits (aarch64)'
}, {
id: 's390x',
description: 'IBM Z 64 bits (s390x)'
}
]
}

View File

@ -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 64 bits (s390x)' }
]
return architectures.map(item => ({ ...item, description: item.name }))
}

View File

@ -168,6 +168,10 @@ export default {
id: 'aarch64',
description: 'ARM 64 bits (aarch64)'
})
typesList.push({
id: 's390x',
description: 'IBM Z 64 bits (s390x)'
})
this.architectureTypes.opts = typesList
},
fetchExtensionResourceMapDetails () {

View File

@ -865,6 +865,9 @@ export default {
}, {
id: 'aarch64',
description: 'ARM 64 bits (aarch64)'
}, {
id: 's390x',
description: 'IBM Z 64 bits (s390x)'
}],
storageProviders: [],
currentStep: null,