diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java index 2fa099749b3..7b41c65fbd6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/AddVmCommand.java @@ -300,6 +300,12 @@ protected void init() { parameters.getVmStaticData().setBiosType(vmDevicesSource.getClusterId() == null ? getCluster().getBiosType() : vmDevicesSource.getBiosType()); } + // For aarch64, always use host cpu flags + if (getCluster().getArchitecture().getFamily() == ArchitectureType.aarch64) { + parameters.getVm().setUseHostCpuFlags(true); + parameters.getVmStaticData().setUseHostCpuFlags(true); + } + imageTypeId = parameters.getVmStaticData().getImageTypeId(); vmInterfacesSourceId = parameters.getVmStaticData().getVmtGuid(); vmDisksSource = getVmTemplate(); diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ClusterOperationCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ClusterOperationCommandBase.java index 1ebdc90b9be..dbaf286fcd2 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ClusterOperationCommandBase.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ClusterOperationCommandBase.java @@ -182,6 +182,9 @@ && isX86Architecture(cluster)) { } else if (isVersionGreaterOrEquals(cluster, Version.v4_4) && isX86Architecture(cluster)) { cluster.setBiosType(BiosType.Q35_SEA_BIOS); + } else if (isVersionGreaterOrEquals(cluster, Version.v4_7) + && isAarch64Architecture(cluster)) { + cluster.setBiosType(BiosType.AMPERE_OVMF); } else { cluster.setBiosType(BiosType.I440FX_SEA_BIOS); } @@ -202,6 +205,11 @@ private boolean isX86Architecture(Cluster cluster) { && cluster.getArchitecture().getFamily() == ArchitectureType.x86; } + private boolean isAarch64Architecture(Cluster cluster) { + return cluster.getArchitecture() != null + && cluster.getArchitecture().getFamily() == ArchitectureType.aarch64; + } + private ClusterPolicy getClusterPolicy(final Cluster cluster) { ClusterPolicy clusterPolicy = null; if (cluster == null) { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java index 179cfd83c07..566c65ab775 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/CpuFlagsManagerHandler.java @@ -157,15 +157,18 @@ private static class CpuFlagsManager { private List amdCpuList; private List ibmCpuList; private List s390CpuList; + private List armCpuList; private List allCpuList = new ArrayList<>(); private Map intelCpuByNameDictionary = new HashMap<>(); private Map amdCpuByNameDictionary = new HashMap<>(); private Map ibmCpuByNameDictionary = new HashMap<>(); private Map s390CpuByNameDictionary = new HashMap<>(); + private Map armCpuByNameDictionary = new HashMap<>(); private Map intelCpuByVdsNameDictionary = new HashMap<>(); private Map amdCpuByVdsNameDictionary = new HashMap<>(); private Map ibmCpuByVdsNameDictionary = new HashMap<>(); private Map s390CpuByVdsNameDictionary = new HashMap<>(); + private Map armCpuByVdsNameDictionary = new HashMap<>(); public CpuFlagsManager(Version ver) { initDictionaries(ver); @@ -200,6 +203,8 @@ public String getVendorByCpuName(String cpuName) { result = CpuVendor.IBM.name(); } else if (s390CpuByNameDictionary.get(cpuName) != null) { result = CpuVendor.IBMS390.name(); + } else if (armCpuByNameDictionary.get(cpuName) != null) { + result = CpuVendor.ARM.name(); } } return result; @@ -222,6 +227,10 @@ public ServerCpu getServerCpuByName(String cpuName) { if (result == null) { result = s390CpuByNameDictionary.get(cpuName); } + + if (result == null) { + result = armCpuByNameDictionary.get(cpuName); + } } return result; } @@ -233,6 +242,7 @@ public void initDictionaries(Version ver) { amdCpuByNameDictionary.clear(); ibmCpuByNameDictionary.clear(); s390CpuByNameDictionary.clear(); + armCpuByNameDictionary.clear(); allCpuList.clear(); String[] cpus = Config. getValue(ConfigValues.ServerCPUList, ver.toString()).trim().split("[;]", -1); @@ -271,6 +281,9 @@ public void initDictionaries(Version ver) { } else if (sc.getFlags().contains(CpuVendor.IBMS390.getFlag())) { s390CpuByNameDictionary.put(sc.getCpuName(), sc); s390CpuByVdsNameDictionary.put(sc.getVdsVerbData(), sc); + } else if (sc.getFlags().contains(CpuVendor.ARM.getFlag())) { + armCpuByNameDictionary.put(sc.getCpuName(), sc); + armCpuByVdsNameDictionary.put(sc.getVdsVerbData(), sc); } allCpuList.add(sc); @@ -283,6 +296,7 @@ public void initDictionaries(Version ver) { amdCpuList = new ArrayList<>(amdCpuByNameDictionary.values()); ibmCpuList = new ArrayList<>(ibmCpuByNameDictionary.values()); s390CpuList = new ArrayList<>(s390CpuByNameDictionary.values()); + armCpuList = new ArrayList<>(armCpuByNameDictionary.values()); Comparator cpuComparator = Comparator.comparingInt(ServerCpu::getLevel); @@ -292,6 +306,7 @@ public void initDictionaries(Version ver) { Collections.sort(amdCpuList, cpuComparator); Collections.sort(ibmCpuList, cpuComparator); Collections.sort(s390CpuList, cpuComparator); + Collections.sort(armCpuList, cpuComparator); } public String getVDSVerbDataByCpuName(String name) { @@ -301,7 +316,8 @@ public String getVDSVerbDataByCpuName(String name) { if ((sc = intelCpuByNameDictionary.get(name)) != null || (sc = amdCpuByNameDictionary.get(name)) != null || (sc = ibmCpuByNameDictionary.get(name)) != null - || (sc = s390CpuByNameDictionary.get(name)) != null) { + || (sc = s390CpuByNameDictionary.get(name)) != null + || (sc = armCpuByVdsNameDictionary.get(name)) != null) { result = sc.getVdsVerbData(); } } @@ -315,7 +331,8 @@ public String getCpuNameByCpuId(String vdsName) { if ((sc = intelCpuByVdsNameDictionary.get(vdsName)) != null || (sc = amdCpuByVdsNameDictionary.get(vdsName)) != null || (sc = ibmCpuByVdsNameDictionary.get(vdsName)) != null - || (sc = s390CpuByVdsNameDictionary.get(vdsName)) != null) { + || (sc = s390CpuByVdsNameDictionary.get(vdsName)) != null + || (sc = armCpuByVdsNameDictionary.get(vdsName)) != null) { result = sc.getCpuName(); } } @@ -346,6 +363,7 @@ public List missingServerCpuFlags(String clusterCpuName, String serverFl || (clusterCpu = amdCpuByNameDictionary.get(clusterCpuName)) != null || (clusterCpu = ibmCpuByNameDictionary.get(clusterCpuName)) != null || (clusterCpu = s390CpuByNameDictionary.get(clusterCpuName)) != null + || (clusterCpu = armCpuByNameDictionary.get(clusterCpuName)) != null )) { for (String flag : clusterCpu.getFlags()) { if (!lstServerflags.contains(flag)) { @@ -393,6 +411,10 @@ public boolean checkIfCpusSameManufacture(String cpuName1, String cpuName2) { return s390CpuByNameDictionary.containsKey(cpuName2); } + if (armCpuByNameDictionary.containsKey(cpuName1)) { + return armCpuByNameDictionary.containsKey(cpuName2); + } + return false; } @@ -401,7 +423,8 @@ public boolean checkIfCpusExist(String cpuName) { && (intelCpuByNameDictionary.containsKey(cpuName) || amdCpuByNameDictionary.containsKey(cpuName) || ibmCpuByNameDictionary.containsKey(cpuName) - || s390CpuByNameDictionary.containsKey(cpuName)); + || s390CpuByNameDictionary.containsKey(cpuName) + || armCpuByNameDictionary.containsKey(cpuName)); } /** @@ -441,6 +464,12 @@ public List findServerCpusByFlags(String flags) { foundCpus.add(s390CpuList.get(i)); } } + } else if (lstFlags.contains(CpuVendor.ARM.getFlag())) { + for (int i = armCpuList.size() - 1; i >= 0; i--) { + if (checkIfFlagsContainsCpuFlags(armCpuList.get(i), lstFlags)) { + foundCpus.add(armCpuList.get(i)); + } + } } return foundCpus; } @@ -478,6 +507,12 @@ public List getSupportedServerCpuList(String maxCpuName) { for (int i = 0; i <= selectedCpuIndex; i++) { supportedCpus.add(s390CpuList.get(i)); } + } else if (armCpuByNameDictionary.containsKey(maxCpuName)) { + ServerCpu selected = armCpuByNameDictionary.get(maxCpuName); + int selectedCpuIndex = armCpuList.indexOf(selected); + for (int i = 0; i <= selectedCpuIndex; i++) { + supportedCpus.add(armCpuList.get(i)); + } } return supportedCpus; diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java index 5ab7d95a3cf..e2badc46ea1 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/RunVmCommand.java @@ -952,6 +952,8 @@ protected boolean getVdsToRunOn() { if (getVm().isUsingCpuPassthrough()) { getVm().setCpuName(getVds().getCpuFlags()); getVm().setUseHostCpuFlags(true); + } else if (getVm().getClusterArch().getFamily() == ArchitectureType.aarch64) { + getVm().setUseHostCpuFlags(true); } addNumaPinningForDedicated(getVdsId()); @@ -1146,6 +1148,7 @@ protected boolean validateImpl() { if (FeatureSupported.isBiosTypeSupported(getCluster().getCompatibilityVersion()) && getVm().getBiosType() != BiosType.I440FX_SEA_BIOS + && getCluster().getArchitecture().getFamily() != ArchitectureType.aarch64 && getCluster().getArchitecture().getFamily() != ArchitectureType.x86) { return failValidation(EngineMessage.NON_DEFAULT_BIOS_TYPE_FOR_X86_ONLY); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateClusterCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateClusterCommand.java index 40747971447..d2aaac63698 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateClusterCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateClusterCommand.java @@ -655,7 +655,8 @@ private String getEmulatedMachineOfHostInCluster(VDS vds) { List available = Config.getValue(ConfigValues.ClusterEmulatedMachines, version.getValue()); return ClusterEmulatedMachines.build( EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.I440FX, supported, available), - EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.Q35, supported, available)); + EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.Q35, supported, available), + EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.VIRT, supported, available)); } private void addOrUpdateAddtionalClusterFeatures() { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java index 3da61b88300..9def40e67c6 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java @@ -252,6 +252,10 @@ protected void init() { if (getParameters().getVmStaticData().getBiosType() == null) { getParameters().getVmStaticData().setBiosType(getVm().getBiosType()); } + if (!getParameters().getVm().isUseHostCpuFlags() + && getVm().getClusterArch().getFamily() == ArchitectureType.aarch64) { + getParameters().getVm().setUseHostCpuFlags(true); + } } private VmPropertiesUtils getVmPropertiesUtils() { diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/architecture/HasMaximumNumberOfDisks.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/architecture/HasMaximumNumberOfDisks.java index fd0afd77542..cded6489f79 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/architecture/HasMaximumNumberOfDisks.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/architecture/HasMaximumNumberOfDisks.java @@ -38,6 +38,11 @@ public void runForS390X() { hasMaximum = VmCommand.MAX_VIRTIO_CCW_DISKS == countDisks(DiskInterface.VirtIO); } + @Override + public void runForAARCH64() { + hasMaximum = VmCommand.MAX_IDE_SLOTS == countDisks(DiskInterface.IDE); + } + public boolean returnValue() { return hasMaximum; } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/ClusterValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/ClusterValidator.java index cdfcdd12444..1b02fb79cfc 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/ClusterValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/ClusterValidator.java @@ -486,6 +486,8 @@ public ValidationResult nonDefaultBiosType() { .when(FeatureSupported.isBiosTypeSupported(eCluster.getCompatibilityVersion()) && eCluster.getBiosType() != null && eCluster.getBiosType() != BiosType.I440FX_SEA_BIOS + && eCluster.getBiosType() != BiosType.AMPERE + && eCluster.getBiosType() != BiosType.AMPERE_OVMF && architecture.getFamily() != ArchitectureType.x86); } diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java index 951d360956b..40f9e83cd08 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/VmValidator.java @@ -461,6 +461,8 @@ public ValidationResult canMigrate(boolean forceMigration) { public static ValidationResult isBiosTypeSupported(VmBase vmBase, Cluster cluster, OsRepository osRepository) { if (FeatureSupported.isBiosTypeSupported(cluster.getCompatibilityVersion()) && vmBase.getBiosType() != BiosType.I440FX_SEA_BIOS + && vmBase.getBiosType() != BiosType.AMPERE + && vmBase.getBiosType() != BiosType.AMPERE_OVMF && cluster.getArchitecture() != ArchitectureType.undefined && cluster.getArchitecture().getFamily() != ArchitectureType.x86) { return new ValidationResult(EngineMessage.NON_DEFAULT_BIOS_TYPE_FOR_X86_ONLY); diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/CloneVMCommandTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/CloneVMCommandTest.java index cfabd91a3dc..b9e5c474bc3 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/CloneVMCommandTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/CloneVMCommandTest.java @@ -22,6 +22,7 @@ import org.ovirt.engine.core.bll.interfaces.BackendInternal; import org.ovirt.engine.core.bll.utils.VmDeviceUtils; import org.ovirt.engine.core.common.action.CloneVmParameters; +import org.ovirt.engine.core.common.businessentities.ArchitectureType; import org.ovirt.engine.core.common.businessentities.BiosType; import org.ovirt.engine.core.common.businessentities.Cluster; import org.ovirt.engine.core.common.businessentities.VM; @@ -106,6 +107,7 @@ private void initializeCommand() { when(vmDao.get(any())).thenReturn(vm); Cluster cluster = new Cluster(); cluster.setCompatibilityVersion(Version.v4_4); + cluster.setArchitecture(ArchitectureType.x86); when(clusterDao.get(any())).thenReturn(cluster); VmTemplate vmTemplate = new VmTemplate(); when(vmTemplateDao.get(any())).thenReturn(vmTemplate); diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ArchitectureType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ArchitectureType.java index bea8567ae18..13d4f136ceb 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ArchitectureType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ArchitectureType.java @@ -14,6 +14,8 @@ public enum ArchitectureType implements Identifiable { ppc(3), /* Host & Guest architecture */ s390x(7), + /* Host & Guest architecture */ + aarch64(8), // Specific architectures /* Host & Guest architecture */ diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BiosType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BiosType.java index 0bec6ffdd5b..054650bfb8e 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BiosType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/BiosType.java @@ -13,7 +13,9 @@ public enum BiosType implements Identifiable { I440FX_SEA_BIOS(1, ChipsetType.I440FX, false), Q35_SEA_BIOS(2, ChipsetType.Q35, false), Q35_OVMF(3, ChipsetType.Q35, true), - Q35_SECURE_BOOT(4, ChipsetType.Q35, true); + Q35_SECURE_BOOT(4, ChipsetType.Q35, true), + AMPERE(5, ChipsetType.VIRT, false), + AMPERE_OVMF(6, ChipsetType.VIRT, true); private int value; private ChipsetType chipsetType; diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ChipsetType.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ChipsetType.java index 26588ba880e..6274c4e79e7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ChipsetType.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/ChipsetType.java @@ -3,7 +3,8 @@ public enum ChipsetType { I440FX("i440fx"), - Q35("q35"); + Q35("q35"), + VIRT("virt"); private String chipsetName; @@ -26,6 +27,9 @@ public static ChipsetType fromMachineType(String machineType) { if (element.equalsIgnoreCase("pc")) { defaultChipset = I440FX; } + if (element.equalsIgnoreCase("virt")) { + defaultChipset = VIRT; + } } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java index 76739d9fb5f..0329530cc02 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/VmBase.java @@ -1627,7 +1627,7 @@ public void setCustomCpuName(String customCpuName) { } public boolean isUseHostCpuFlags() { - return useHostCpuFlags; + return useHostCpuFlags = biosType == BiosType.AMPERE || biosType == BiosType.AMPERE_OVMF; } public void setUseHostCpuFlags(boolean useHostCpuFlags) { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java index e9c621bdd82..b8d039ea99c 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/osinfo/OsRepository.java @@ -23,6 +23,7 @@ public interface OsRepository { int DEFAULT_X86_OS = 0; int DEFAULT_PPC_OS = 1001; int DEFAULT_S390_OS = 2001; + int DEFAULT_AARCH64_OS = 3001; /* * This value is used to enable the auto selection of an appropriate OS when diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ClusterEmulatedMachines.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ClusterEmulatedMachines.java index 2928da41191..edcac6ead83 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ClusterEmulatedMachines.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/ClusterEmulatedMachines.java @@ -6,21 +6,29 @@ public class ClusterEmulatedMachines { private static final String I440FX_CHIPSET_NAME = ChipsetType.I440FX.getChipsetName(); private static final String Q35_CHIPSET_NAME = ChipsetType.Q35.getChipsetName(); + private static final String VIRT_CHIPSET_NAME = ChipsetType.VIRT.getChipsetName(); private String i440fxType = ""; private String q35Type = ""; + private String virtType = ""; private ClusterEmulatedMachines() { } + private ClusterEmulatedMachines(String virtType) { + this.virtType = virtType; + } + private ClusterEmulatedMachines(String i440fxType, String q35Type) { this.i440fxType = i440fxType; this.q35Type = q35Type; } - public static String build(String i440fxType, String q35Type) { - if (i440fxType == null) { + public static String build(String i440fxType, String q35Type, String virtType) { + if (i440fxType == null && q35Type != null) { return q35Type; + } else if (q35Type == null && i440fxType == null && virtType != null) { + return virtType; } else { return q35Type == null ? i440fxType : i440fxType + ";" + q35Type; } @@ -44,6 +52,8 @@ public static ClusterEmulatedMachines parse(String emulatedMachine) { ChipsetType chipsetType = ChipsetType.fromMachineType(emulatedMachine); if (chipsetType == ChipsetType.Q35) { return new ClusterEmulatedMachines(replaceChipset(emulatedMachine, ChipsetType.I440FX), emulatedMachine); + } else if (chipsetType == ChipsetType.VIRT) { + return new ClusterEmulatedMachines(replaceChipset(emulatedMachine, ChipsetType.VIRT)); } else { return new ClusterEmulatedMachines(emulatedMachine, replaceChipset(emulatedMachine, ChipsetType.Q35)); } @@ -68,6 +78,12 @@ protected static String replaceChipset(String emulatedMachine, ChipsetType chips return emulatedMachine.replace(Q35_CHIPSET_NAME, I440FX_CHIPSET_NAME); } break; + + case VIRT: + if (emulatedMachine.contains(VIRT_CHIPSET_NAME)) { + return emulatedMachine.replace(Q35_CHIPSET_NAME, VIRT_CHIPSET_NAME); + } + break; } return emulatedMachine; } @@ -80,8 +96,16 @@ public String getQ35Type() { return q35Type; } + public String getVirtType() { + return virtType; + } + public String getTypeByChipset(ChipsetType chipsetType) { - return chipsetType == ChipsetType.Q35 ? q35Type : i440fxType; + if (chipsetType == ChipsetType.VIRT) { + return virtType; + } else { + return chipsetType == ChipsetType.Q35 ? q35Type : i440fxType; + } } public static String forChipset(String emulatedMachine, ChipsetType chipsetType) { diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/CpuVendor.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/CpuVendor.java index 66bde4123bc..a0e03a343d7 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/CpuVendor.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/CpuVendor.java @@ -8,7 +8,8 @@ public enum CpuVendor implements Serializable { INTEL("vmx"), AMD("svm"), IBM("powernv"), - IBMS390("sie"); + IBMS390("sie"), + ARM("virt_aarch64"); private final String flag; diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/CPUMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/CPUMapper.java index b156a828fb1..04d1d6f95af 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/CPUMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/CPUMapper.java @@ -32,6 +32,8 @@ public static ArchitectureType map(Architecture model, return ArchitectureType.ppc64; case S390X: return ArchitectureType.s390x; + case AARCH64: + return ArchitectureType.aarch64; default: return null; } @@ -52,6 +54,8 @@ public static Architecture map(ArchitectureType model, return Architecture.PPC64; case s390x: return Architecture.S390X; + case aarch64: + return Architecture.AARCH64; default: return null; } diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java index cead3628a0f..a0e85646b07 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OsRepositoryImpl.java @@ -52,12 +52,13 @@ public enum OsRepositoryImpl implements OsRepository { */ private Map idToUnameLookup; private Map backwardCompatibleNamesToIds; - private static Map defaultOsMap = new HashMap<>(3); + private static Map defaultOsMap = new HashMap<>(4); static { defaultOsMap.put(ArchitectureType.x86_64, DEFAULT_X86_OS); defaultOsMap.put(ArchitectureType.ppc64, DEFAULT_PPC_OS); defaultOsMap.put(ArchitectureType.s390x, DEFAULT_S390_OS); + defaultOsMap.put(ArchitectureType.aarch64, DEFAULT_AARCH64_OS); } public void init(MapBackedPreferences preferences) { diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/AARCH64Strategy.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/AARCH64Strategy.java new file mode 100644 index 00000000000..3d87ce734bb --- /dev/null +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/AARCH64Strategy.java @@ -0,0 +1,18 @@ +package org.ovirt.engine.core.utils.archstrategy; + +import org.ovirt.engine.core.common.businessentities.ArchitectureType; + +public class AARCH64Strategy implements ArchStrategy { + + @Override + public ArchitectureType getArchitecture() { + return ArchitectureType.aarch64; + } + + @Override + public T run(T c) { + c.runForAARCH64(); + return c; + } + +} diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchCommand.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchCommand.java index c35bb52f1d9..6afffe00f46 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchCommand.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchCommand.java @@ -6,4 +6,6 @@ public interface ArchCommand { void runForPPC64(); void runForS390X(); + + void runForAARCH64(); } diff --git a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchStrategyFactory.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchStrategyFactory.java index eddd753e760..0d597198644 100644 --- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchStrategyFactory.java +++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/ArchStrategyFactory.java @@ -13,6 +13,7 @@ public class ArchStrategyFactory { architectureArchStrategyMap.put(ArchitectureType.x86_64, new X86_64Strategy()); architectureArchStrategyMap.put(ArchitectureType.ppc64, new PPC64Strategy()); architectureArchStrategyMap.put(ArchitectureType.s390x, new S390XStrategy()); + architectureArchStrategyMap.put(ArchitectureType.aarch64, new AARCH64Strategy()); } public static ArchStrategy getStrategy(ArchitectureType architecture) { diff --git a/backend/manager/modules/utils/src/main/javacc/org/ovirt/engine/core/utils/osinfo/osinfo.jj b/backend/manager/modules/utils/src/main/javacc/org/ovirt/engine/core/utils/osinfo/osinfo.jj index e0b30bf1255..f39135b0624 100644 --- a/backend/manager/modules/utils/src/main/javacc/org/ovirt/engine/core/utils/osinfo/osinfo.jj +++ b/backend/manager/modules/utils/src/main/javacc/org/ovirt/engine/core/utils/osinfo/osinfo.jj @@ -94,7 +94,7 @@ void booleanValue() : {} { } void archValue() : {} { - valueSpecifier() ("x86_64" | "ppc64" | "s390x") + valueSpecifier() ("x86_64" | "ppc64" | "s390x" | "aarch64") } void busValue() : {} { diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllers.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllers.java index e8b49ab0374..aac74cc4280 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllers.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllers.java @@ -43,4 +43,10 @@ public void runForS390X() { // For now same as on x86 runForX86_64(); } + + @Override + public void runForAARCH64() { + // For now same as on x86 + runForX86_64(); + } } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllersForDomainXml.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllersForDomainXml.java index 55b73ba8e1e..49a8eeb2432 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllersForDomainXml.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/CreateAdditionalControllersForDomainXml.java @@ -61,4 +61,10 @@ public void runForS390X() { // For now same as on x86 runForX86_64(); } + + @Override + public void runForAARCH64() { + // For now same as on x86 + runForX86_64(); + } } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetBootableDiskIndex.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetBootableDiskIndex.java index 7cbaf04d099..6608b9d14b6 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetBootableDiskIndex.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetBootableDiskIndex.java @@ -36,6 +36,15 @@ public void runForS390X() { diskIndex = 0; } + /** + * Note - Changes for aarch64. Assuming it is same as x86 + * CDROM is mapped to IDE, the index of first boot disk is 0 + */ + @Override + public void runForAARCH64() { + diskIndex = 0; + } + public int returnValue() { return diskIndex; } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetControllerIndices.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetControllerIndices.java index 30c289e546e..c939d95ff0e 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetControllerIndices.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/architecture/GetControllerIndices.java @@ -35,6 +35,12 @@ public void runForS390X() { runForX86_64(); } + @Override + public void runForAARCH64() { + // For now the same as x86 + runForX86_64(); + } + public Map returnValue() { return controllerIndexMap; } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/LibvirtVmXmlBuilder.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/LibvirtVmXmlBuilder.java index 7e0b260db0f..5407317c7aa 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/LibvirtVmXmlBuilder.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/LibvirtVmXmlBuilder.java @@ -436,6 +436,7 @@ void writeCpu(boolean addVmNumaNodes) { switch (vm.getClusterArch().getFamily()) { case x86: + case aarch64: case s390x: writer.writeAttributeString("match", "exact"); diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/VmInfoBuildUtils.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/VmInfoBuildUtils.java index 89fc347c431..92a1f43a4f6 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/VmInfoBuildUtils.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/VmInfoBuildUtils.java @@ -888,6 +888,8 @@ public String getEmulatedMachineByClusterArch(ArchitectureType arch) { case ppc64: case ppc64le: return "pseries"; + case aarch64: + return "virt"; case x86_64: default: return "pc"; diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/monitoring/VirtMonitoringStrategy.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/monitoring/VirtMonitoringStrategy.java index 6cf33f254c2..ca0d7997465 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/monitoring/VirtMonitoringStrategy.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/monitoring/VirtMonitoringStrategy.java @@ -252,7 +252,8 @@ private boolean hostEmulationModeMatchesTheConfigValues(VDS vds, Set sup String matchedI440fx = EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.I440FX, supported, available); String matchedQ35 = EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.Q35, supported, available); - String matchedEmulatedMachine = ClusterEmulatedMachines.build(matchedI440fx, matchedQ35); + String matchedAarch64 = EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.VIRT, supported, available); + String matchedEmulatedMachine = ClusterEmulatedMachines.build(matchedI440fx, matchedQ35, matchedAarch64); if (!StringUtils.isEmpty(matchedEmulatedMachine)) { setClusterEmulatedMachine(vds, matchedEmulatedMachine); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java index 990cddd1377..9fa2bd4968f 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/CommonApplicationConstants.java @@ -1955,6 +1955,8 @@ public interface CommonApplicationConstants extends Constants { String s390xChipset(); + String aarch64Chipset(); + String tpmDeviceLabel(); String typeToSearchPlaceHolder(); diff --git a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/renderer/BiosTypeRenderer.java b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/renderer/BiosTypeRenderer.java index 29368b6ef31..b2323dae6b0 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/renderer/BiosTypeRenderer.java +++ b/frontend/webadmin/modules/gwt-common/src/main/java/org/ovirt/engine/ui/common/widget/renderer/BiosTypeRenderer.java @@ -41,6 +41,8 @@ public String render(BiosType biosType) { return constants.ppcChipset(); } else if (ArchitectureType.s390x.equals(architectureType.getFamily())) { return constants.s390xChipset(); + } else if (ArchitectureType.aarch64.equals(architectureType.getFamily())) { + return constants.aarch64Chipset(); } } return super.render(biosType); diff --git a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/CommonApplicationConstants.properties b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/CommonApplicationConstants.properties index 4fa3182412d..9176a4a345b 100644 --- a/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/CommonApplicationConstants.properties +++ b/frontend/webadmin/modules/gwt-common/src/main/resources/org/ovirt/engine/ui/common/CommonApplicationConstants.properties @@ -978,6 +978,7 @@ vmCustomSerialNumber=Custom Serial Number k8s_namespace=K8s Namespace ppcChipset=pseries s390xChipset=zseries +aarch64Chipset=Ampere resetGridSettings=Reset settings changeColumnsVisibilityOrder=Change columns visibility/order typeToSearchPlaceHolder=Type to search diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java index 3298115c35e..494d6534e3c 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/HostModel.java @@ -1238,6 +1238,7 @@ public void resetKernelCmdlineCheckboxes() { switch (cpuVendor) { case INTEL: case AMD: + case ARM: case IBMS390: resetKernelCmdlineCheckboxesValue(); break; @@ -1258,6 +1259,7 @@ protected void updateKernelCmdlineCheckboxesChangeability() { switch (cpuVendor) { case INTEL: case AMD: + case ARM: case IBMS390: setKernelCmdlineCheckboxesChangeability( isKernelCmdlineParsable(), diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/KernelCmdlineUtil.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/KernelCmdlineUtil.java index 29387d29f16..81075dc02c8 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/KernelCmdlineUtil.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/hosts/KernelCmdlineUtil.java @@ -35,6 +35,7 @@ private static String getBlacklistNouveau(CpuVendor cpuVendor, boolean blacklist case IBM: return "rdblacklist=nouveau "; //$NON-NLS-1$ case IBMS390: + case ARM: return ""; default: throw new RuntimeException("Unknown CpuType: " + cpuVendor); //$NON-NLS-1$ @@ -52,6 +53,7 @@ private static String getIommu(CpuVendor cpuVendor, boolean iommu) { return "intel_iommu=on "; //$NON-NLS-1$ case IBM: case IBMS390: + case ARM: return ""; default: throw new RuntimeException("Unknown CpuType: " + cpuVendor); //$NON-NLS-1$ @@ -70,7 +72,8 @@ private static String getKvmNested(CpuVendor cpuVendor, boolean kvmNested) { case IBM: return ""; case IBMS390: - return "kvm.nested=1 "; //$NON-NLS-1$ + case ARM: + return "kvm.nested=1 "; //$NON-NLS-1$ default: throw new RuntimeException("Unknown CpuType: " + cpuVendor); //$NON-NLS-1$ } diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java index 80ead073063..ac2a3a04529 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ExistingVmModelBehavior.java @@ -124,6 +124,11 @@ public void initialize() { getModel().getIsHighlyAvailable().setIsChangeable(false); getModel().getIsHighlyAvailable().setChangeProhibitionReason(constants.noHaWhenHostedEngineUsed()); } + + // update HostCpu for aarch64 + if (clusterHasAarch64Architecture()) { + updateHostCpuAndMigrationForAarch64(); + } } private void loadDataCenter() { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java index de2ffa75207..07617deedf0 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/NewVmModelBehavior.java @@ -212,6 +212,10 @@ private void selectedTemplateChanged(final VmTemplate template) { setCustomCompatibilityVersionChangeInProgress(false); getInstanceTypeManager().updateInstanceTypeFieldsFromSource(); + // update HostCpu for aarch64 + if (clusterHasAarch64Architecture()) { + updateHostCpuAndMigrationForAarch64(); + } }); } @@ -249,6 +253,10 @@ public void postDataCenterWithClusterSelectedItemChanged() { updateTemplate(); activateInstanceTypeManager(); + // update HostCpu for aarch64 + if (clusterHasAarch64Architecture()) { + updateHostCpuAndMigrationForAarch64(); + } } private boolean profilesExist(List profiles) { diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java index e87f4d9e42a..84e44cb32c4 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/UnitVmModel.java @@ -2229,6 +2229,7 @@ public void eventRaised(Event ev, Object sender, EventArgs behavior.updateCustomCpu(); behavior.updateBiosType(); updateTscFrequency(); + updateUseHostCpuEnabled(); } else if (sender == getTemplateWithVersion()) { templateWithVersion_SelectedItemChanged(); } else if (sender == getInstanceTypes()) { @@ -2679,6 +2680,7 @@ private void dataCenterWithClusterSelectedItemChanged() { updateSoundCard(); updateResumeBehavior(); updateTpmEnabled(); + updateUseHostCpuEnabled(); getBehavior().updateOSValue(selectedOsId); @@ -4030,6 +4032,14 @@ private void updateTpmEnabled() { } } + private void updateUseHostCpuEnabled() { + Cluster cluster = getSelectedCluster(); + if (!(cluster == null) && cluster.getArchitecture().getFamily() == ArchitectureType.aarch64) { + getHostCpu().setEntity(true); + getHostCpu().setIsChangeable(false, constants.hosCPUUnavailable()); + } + } + protected void updateCpuPinningPolicy() { boolean defaultHostSelected = Boolean.FALSE.equals(getIsAutoAssign().getEntity()) && getDefaultHost().getSelectedItems() != null && diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java index 967ec1e2bd0..92ceec62e6c 100644 --- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java +++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/VmModelBehaviorBase.java @@ -148,6 +148,9 @@ protected void commonInitialize() { policies.add(0, null); getModel().getMigrationPolicies().setItems(policies); initializeBiosType(); + if (clusterHasAarch64Architecture()) { + updateHostCpuAndMigrationForAarch64(); + } } protected void initializeBiosType() { @@ -244,14 +247,15 @@ protected void updateMigrationForLocalSD() { if (isLocalSD) { getModel().getIsAutoAssign().setEntity(false); getModel().getMigrationMode().setSelectedItem(MigrationSupport.PINNED_TO_HOST); + } else { + getModel().getIsAutoAssign().setIsChangeable(!isLocalSD); + getModel().getMigrationMode().setIsChangeable(!isLocalSD); + getModel().getDefaultHost().setIsChangeable(!isLocalSD); } - getModel().getIsAutoAssign().setIsChangeable(!isLocalSD); - getModel().getMigrationMode().setIsChangeable(!isLocalSD); - getModel().getDefaultHost().setIsChangeable(!isLocalSD); } protected void buildModel(VmBase vmBase, - BuilderExecutor.BuilderExecutionFinished callback) { + BuilderExecutor.BuilderExecutionFinished callback) { } public void templateWithVersion_SelectedItemChanged() { @@ -268,6 +272,9 @@ public void postDataCenterWithClusterSelectedItemChanged() { updateVirtioScsiAvailability(); updateMemoryBalloon(); updateCustomPropertySheet(); + if (clusterHasAarch64Architecture()) { + updateHostCpuAndMigrationForAarch64(); + } } public abstract void defaultHost_SelectedItemChanged(); @@ -948,9 +955,12 @@ public void updateUseHostCpuAvailability() { } if (clusterSupportsHostCpu && !clusterHasPpcArchitecture() + && !clusterHasAarch64Architecture() && (Boolean.FALSE.equals(isAutoAssign) && numOfPinnedHosts > 0 || getModel().getVmType().getSelectedItem() == VmType.HighPerformance)) { getModel().getHostCpu().setIsChangeable(true); + } else if (clusterHasAarch64Architecture()) { + updateHostCpuAndMigrationForAarch64(); } else { getModel().getHostCpu().setEntity(false); getModel().getHostCpu().setIsChangeable(false); @@ -958,6 +968,24 @@ public void updateUseHostCpuAvailability() { } } + public void updateHostCpuAndMigrationForAarch64() { + // For aarch64 VM, hostpassthroygh is enabled by default + // Also, Hosts to run VM on is set to specific hosss + // And Migration mode is et to Automatic and manual migrations + + getModel().getIsAutoAssign().setEntity(true); + getModel().getIsAutoAssign().setIsChangeable(false); + getModel().getIsAutoAssign().setIsSelected(true); + getModel().getDefaultHost().setIsChangeable(false); + getModel().getDefaultHost().setIsSelected(false); + getModel().getHostCpu().setEntity(true); + getModel().getHostCpu().setIsSelected(true); + getModel().getHostCpu().setIsChangeable(false); + getModel().getHostCpu().setChangeProhibitionReason(constants.hosCPUUnavailable()); + //getModel().getMigrationMode().setSelectedItem(MigrationSupport.MIGRATABLE); + getModel().getMigrationMode().setIsChangeable(true); + } + protected boolean clusterHasPpcArchitecture() { Cluster cluster = getModel().getSelectedCluster(); @@ -966,6 +994,14 @@ protected boolean clusterHasPpcArchitecture() { && ArchitectureType.ppc == cluster.getArchitecture().getFamily(); } + protected boolean clusterHasAarch64Architecture() { + Cluster cluster = getModel().getSelectedCluster(); + + return cluster != null + && cluster.getArchitecture() != null + && ArchitectureType.aarch64 == cluster.getArchitecture().getFamily(); + } + public void updateCpuSharesAmountChangeability() { boolean changeable = getModel().getCpuSharesAmountSelection().getSelectedItem() == UnitVmModel.CpuSharesAmount.CUSTOM; diff --git a/packaging/conf/osinfo-defaults.properties b/packaging/conf/osinfo-defaults.properties index ec62691f59d..4a619ff44de 100644 --- a/packaging/conf/osinfo-defaults.properties +++ b/packaging/conf/osinfo-defaults.properties @@ -575,6 +575,57 @@ os.ubuntu_16_04_s390x.id.value = 2005 os.ubuntu_16_04_s390x.name.value = Ubuntu Xenial Xerus LTS+ os.ubuntu_16_04_s390x.derivedFrom.value = other_linux_s390x +# "Other OS" type to the aarch64 architecture +os.other_aarch64.id.value = 3001 +os.other_aarch64.name.value = Other OS +os.other_aarch64.derivedFrom.value = other +os.other_aarch64.resources.minimum.ram.value = 256 +os.other_aarch64.resources.maximum.ram.value = 65536 +os.other_aarch64.cpuArchitecture.value = aarch64 +os.other_aarch64.cpu.hotplugSupport.value = true +os.other_aarch64.cpu.hotunplugSupport.value = false +os.other_aarch64.devices.audio.enabled.value = false +os.other_aarch64.devices.network.value = pv +os.other_aarch64.devices.cdInterface.value = scsi +#os.other_aarch64.devices.balloon.enabled.value = true +os.other_aarch64.devices.diskInterfaces.value = VirtIO, VirtIO_SCSI +os.other_aarch64.devices.disk.hotpluggableInterfaces.value = VirtIO, VirtIO_SCSI +os.other_aarch64.devices.network.hotplugSupport.value = true +os.other_aarch64.devices.floppy.support.value = false +os.other_aarch64.devices.usb.controller.value = none + +# More OSes for aarch64 +# otherLinuxsaarch64(1002, OsType.Linux, false), +os.other_linux_aarch64.id.value = 3002 +os.other_linux_aarch64.name.value = Linux +os.other_linux_aarch64.derivedFrom.value = other_aarch64 +os.other_linux_aarch64.description.value = General GNU/Linux +os.other_linux_aarch64.family.value = linux + +# rhel7aarch64(1003, OsType.Linux, true), +os.rhel_7_aarch64.id.value = 3003 +os.rhel_7_aarch64.name.value = Red Hat Enterprise Linux 7.x +os.rhel_7_aarch64.derivedFrom.value = other_linux_aarch64 +os.rhel_7_aarch64.devices.memoryHotplug.specialBlock.value = true +os.rhel_7_aarch64.devices.tpm.value = supported + +# rhel8aarch64(1003, OsType.Linux, true), +os.rhel_8_aarch64.id.value = 3004 +os.rhel_8_aarch64.name.value = Red Hat Enterprise Linux 8.x +os.rhel_8_aarch64.derivedFrom.value = other_linux_aarch64 +os.rhel_8_aarch64.devices.memoryHotplug.specialBlock.value = true +os.rhel_8_aarch64.devices.tpm.value = supported + +# Susesaarch64 +os.sles_12_aarch64.id.value = 3005 +os.sles_12_aarch64.name.value = SUSE Linux Enterprise Server 12 +os.sles_12_aarch64.derivedFrom.value = other_linux_aarch64 + +# Ubuntuaarch64 +os.ubuntu_16_04_aarch64.id.value = 3006 +os.ubuntu_16_04_aarch64.name.value = Ubuntu Xenial Xerus LTS+ +os.ubuntu_16_04_aarch64.derivedFrom.value = other_linux_aarch64 + # Backward Compatibility Section # Keep a mapping of the old os unique names to new od IDs # in order to support correct imports of pre-osinfo VMs diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql index ac1f5996a57..1611329d14b 100644 --- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql @@ -577,7 +577,8 @@ select fn_db_add_config_value('ServerCPUList', || '1:IBM z114, z196:sie,model_z196-base:z196-base:s390x; ' || '2:IBM zBC12, zEC12:sie,model_zEC12-base:zEC12-base:s390x; ' || '3:IBM z13s, z13:sie,model_z13-base:z13-base:s390x; ' - || '4:IBM z14:sie,model_z14-base:z14-base:s390x;', + || '4:IBM z14:sie,model_z14-base:z14-base:s390x;' + || '1:ARM :virt_aarch64,model_virt_aarch64:ARM:aarch64;', '4.7'); select fn_db_add_config_value('ServerCPUList', @@ -1151,6 +1152,8 @@ select fn_db_update_config_value('ClusterEmulatedMachines','pc-i440fx-rhel7.6.0, -- both chipsets and ClusterEmulatedMachines list also should contain values for both of them. select fn_db_update_config_value('ClusterEmulatedMachines','pc-q35-rhel8.1.0,pc-q35-4.1,pc-i440fx-rhel7.6.0,pc-i440fx-2.12,pseries-rhel8.1.0,s390-ccw-virtio-2.12','4.4'); select fn_db_update_config_value('ClusterEmulatedMachines','pc-q35-rhel8.3.0,pc-q35-4.1,pc-i440fx-rhel7.6.0,pc-i440fx-2.12,pseries-rhel8.3.0,s390-ccw-virtio-2.12','4.5'); +-- aarch64 emulated machine types +select fn_db_update_config_value('ClusterEmulatedMachines','pc-q35-rhel8.6.0,pc-q35-4.1,pc-i440fx-rhel7.6.0,pc-i440fx-2.12,pseries-rhel8.4.0,s390-ccw-virtio-2.12,virt,virt-6.0,virt-6.1,virt-6.2','4.7'); select fn_db_update_config_value('SpiceDriverNameInGuest','{"windows": "RHEV-Spice", "linux" : "xorg-x11-drv-qxl" }','general'); select fn_db_update_config_value('SupportedClusterLevels','4.2,4.3,4.4,4.5,4.6,4.7,4.8','general'); select fn_db_update_config_value('SupportedVDSMVersions','4.20,4.30,4.40,4.50','general'); @@ -1171,10 +1174,15 @@ select fn_db_update_config_value('AllowEditingHostedEngine','true','general'); select fn_db_update_config_value('IsMigrationSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true"}','4.2'); select fn_db_update_config_value('IsMemorySnapshotSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true"}','4.2'); select fn_db_update_config_value('IsSuspendSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true"}','4.2'); +select fn_db_update_config_value('IsMigrationSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true", "aarch64" : "true"}','4.7'); +select fn_db_update_config_value('IsMemorySnapshotSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true", "aarch64" : "true"}','4.7'); +select fn_db_update_config_value('IsSuspendSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true", "aarch64" : "true"}','4.7'); -- s390x architecture support select fn_db_update_config_value('HotPlugCpuSupported', '{"x86":"true","ppc":"true","s390x":"true"}', '4.2'); select fn_db_update_config_value('HotUnplugCpuSupported', '{"x86":"true","ppc":"true","s390x":"false"}', '4.2'); +-- aarch64 architecture support +select fn_db_update_config_value('HotPlugCpuSupported', '{"x86":"true","ppc":"true","s390x":"true", "aarch64" : "true"}', '4.7'); +select fn_db_update_config_value('HotUnplugCpuSupported', '{"x86":"true","ppc":"true","s390x":"false","aarch64" : "true"}', '4.7'); select fn_db_update_config_value('PredefinedVMProperties', 'sap_agent=^(true|false)$;sndbuf=^[0-9]+$;vhost=^(([a-zA-Z0-9_]*):(true|false))(,(([a-zA-Z0-9_]*):(true|false)))*$;viodiskcache=^(none|writeback|writethrough)$;hugepages=^[0-9]+$', '4.2'); select fn_db_update_config_value('PredefinedVMProperties', 'sap_agent=^(true|false)$;sndbuf=^[0-9]+$;vhost=^(([a-zA-Z0-9_]*):(true|false))(,(([a-zA-Z0-9_]*):(true|false)))*$;viodiskcache=^(none|writeback|writethrough)$;hugepages=^[0-9]+$', '4.3'); @@ -1183,6 +1191,10 @@ select fn_db_update_config_value_for_versions_from_up_to('PredefinedVMProperties select fn_db_update_config_value('HotPlugMemorySupported','{"x86":"true","ppc":"true","s390x":"false"}', '4.2'); select fn_db_update_config_value('HotUnplugMemorySupported','{"x86":"true","ppc":"true","s390x":"false"}','4.2'); +-- aarch64 architecture support +select fn_db_update_config_value('HotPlugMemorySupported','{"x86":"true","ppc":"true","s390x":"false","aarch64":"true"}', '4.7'); +select fn_db_update_config_value('HotUnplugMemorySupported','{"x86":"true","ppc":"true","s390x":"false","aarch64":"true"}','4.7'); + select fn_db_update_config_value_for_versions_from_up_to('MaxNumOfVmCpus', '{"x86":384,"ppc":384,"s390x":384}', '4.2', '4.4'); select fn_db_update_config_value('MaxNumOfVmCpus', '{"x86":512,"ppc":384,"s390x":384}', '4.5'); select fn_db_update_config_value('MaxNumOfVmCpus', '{"x86":710,"ppc":384,"s390x":384}', '4.6'); @@ -1397,7 +1409,8 @@ select fn_db_update_config_value('ServerCPUList', || '1:IBM z114, z196:sie,model_z196-base:z196-base:s390x; ' || '2:IBM zBC12, zEC12:sie,model_zEC12-base:zEC12-base:s390x; ' || '3:IBM z13s, z13:sie,model_z13-base:z13-base:s390x; ' - || '4:IBM z14:sie,model_z14-base:z14-base:s390x;', + || '4:IBM z14:sie,model_z14-base:z14-base:s390x;' + || '1:ARM :virt_aarch64,model_virt_aarch64:ARM:aarch64;', '4.7'); select fn_db_update_config_value('ServerCPUList', '1:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; ' @@ -1437,7 +1450,8 @@ select fn_db_update_config_value('ServerCPUList', || '1:IBM z114, z196:sie,model_z196-base:z196-base:s390x; ' || '2:IBM zBC12, zEC12:sie,model_zEC12-base:zEC12-base:s390x; ' || '3:IBM z13s, z13:sie,model_z13-base:z13-base:s390x; ' - || '4:IBM z14:sie,model_z14-base:z14-base:s390x;', + || '4:IBM z14:sie,model_z14-base:z14-base:s390x;' + || '1:ARM :virt_aarch64,model_virt_aarch64:ARM:aarch64;', '4.8'); -- qemu-guest-agent is also a viable agent select fn_db_update_config_value('AgentAppName','ovirt-guest-agent-common,ovirt-guest-agent,qemu-guest-agent','general');