diff --git a/0001-add-dependent-package-to-lib.patch b/0001-add-dependent-package-to-lib.patch index 088e0cd..9aad4ed 100644 --- a/0001-add-dependent-package-to-lib.patch +++ b/0001-add-dependent-package-to-lib.patch @@ -1,21 +1,23 @@ -From c26b3207515396163d30dfcfff4c1b2d51e3b7d0 Mon Sep 17 00:00:00 2001 -From: tmp -Date: Tue, 14 Sep 2021 19:50:06 +0800 +From 24785efaa96c6e57a07738538ad8946a28bccb5b Mon Sep 17 00:00:00 2001 +From: wangge +Date: Sun, 26 Sep 2021 11:19:33 +0800 Subject: [PATCH] add dependent package to lib --- - backend/manager/modules/utils/pom.xml | 24 ++++++++++++++++++++++++ - backend/pom.xml | 24 ++++++++++++++++++++++++ - 2 files changed, 48 insertions(+) + backend/manager/modules/utils/pom.xml | 26 ++++++++++++++++++++++- + backend/pom.xml | 30 +++++++++++++++++++++++++++ + 2 files changed, 55 insertions(+), 1 deletion(-) diff --git a/backend/manager/modules/utils/pom.xml b/backend/manager/modules/utils/pom.xml -index dc6f6ca..163d31d 100644 +index 505d367..19cc06a 100644 --- a/backend/manager/modules/utils/pom.xml +++ b/backend/manager/modules/utils/pom.xml -@@ -167,6 +167,30 @@ +@@ -166,7 +166,31 @@ + - +- ++ + + + org.apache.maven.plugins @@ -44,10 +46,10 @@ index dc6f6ca..163d31d 100644 diff --git a/backend/pom.xml b/backend/pom.xml -index 996f4e8..6b77fdd 100644 +index 2bac37b..bc57848 100644 --- a/backend/pom.xml +++ b/backend/pom.xml -@@ -47,6 +47,30 @@ +@@ -47,6 +47,36 @@ true @@ -61,7 +63,7 @@ index 996f4e8..6b77fdd 100644 + + copy + -+ package ++ package + + + @@ -69,7 +71,13 @@ index 996f4e8..6b77fdd 100644 + sshd-core + ${sshd-core.version} + ${project.build.directory}/lib -+ ++ ++ ++ org.apache.sshd ++ sshd-common ++ ${sshd-core.version} ++ ${project.build.directory}/lib ++ + + + diff --git a/0002-add-support-running-on-kunpeng-platform.patch b/0002-add-support-running-on-kunpeng-platform.patch new file mode 100644 index 0000000..bf87248 --- /dev/null +++ b/0002-add-support-running-on-kunpeng-platform.patch @@ -0,0 +1,1106 @@ +From 54b2b3b9c3a3b6ecb1da09735a4da2c6644588c7 Mon Sep 17 00:00:00 2001 +From: wangge +Date: Tue, 28 Sep 2021 16:42:15 +0800 +Subject: [PATCH 1/2] add support running on kunpeng platform + +--- + automation/build-artifacts.sh | 3 +- + .../ovirt/engine/core/bll/AddVmCommand.java | 3 +- + .../core/bll/ClusterOperationCommandBase.java | 2 + + .../core/bll/CpuFlagsManagerHandler.java | 41 ++++++- + .../ovirt/engine/core/bll/RunVmCommand.java | 3 +- + .../engine/core/bll/UpdateVmCommand.java | 3 +- + .../architecture/HasMaximumNumberOfDisks.java | 5 + + .../cluster/KubevirtProviderProxy.java | 6 +- + .../core/bll/validator/ClusterValidator.java | 3 +- + .../businessentities/ArchitectureType.java | 5 + + .../common/businessentities/BiosType.java | 3 +- + .../common/businessentities/ChipsetType.java | 3 +- + .../core/common/config/ConfigValues.java | 3 + + .../core/common/osinfo/OsRepository.java | 1 + + .../engine/core/common/utils/CpuVendor.java | 3 +- + .../core/common/utils/VmCommonUtils.java | 6 +- + .../core/common/utils/VmCpuCountHelper.java | 4 +- + .../src/main/resources/v3/capabilities.xml | 8 ++ + .../engine/api/restapi/types/CPUMapper.java | 4 + + .../engine/core/utils/OsRepositoryImpl.java | 3 +- + .../org/ovirt/engine/core/utils/OvfUtils.java | 3 +- + .../utils/archstrategy/Aarch64Strategy.java | 18 +++ + .../core/utils/archstrategy/ArchCommand.java | 2 + + .../archstrategy/ArchStrategyFactory.java | 1 + + .../engine/core/utils/ovf/OvfOvaWriter.java | 1 + + .../ovirt/engine/core/utils/osinfo/osinfo.jj | 4 +- + .../CreateAdditionalControllers.java | 5 + + ...eateAdditionalControllersForDomainXml.java | 5 + + .../architecture/GetBootableDiskIndex.java | 5 + + .../architecture/GetControllerIndices.java | 6 + + .../builder/vminfo/LibvirtVmXmlBuilder.java | 111 ++++++++++++------ + .../builder/vminfo/VmInfoBuildUtils.java | 2 + + .../dataprovider/AsyncDataProvider.java | 11 +- + .../uicommonweb/models/hosts/HostModel.java | 2 + + .../models/vms/ImportVmFromOvaModel.java | 2 +- + .../column/ClusterAdditionalStatusColumn.java | 3 +- + packaging/conf/osinfo-defaults.properties | 19 +++ + ...eral_version_of_nongeneral_vdc_options.sql | 1 + + .../upgrade/pre_upgrade/0000_config.sql | 21 ++-- + .../engine_common/constants.py | 1 + + 41 files changed, 264 insertions(+), 71 deletions(-) + create mode 100644 backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/archstrategy/Aarch64Strategy.java + +diff --git a/automation/build-artifacts.sh b/automation/build-artifacts.sh +index b830c5d..7f60f5f 100755 +--- a/automation/build-artifacts.sh ++++ b/automation/build-artifacts.sh +@@ -19,7 +19,8 @@ export MAVEN_OPTS + + if [ -d /root/.m2/repository/org/ovirt ]; then + echo "Deleting ovirt folder from maven cache" +- rm -rf /root/.m2/repository/org/ovirt ++# Do not delete the existing packages for now,you can directly use the compiled ovirt-engine-api and other related jar packages ++# rm -rf /root/.m2/repository/org/ovirt + fi + + MAVEN_SETTINGS="/etc/maven/settings.xml" +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 1db572d..0dd46d7 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 +@@ -830,7 +830,8 @@ public class AddVmCommand extends VmManagementCommand + && vmFromParams.getCustomBiosType() != BiosType.CLUSTER_DEFAULT + && vmFromParams.getCustomBiosType() != BiosType.I440FX_SEA_BIOS + && getCluster().getArchitecture() != ArchitectureType.undefined +- && getCluster().getArchitecture().getFamily() != ArchitectureType.x86) { ++ && getCluster().getArchitecture().getFamily() != ArchitectureType.x86 ++ && getCluster().getArchitecture().getFamily() != ArchitectureType.aarch64) { + 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/ClusterOperationCommandBase.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/ClusterOperationCommandBase.java +index 1fd05a0..6f05339 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 +@@ -181,6 +181,8 @@ public abstract class ClusterOperationCommandBase amdCpuList; + private List ibmCpuList; + private List s390CpuList; ++ private List kunpengCpuList; + 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 kunpengCpuByNameDictionary = new HashMap<>(); + private Map intelCpuByVdsNameDictionary = new HashMap<>(); + private Map amdCpuByVdsNameDictionary = new HashMap<>(); + private Map ibmCpuByVdsNameDictionary = new HashMap<>(); + private Map s390CpuByVdsNameDictionary = new HashMap<>(); ++ private Map kunpengCpuByVdsNameDictionary = new HashMap<>(); + + public CpuFlagsManager(Version ver) { + initDictionaries(ver); +@@ -200,6 +203,8 @@ public class CpuFlagsManagerHandler implements BackendService { + result = CpuVendor.IBM.name(); + } else if (s390CpuByNameDictionary.get(cpuName) != null) { + result = CpuVendor.IBMS390.name(); ++ } else if (kunpengCpuByNameDictionary.get(cpuName) != null) { ++ result = CpuVendor.KUNPENG.name(); + } + } + return result; +@@ -222,6 +227,10 @@ public class CpuFlagsManagerHandler implements BackendService { + if (result == null) { + result = s390CpuByNameDictionary.get(cpuName); + } ++ ++ if (result == null) { ++ result = kunpengCpuByNameDictionary.get(cpuName); ++ } + } + return result; + } +@@ -233,6 +242,7 @@ public class CpuFlagsManagerHandler implements BackendService { + amdCpuByNameDictionary.clear(); + ibmCpuByNameDictionary.clear(); + s390CpuByNameDictionary.clear(); ++ kunpengCpuByNameDictionary.clear(); + allCpuList.clear(); + + String[] cpus = Config. getValue(ConfigValues.ServerCPUList, ver.toString()).trim().split("[;]", -1); +@@ -271,6 +281,9 @@ public class CpuFlagsManagerHandler implements BackendService { + } else if (sc.getFlags().contains(CpuVendor.IBMS390.getFlag())) { + s390CpuByNameDictionary.put(sc.getCpuName(), sc); + s390CpuByVdsNameDictionary.put(sc.getVdsVerbData(), sc); ++ } else if (sc.getFlags().contains(CpuVendor.KUNPENG.getFlag())) { ++ kunpengCpuByNameDictionary.put(sc.getCpuName(), sc); ++ kunpengCpuByVdsNameDictionary.put(sc.getVdsVerbData(), sc); + } + + allCpuList.add(sc); +@@ -283,6 +296,7 @@ public class CpuFlagsManagerHandler implements BackendService { + amdCpuList = new ArrayList<>(amdCpuByNameDictionary.values()); + ibmCpuList = new ArrayList<>(ibmCpuByNameDictionary.values()); + s390CpuList = new ArrayList<>(s390CpuByNameDictionary.values()); ++ kunpengCpuList = new ArrayList<>(kunpengCpuByNameDictionary.values()); + + Comparator cpuComparator = Comparator.comparingInt(ServerCpu::getLevel); + +@@ -292,6 +306,7 @@ public class CpuFlagsManagerHandler implements BackendService { + Collections.sort(amdCpuList, cpuComparator); + Collections.sort(ibmCpuList, cpuComparator); + Collections.sort(s390CpuList, cpuComparator); ++ Collections.sort(kunpengCpuList, cpuComparator); + } + + public String getVDSVerbDataByCpuName(String name) { +@@ -301,7 +316,8 @@ public class CpuFlagsManagerHandler implements BackendService { + 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 = kunpengCpuByNameDictionary.get(name)) != null) { + result = sc.getVdsVerbData(); + } + } +@@ -315,7 +331,8 @@ public class CpuFlagsManagerHandler implements BackendService { + 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 = kunpengCpuByVdsNameDictionary.get(vdsName)) != null) { + result = sc.getCpuName(); + } + } +@@ -346,6 +363,7 @@ public class CpuFlagsManagerHandler implements BackendService { + || (clusterCpu = amdCpuByNameDictionary.get(clusterCpuName)) != null + || (clusterCpu = ibmCpuByNameDictionary.get(clusterCpuName)) != null + || (clusterCpu = s390CpuByNameDictionary.get(clusterCpuName)) != null ++ || (clusterCpu = kunpengCpuByNameDictionary.get(clusterCpuName)) != null + )) { + for (String flag : clusterCpu.getFlags()) { + if (!lstServerflags.contains(flag)) { +@@ -393,6 +411,10 @@ public class CpuFlagsManagerHandler implements BackendService { + return s390CpuByNameDictionary.containsKey(cpuName2); + } + ++ if (kunpengCpuByNameDictionary.containsKey(cpuName1)) { ++ return kunpengCpuByNameDictionary.containsKey(cpuName2); ++ } ++ + return false; + } + +@@ -401,7 +423,8 @@ public class CpuFlagsManagerHandler implements BackendService { + && (intelCpuByNameDictionary.containsKey(cpuName) + || amdCpuByNameDictionary.containsKey(cpuName) + || ibmCpuByNameDictionary.containsKey(cpuName) +- || s390CpuByNameDictionary.containsKey(cpuName)); ++ || s390CpuByNameDictionary.containsKey(cpuName) ++ || kunpengCpuByNameDictionary.containsKey(cpuName)); + } + + /** +@@ -441,6 +464,12 @@ public class CpuFlagsManagerHandler implements BackendService { + foundCpus.add(s390CpuList.get(i)); + } + } ++ } else if (lstFlags.contains(CpuVendor.KUNPENG.getFlag())) { ++ for (int i = kunpengCpuList.size() - 1; i >= 0; i--) { ++ if (checkIfFlagsContainsCpuFlags(kunpengCpuList.get(i), lstFlags)) { ++ foundCpus.add(kunpengCpuList.get(i)); ++ } ++ } + } + return foundCpus; + } +@@ -478,6 +507,12 @@ public class CpuFlagsManagerHandler implements BackendService { + for (int i = 0; i <= selectedCpuIndex; i++) { + supportedCpus.add(s390CpuList.get(i)); + } ++ } else if (kunpengCpuByNameDictionary.containsKey(maxCpuName)) { ++ ServerCpu selected = kunpengCpuByNameDictionary.get(maxCpuName); ++ int selectedCpuIndex = kunpengCpuList.indexOf(selected); ++ for (int i = 0; i <= selectedCpuIndex; i++) { ++ supportedCpus.add(kunpengCpuList.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 11155e4..7782b90 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 +@@ -1133,7 +1133,8 @@ public class RunVmCommand extends RunVmCommandBase + if (FeatureSupported.isBiosTypeSupported(getCluster().getCompatibilityVersion()) + && getVm().getCustomBiosType() != BiosType.CLUSTER_DEFAULT + && getVm().getCustomBiosType() != BiosType.I440FX_SEA_BIOS +- && getCluster().getArchitecture().getFamily() != ArchitectureType.x86) { ++ && getCluster().getArchitecture().getFamily() != ArchitectureType.x86 ++ && getCluster().getArchitecture().getFamily() != ArchitectureType.aarch64) { + 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/UpdateVmCommand.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/UpdateVmCommand.java +index 05b5a87..b131326 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 +@@ -1339,7 +1339,8 @@ public class UpdateVmCommand extends VmMan + && vmFromParams.getCustomBiosType() != BiosType.CLUSTER_DEFAULT + && vmFromParams.getCustomBiosType() != BiosType.I440FX_SEA_BIOS + && getCluster().getArchitecture() != ArchitectureType.undefined +- && getCluster().getArchitecture().getFamily() != ArchitectureType.x86) { ++ && getCluster().getArchitecture().getFamily() != ArchitectureType.x86 ++ && getCluster().getArchitecture().getFamily() != ArchitectureType.aarch64) { + 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/architecture/HasMaximumNumberOfDisks.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/architecture/HasMaximumNumberOfDisks.java +index fd0afd7..9812295 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 class HasMaximumNumberOfDisks implements ArchCommand { + hasMaximum = VmCommand.MAX_VIRTIO_CCW_DISKS == countDisks(DiskInterface.VirtIO); + } + ++ @Override ++ public void runForAarch64() { ++ hasMaximum = VmCommand.MAX_VIRTIO_CCW_DISKS == countDisks(DiskInterface.VirtIO); ++ } ++ + public boolean returnValue() { + return hasMaximum; + } +diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/cluster/KubevirtProviderProxy.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/cluster/KubevirtProviderProxy.java +index 7f048b4..1773be7 100644 +--- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/cluster/KubevirtProviderProxy.java ++++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/provider/cluster/KubevirtProviderProxy.java +@@ -173,8 +173,10 @@ public class KubevirtProviderProxy implements ProviderProxy valueToArchitecture = +@@ -64,6 +67,8 @@ public enum ArchitectureType implements Identifiable { + return HOTPLUG_MEMORY_FACTOR_X86_MB; + case ppc: + return HOTPLUG_MEMORY_FACTOR_PPC_MB; ++ case aarch64: ++ return HOTPLUG_MEMORY_FACTOR_AARCH64_MB; + default: + return getFamily().getHotplugMemorySizeFactorMb(); + } +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 a72352c..bd696dd 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 +@@ -20,7 +20,8 @@ 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), ++ VIRT_OVMF(5, 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 26588ba..7b77fe0 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 @@ package org.ovirt.engine.core.common.businessentities; + public enum ChipsetType { + + I440FX("i440fx"), +- Q35("q35"); ++ Q35("q35"), ++ VIRT("virt"); + + private String chipsetName; + +diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +index 6de8d47..19f2e91 100644 +--- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java ++++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/config/ConfigValues.java +@@ -1431,6 +1431,9 @@ public enum ConfigValues { + @TypeConverterAttribute(Integer.class) + VMPpc64BitMaxMemorySizeInMB(ClientAccessLevel.User), + ++ @TypeConverterAttribute(Integer.class) ++ VMAarch64BitMaxMemorySizeInMB(ClientAccessLevel.User), ++ + @TypeConverterAttribute(Boolean.class) + AutoImportHostedEngine, + +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 523df02..63605f2 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 +@@ -22,6 +22,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/CpuVendor.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/CpuVendor.java +index 66bde41..09909ff 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"), ++ KUNPENG("asimd"); + + private final String flag; + +diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java +index 34d5168..cc73d5c 100644 +--- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java ++++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCommonUtils.java +@@ -78,9 +78,11 @@ public class VmCommonUtils { + private static ConfigValues getMaxMemConfigValueByOsId(int osId) { + OsRepository osRepository = SimpleDependencyInjector.getInstance().get(OsRepository.class); + return osRepository.get64bitOss().contains(osId) +- ? (osRepository.getOsArchitectures().get(osId).getFamily() == ArchitectureType.ppc ++ ? ((osRepository.getOsArchitectures().get(osId).getFamily() == ArchitectureType.aarch64) ++ ? ConfigValues.VMAarch64BitMaxMemorySizeInMB ++ : (osRepository.getOsArchitectures().get(osId).getFamily() == ArchitectureType.ppc + ? ConfigValues.VMPpc64BitMaxMemorySizeInMB +- : ConfigValues.VM64BitMaxMemorySizeInMB) ++ : ConfigValues.VM64BitMaxMemorySizeInMB)) + : ConfigValues.VM32BitMaxMemorySizeInMB; + } + +diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCpuCountHelper.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCpuCountHelper.java +index ca1f77d..97c375b 100644 +--- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCpuCountHelper.java ++++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VmCpuCountHelper.java +@@ -25,7 +25,7 @@ public class VmCpuCountHelper { + + static Integer calcMaxVCpu(ArchitectureType architecture, Integer maxSockets, Integer maxVCpus, + int threadsPerCore, int cpuPerSocket) { +- if (architecture == null || architecture == ArchitectureType.x86) { ++ if (architecture == null || architecture == ArchitectureType.x86 || architecture == ArchitectureType.aarch64) { + // As described in https://bugzilla.redhat.com/1406243#c13, the + // maximum number of vCPUs is limited by thread and core numbers on + // x86, to fit into an 8-bit APIC ID value organized by certain +@@ -114,7 +114,7 @@ public class VmCpuCountHelper { + */ + public static boolean validateCpuCounts(VM vm) { + ArchitectureType architecture = architectureFamily(vm); +- if (architecture == null || architecture == ArchitectureType.x86) { ++ if (architecture == null || architecture == ArchitectureType.x86 || architecture == ArchitectureType.aarch64) { + return bitWidth(vm.getThreadsPerCpu()) + bitWidth(vm.getCpuPerSocket()) <= maxBitWidth; + } + return true; +diff --git a/backend/manager/modules/restapi/jaxrs/src/main/resources/v3/capabilities.xml b/backend/manager/modules/restapi/jaxrs/src/main/resources/v3/capabilities.xml +index 0501810..1dffa6c 100644 +--- a/backend/manager/modules/restapi/jaxrs/src/main/resources/v3/capabilities.xml ++++ b/backend/manager/modules/restapi/jaxrs/src/main/resources/v3/capabilities.xml +@@ -366,6 +366,10 @@ + 3 + PPC64 + ++ ++ 3 ++ AARCH64 ++ + + + +@@ -545,6 +549,7 @@ + ubuntu_13_04 + ubuntu_12_10 + windows_7x64 ++ other_aarch64 + + + cow +@@ -1237,18 +1242,21 @@ + undefined + x86_64 + ppc64 ++ aarch64 + + + memory snapshot + undefined + x86_64 + ppc64 ++ aarch64 + + + suspend + undefined + x86_64 + ppc64 ++ aarch64 + + + +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 422595f..ce33104 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 class CPUMapper { + return ArchitectureType.ppc64; + case S390X: + return ArchitectureType.s390x; ++ case AARCH64: ++ return ArchitectureType.aarch64; + default: + return null; + } +@@ -52,6 +54,8 @@ public class CPUMapper { + 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 251ff83..956fc6c 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 +@@ -49,12 +49,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/OvfUtils.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OvfUtils.java +index b960cb9..cda5a53 100644 +--- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OvfUtils.java ++++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/OvfUtils.java +@@ -300,7 +300,8 @@ public class OvfUtils { + String value = section.attributes.get("xsi:type").getValue(); + + if (value.equals("ovf:OperatingSystemSection_Type")) { +- selectedSection = section; ++ XmlNode nodeDescription = section.selectSingleNode("Description"); ++ selectedSection = nodeDescription; + break; + } + } +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 0000000..33dabb1 +--- /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 c35bb52..4f1cdda 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 eddd753..d5ae95b 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/java/org/ovirt/engine/core/utils/ovf/OvfOvaWriter.java b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfOvaWriter.java +index c0ae977..0f15f69 100644 +--- a/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfOvaWriter.java ++++ b/backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/ovf/OvfOvaWriter.java +@@ -164,6 +164,7 @@ public abstract class OvfOvaWriter extends OvfWriter { + return 80; // RHEL x64 + case 1001: + case 2001: ++ case 3001: + default: + return 1; // Other + } +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 ca11993..55a66ca 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 +@@ -92,7 +92,7 @@ void booleanValue() : {} { + } + + void archValue() : {} { +- valueSpecifier() ("x86_64" | "ppc64" | "s390x") ++ valueSpecifier() ("x86_64" | "ppc64" | "s390x" | "aarch64") + } + + void busValue() : {} { +@@ -192,7 +192,7 @@ void valueSpecifier() : {} { + > + | < CHIPSET_TYPE + : +- ("i440fx" | "q35") ++ ("i440fx" | "q35" | "virt") + > + | < CD_INTERFACE_TYPE + : +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 e8b49ab..2d4511e 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,9 @@ public class CreateAdditionalControllers implements ArchCommand { + // 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 55b73ba..b06514c 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,9 @@ public class CreateAdditionalControllersForDomainXml implements ArchCommand { + // 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 7cbaf04..69a6bd3 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,11 @@ public class GetBootableDiskIndex implements ArchCommand { + diskIndex = 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 30c289e..086f2ed 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 class GetControllerIndices implements ArchCommand { + 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 129816c..cbf5c9e 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 +@@ -410,7 +410,7 @@ public class LibvirtVmXmlBuilder { + writer.writeStartElement("cpu"); + + String cpuType = vm.getCpuName(); +- if (vm.isUseHostCpuFlags()){ ++ if (vm.isUseHostCpuFlags() || vm.getClusterArch().getFamily() == ArchitectureType.aarch64){ + cpuType = "hostPassthrough"; + } + if (vm.getUseTscFrequency() && tscFrequencySupplier.get() != null) { +@@ -430,6 +430,7 @@ public class LibvirtVmXmlBuilder { + switch(vm.getClusterArch().getFamily()) { + case x86: + case s390x: ++ case aarch64: + writer.writeAttributeString("match", "exact"); + + // is this a list of strings??.. +@@ -690,13 +691,21 @@ public class LibvirtVmXmlBuilder { + boolean secureBoot = vm.getEffectiveBiosType() == BiosType.Q35_SECURE_BOOT; + writer.writeAttributeString("secure", secureBoot ? "yes" : "no"); + writer.writeAttributeString("type", "pflash"); +- writer.writeRaw("/usr/share/OVMF/OVMF_CODE.secboot.fd"); ++ if (vm.getClusterArch().getFamily() == ArchitectureType.aarch64) { ++ writer.writeRaw("/usr/share/AAVMF/AAVMF_CODE.fd"); ++ } else { ++ writer.writeRaw("/usr/share/OVMF/OVMF_CODE.secboot.fd"); ++ } + writer.writeEndElement(); + writer.writeStartElement("nvram"); + String nvramTemplate = vmCustomProperties.get("nvram_template"); + if (nvramTemplate == null) { +- nvramTemplate = String.format("/usr/share/OVMF/%s", ++ if(vm.getClusterArch().getFamily() == ArchitectureType.aarch64){ ++ nvramTemplate = "/usr/share/AAVMF/AAVMF_CODE.fd"; ++ } else { ++ nvramTemplate = String.format("/usr/share/OVMF/%s", + secureBoot ? "OVMF_VARS.secboot.fd" : "OVMF_VARS.fd"); ++ } + } + writer.writeAttributeString("template", nvramTemplate); + writer.writeRaw(String.format("/var/lib/libvirt/qemu/nvram/%s.fd", vm.getId())); +@@ -729,8 +738,12 @@ public class LibvirtVmXmlBuilder { + // + // + writer.writeStartElement("clock"); +- writer.writeAttributeString("offset", "variable"); +- writer.writeAttributeString("adjustment", String.valueOf(vmInfoBuildUtils.getVmTimeZone(vm))); ++ if (vm.getClusterArch().getFamily() == ArchitectureType.aarch64) { ++ writer.writeAttributeString("offset", "utc"); ++ } else { ++ writer.writeAttributeString("offset", "variable"); ++ writer.writeAttributeString("adjustment", String.valueOf(vmInfoBuildUtils.getVmTimeZone(vm))); ++ } + + if (hypervEnabled) { + writer.writeStartElement("timer"); +@@ -738,16 +751,16 @@ public class LibvirtVmXmlBuilder { + writer.writeAttributeString("present", "yes"); + writer.writeEndElement(); + } +- +- writer.writeStartElement("timer"); +- writer.writeAttributeString("name", "rtc"); +- writer.writeAttributeString("tickpolicy", "catchup"); +- writer.writeEndElement(); +- +- writer.writeStartElement("timer"); +- writer.writeAttributeString("name", "pit"); +- writer.writeAttributeString("tickpolicy", "delay"); +- writer.writeEndElement(); ++ if(vm.getClusterArch().getFamily() != ArchitectureType.aarch64) { ++ writer.writeStartElement("timer"); ++ writer.writeAttributeString("name", "rtc"); ++ writer.writeAttributeString("tickpolicy", "catchup"); ++ writer.writeEndElement(); ++ writer.writeStartElement("timer"); ++ writer.writeAttributeString("name", "pit"); ++ writer.writeAttributeString("tickpolicy", "delay"); ++ writer.writeEndElement(); ++ } + + if (vm.getClusterArch().getFamily() == ArchitectureType.x86) { + writer.writeStartElement("timer"); +@@ -767,7 +780,8 @@ public class LibvirtVmXmlBuilder { + } + + private void writeFeatures() { +- if (vm.getClusterArch().getFamily() != ArchitectureType.x86) { ++ if (vm.getClusterArch().getFamily() != ArchitectureType.x86 && ++ vm.getClusterArch().getFamily() != ArchitectureType.aarch64) { + return; + } + +@@ -782,6 +796,11 @@ public class LibvirtVmXmlBuilder { + + if (acpiEnabled) { + writer.writeElement("acpi"); ++ if( vm.getClusterArch().getFamily() == ArchitectureType.aarch64 ) { ++ writer.writeStartElement("gic"); ++ writer.writeAttributeString("version", "3"); ++ } ++ writer.writeEndElement(); + } + + if (hypervEnabled) { +@@ -1037,7 +1056,8 @@ public class LibvirtVmXmlBuilder { + + writeGuestAgentChannels(); + +- if (vm.getClusterArch() == ArchitectureType.ppc64 || vm.getClusterArch() == ArchitectureType.ppc64le) { ++ if (vm.getClusterArch() == ArchitectureType.ppc64 || vm.getClusterArch() == ArchitectureType.ppc64le || ++ vm.getClusterArch() == ArchitectureType.aarch64) { + writeEmulator(); + } + +@@ -1195,8 +1215,9 @@ public class LibvirtVmXmlBuilder { + writeSpiceVmcChannel(); + } + +- if (vm.getClusterArch().getFamily() == ArchitectureType.x86 +- && vm.getEffectiveBiosType().getChipsetType() == ChipsetType.Q35) { ++ if ((vm.getClusterArch().getFamily() == ArchitectureType.x86 ++ && vm.getEffectiveBiosType().getChipsetType() == ChipsetType.Q35) ++ || vm.getClusterArch().getFamily() == ArchitectureType.aarch64) { + writePciEControllers(pciERootExists, pciEPorts); + } + +@@ -2853,22 +2874,28 @@ public class LibvirtVmXmlBuilder { + writer.writeStartElement("video"); + + writer.writeStartElement("model"); +- if (mdevDisplayOn) { +- writer.writeAttributeString("type", "none"); +- } else { +- writer.writeAttributeString("type", device.getDevice()); +- Object vram = device.getSpecParams().get(VdsProperties.VIDEO_VRAM); +- writer.writeAttributeString("vram", vram != null ? vram.toString() : "32768"); ++ if (vm.getClusterArch().getFamily() == ArchitectureType.aarch64) { ++ writer.writeAttributeString("type", "virtio"); + Object heads = device.getSpecParams().get(VdsProperties.VIDEO_HEADS); + writer.writeAttributeString("heads", heads != null ? heads.toString() : "1"); +- if (device.getSpecParams().containsKey(VdsProperties.VIDEO_RAM)) { +- writer.writeAttributeString("ram", device.getSpecParams().get(VdsProperties.VIDEO_RAM).toString()); +- } +- if (device.getSpecParams().containsKey(VdsProperties.VIDEO_VGAMEM)) { +- writer.writeAttributeString("vgamem", device.getSpecParams().get(VdsProperties.VIDEO_VGAMEM).toString()); +- } +- } +- ++ writer.writeAttributeString("primary", "yes"); ++ } else { ++ if (mdevDisplayOn) { ++ writer.writeAttributeString("type", "none"); ++ } else { ++ writer.writeAttributeString("type", device.getDevice()); ++ Object vram = device.getSpecParams().get(VdsProperties.VIDEO_VRAM); ++ writer.writeAttributeString("vram", vram != null ? vram.toString() : "32768"); ++ Object heads = device.getSpecParams().get(VdsProperties.VIDEO_HEADS); ++ writer.writeAttributeString("heads", heads != null ? heads.toString() : "1"); ++ if (device.getSpecParams().containsKey(VdsProperties.VIDEO_RAM)) { ++ writer.writeAttributeString("ram", device.getSpecParams().get(VdsProperties.VIDEO_RAM).toString()); ++ } ++ if (device.getSpecParams().containsKey(VdsProperties.VIDEO_VGAMEM)) { ++ writer.writeAttributeString("vgamem", device.getSpecParams().get(VdsProperties.VIDEO_VGAMEM).toString()); ++ } ++ } ++ } + writer.writeEndElement(); + writeAlias(device); + writeAddress(device); +@@ -2922,14 +2949,26 @@ public class LibvirtVmXmlBuilder { + private void writeInput() { + writer.writeStartElement("input"); + +- if (vmInfoBuildUtils.isTabletEnabled(vm)) { ++ if (vm.getClusterArch().getFamily() == ArchitectureType.aarch64) { + writer.writeAttributeString("type", "tablet"); + writer.writeAttributeString("bus", "usb"); + } else { +- writer.writeAttributeString("type", "mouse"); +- writer.writeAttributeString("bus", vm.getClusterArch().getFamily() == ArchitectureType.x86 ? "ps2" :"usb"); ++ if (vmInfoBuildUtils.isTabletEnabled(vm)) { ++ writer.writeAttributeString("type", "tablet"); ++ writer.writeAttributeString("bus", "usb"); ++ } else { ++ writer.writeAttributeString("type", "mouse"); ++ writer.writeAttributeString("bus", vm.getClusterArch().getFamily() == ArchitectureType.x86 ? "ps2" :"usb"); ++ } + } + + writer.writeEndElement(); ++ ++ if (vm.getClusterArch().getFamily() == ArchitectureType.aarch64){ ++ writer.writeStartElement("input"); ++ writer.writeAttributeString("type", "keyboard"); ++ writer.writeAttributeString("bus", "usb"); ++ writer.writeEndElement(); ++ } + } + } +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 0a1c245..8d3315c 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 +@@ -861,6 +861,8 @@ public class VmInfoBuildUtils { + case ppc64: + case ppc64le: + return "pseries"; ++ case aarch64: ++ return ""; + case x86_64: + default: + return "pc"; +diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java +index b0413dd..1ad5f14 100644 +--- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java ++++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/dataprovider/AsyncDataProvider.java +@@ -1180,14 +1180,19 @@ public class AsyncDataProvider { + (Integer) getConfigValuePreConverted(ConfigValues.VM64BitMaxMemorySizeInMB, version); + final int ppc64MaxMaxMemory = + (Integer) getConfigValuePreConverted(ConfigValues.VMPpc64BitMaxMemorySizeInMB, version); +- return Math.max(Math.max(x86_32MaxMaxMemory, x86_64MaxMaxMemory), ppc64MaxMaxMemory); ++ final int aarch64MaxMaxMemory = ++ (Integer) getConfigValuePreConverted(ConfigValues.VMAarch64BitMaxMemorySizeInMB, version); ++ return Math.max(Math.max(Math.max(x86_32MaxMaxMemory, x86_64MaxMaxMemory), ppc64MaxMaxMemory), aarch64MaxMaxMemory); + } + + private ConfigValues getMaxMaxMemoryConfigValue(int osId) { + return oses64bit.contains(osId) +- ? (osArchitectures.get(osId).getFamily() == ArchitectureType.ppc ++ //? (osArchitectures.get(osId).getFamily() == ArchitectureType.ppc ++ ? ((osArchitectures.get(osId).getFamily() == ArchitectureType.aarch64) ++ ? ConfigValues.VMAarch64BitMaxMemorySizeInMB ++ : (osArchitectures.get(osId).getFamily() == ArchitectureType.ppc + ? ConfigValues.VMPpc64BitMaxMemorySizeInMB +- : ConfigValues.VM64BitMaxMemorySizeInMB) ++ : ConfigValues.VM64BitMaxMemorySizeInMB)) + : ConfigValues.VM32BitMaxMemorySizeInMB; + } + +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 6e6158a..bf9e8b3 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 +@@ -1355,6 +1355,7 @@ public abstract class HostModel extends Model implements HasValidatedTabs { + case INTEL: + case AMD: + case IBMS390: ++ case KUNPENG: + resetKernelCmdlineCheckboxesValue(); + break; + case IBM: +@@ -1375,6 +1376,7 @@ public abstract class HostModel extends Model implements HasValidatedTabs { + case INTEL: + case AMD: + case IBMS390: ++ case KUNPENG: + setKernelCmdlineCheckboxesChangeability( + isKernelCmdlineParsable(), + constants.kernelCmdlineCheckboxesAndDirectCustomizationNotAllowed()); +diff --git a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportVmFromOvaModel.java b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportVmFromOvaModel.java +index dff9b7e..8451e9e 100644 +--- a/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportVmFromOvaModel.java ++++ b/frontend/webadmin/modules/uicommonweb/src/main/java/org/ovirt/engine/ui/uicommonweb/models/vms/ImportVmFromOvaModel.java +@@ -38,7 +38,7 @@ public class ImportVmFromOvaModel extends ImportVmFromExternalProviderModel { + + @Override + protected void setTargetArchitecture(List externalVms) { +- setTargetArchitecture(ArchitectureType.x86_64); ++ setTargetArchitecture(ArchitectureType.aarch64); + } + + public void setIsoName(String ovaPath) { +diff --git a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/ClusterAdditionalStatusColumn.java b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/ClusterAdditionalStatusColumn.java +index 9ac4b68..aa9037c 100644 +--- a/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/ClusterAdditionalStatusColumn.java ++++ b/frontend/webadmin/modules/webadmin/src/main/java/org/ovirt/engine/ui/webadmin/widget/table/column/ClusterAdditionalStatusColumn.java +@@ -29,7 +29,8 @@ public class ClusterAdditionalStatusColumn extends EntityAdditionalStatusColumn< + "Intel Broadwell IBRS Family", //$NON-NLS-1$ + "Intel Skylake Client IBRS Family", //$NON-NLS-1$ + "Intel Skylake Server IBRS Family", //$NON-NLS-1$ +- "AMD EPYC IBPB"}; //$NON-NLS-1$ ++ "AMD EPYC IBPB", //$NON-NLS-1$ ++ "Kunpeng 920"}; //$NON-NLS-1$ + private static final String[] versions = new String[]{"4.2", //$NON-NLS-1$ + "4.1", //$NON-NLS-1$ + "4.0", //$NON-NLS-1$ + +diff --git a/packaging/conf/osinfo-defaults.properties b/packaging/conf/osinfo-defaults.properties +index d9d5ce4..307c188 100644 +--- a/packaging/conf/osinfo-defaults.properties ++++ b/packaging/conf/osinfo-defaults.properties +@@ -497,6 +497,25 @@ 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 + ++# centos arm architecture ++os.other_aarch64.id.value = 3001 ++os.other_aarch64.name.value = Other OS ++os.other_aarch64.derivedFrom.value = other ++os.other_aarch64.cpuArchitecture.value = aarch64 ++os.other_aarch64.cpu.hotplugSupport.value = true ++os.other_aarch64.cpu.hotunplugSupport.value = true ++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.watchdog.models.value = i6300esb ++os.other_aarch64.devices.usb.controller.value = qemu-xhci ++os.other_aarch64.devices.console.target.type.value = sclp ++ + # 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/04_02_0590_remove_general_version_of_nongeneral_vdc_options.sql b/packaging/dbscripts/upgrade/04_02_0590_remove_general_version_of_nongeneral_vdc_options.sql +index 0fe77ee..8836bfd 100644 +--- a/packaging/dbscripts/upgrade/04_02_0590_remove_general_version_of_nongeneral_vdc_options.sql ++++ b/packaging/dbscripts/upgrade/04_02_0590_remove_general_version_of_nongeneral_vdc_options.sql +@@ -3,3 +3,4 @@ SELECT fn_db_delete_config_value('IsMigrationSupported', 'general'); + SELECT fn_db_delete_config_value('IsSuspendSupported', 'general'); + SELECT fn_db_delete_config_value('VM32BitMaxMemorySizeInMB', 'general'); + SELECT fn_db_delete_config_value('VMPpc64BitMaxMemorySizeInMB', 'general'); ++SELECT fn_db_delete_config_value('VMAarch64BitMaxMemorySizeInMB', 'general'); +diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +index 71f266b..f50171b 100644 +--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql ++++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +@@ -173,23 +173,23 @@ select fn_db_add_config_value('HighUtilizationForEvenlyDistribute','75','general + select fn_db_add_config_value('HighUtilizationForPowerSave','75','general'); + select fn_db_add_config_value('HostPreparingForMaintenanceIdleTime', '300', 'general'); + select fn_db_add_config_value('HostTimeDriftInSec','300','general'); +-select fn_db_add_config_value_for_versions_up_to('HotPlugCpuSupported','{"x86":"true","ppc":"true","s390x":"true"}', '4.5'); +-select fn_db_add_config_value_for_versions_up_to('HotUnplugCpuSupported', '{"x86":"true","ppc":"true","s390x":"false"}', '4.5'); +-select fn_db_add_config_value_for_versions_up_to('HotPlugMemorySupported', '{"x86":"true","ppc":"true","s390x":"false"}', '4.5'); ++select fn_db_add_config_value_for_versions_up_to('HotPlugCpuSupported','{"x86":"true","ppc":"true","s390x":"true","aarch64":"true"}', '4.5'); ++select fn_db_add_config_value_for_versions_up_to('HotUnplugCpuSupported', '{"x86":"true","ppc":"true","s390x":"false","aarch64":"true"}', '4.5'); ++select fn_db_add_config_value_for_versions_up_to('HotPlugMemorySupported', '{"x86":"true","ppc":"true","s390x":"false","aarch64":"true"}', '4.5'); + select fn_db_add_config_value('MaxMemorySlots','16','general'); + select fn_db_add_config_value('HotPlugMemoryMultiplicationSizeMb','256','general'); +-select fn_db_add_config_value_for_versions_up_to('HotUnplugMemorySupported', '{"x86":"true","ppc":"true","s390x":"false"}', '4.5'); ++select fn_db_add_config_value_for_versions_up_to('HotUnplugMemorySupported', '{"x86":"true","ppc":"true","s390x":"false","aarch64":"true"}', '4.5'); + select fn_db_add_config_value_for_versions_up_to('CopyPreallocatedFileBasedDiskSupported', 'false', '4.2'); + select fn_db_add_config_value_for_versions_up_to('CopyPreallocatedFileBasedDiskSupported', 'true', '4.5'); + select fn_db_add_config_value_for_versions_up_to('ManagedBlockDomainSupported', 'false', '4.2'); + select fn_db_add_config_value_for_versions_up_to('ManagedBlockDomainSupported', 'false', '4.5'); + + -- migration support per architecture +-select fn_db_add_config_value_for_versions_up_to('IsMigrationSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true"}','4.5'); ++select fn_db_add_config_value_for_versions_up_to('IsMigrationSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true", "aarch64": "true"}','4.5'); + -- snapshot support per architecture +-select fn_db_add_config_value_for_versions_up_to('IsMemorySnapshotSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true"}','4.5'); ++select fn_db_add_config_value_for_versions_up_to('IsMemorySnapshotSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true", "aarch64": "true"}','4.5'); + -- suspend support per architecture +-select fn_db_add_config_value_for_versions_up_to('IsSuspendSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true"}','4.5'); ++select fn_db_add_config_value_for_versions_up_to('IsSuspendSupported','{"undefined": "true", "x86": "true", "ppc" : "true", "s390x" : "true", "aarch64": "true"}','4.5'); + select fn_db_add_config_value('OsRepositoryConfDir','/osinfo.conf.d','general'); + select fn_db_add_config_value('IterationsWithBalloonProblem','3','general'); + select fn_db_add_config_value('DefaultSysprepLocale','en_US','general'); +@@ -464,7 +464,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:Kunpeng 920:asimd:asimd:aarch64;', + '4.4'); + + select fn_db_add_config_value('ServerCPUList', +@@ -578,6 +579,7 @@ select fn_db_add_config_value_for_versions_up_to('VM32BitMaxMemorySizeInMB','204 + select fn_db_add_config_value_for_versions_up_to('VM64BitMaxMemorySizeInMB','6291456','4.5'); + select fn_db_add_config_value_for_versions_up_to('VMPpc64BitMaxMemorySizeInMB', '1048576', '4.3'); + select fn_db_add_config_value_for_versions_up_to('VMPpc64BitMaxMemorySizeInMB', '6291456', '4.5'); ++select fn_db_add_config_value_for_versions_up_to('VMAarch64BitMaxMemorySizeInMB', '1048576', '4.4'); + select fn_db_add_config_value('VmGracefulShutdownMessage','System Administrator has initiated shutdown of this Virtual Machine. Virtual Machine is shutting down.','general'); + select fn_db_add_config_value('VmGracefulShutdownTimeout','30','general'); + --Number of subsequent failures in VM creation in a pool before giving up and stop creating new VMs +@@ -1121,7 +1123,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:Kunpeng 920:asimd:asimd:aarch64;', + '4.4'); + select fn_db_update_config_value('ServerCPUList', + '1:Intel Nehalem Family:vmx,nx,model_Nehalem:Nehalem:x86_64; ' +diff --git a/packaging/setup/ovirt_engine_setup/engine_common/constants.py b/packaging/setup/ovirt_engine_setup/engine_common/constants.py +index 98c0688..13b0485 100644 +--- a/packaging/setup/ovirt_engine_setup/engine_common/constants.py ++++ b/packaging/setup/ovirt_engine_setup/engine_common/constants.py +@@ -95,6 +95,7 @@ class Defaults(object): + 'x86_64': 68719476736, + 'i686': 4294967295, + 'ppc64': 137438953472, ++ 'aarch64': 137438953472, + 'default': 4294967295, + } + return SHMMAX.get(platform.machine(), SHMMAX['default']) +-- +2.27.0 + diff --git a/0003-add-virt-chipset-support.patch b/0003-add-virt-chipset-support.patch new file mode 100644 index 0000000..444250e --- /dev/null +++ b/0003-add-virt-chipset-support.patch @@ -0,0 +1,40 @@ +From 54a5c1a7ba6d8b7f68b7bf6b31e94e1a44685338 Mon Sep 17 00:00:00 2001 +From: wangge +Date: Wed, 29 Sep 2021 16:19:14 +0800 +Subject: [PATCH] add virt chipset support + +--- + .../core/vdsbroker/monitoring/VirtMonitoringStrategy.java | 3 +++ + packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql | 2 +- + 2 files changed, 4 insertions(+), 1 deletion(-) + +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 886a721..b889773 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 +@@ -242,6 +242,9 @@ public class VirtMonitoringStrategy implements MonitoringStrategy { + if (!StringUtils.isEmpty(matchedEmulatedMachine)) { + setClusterEmulatedMachine(vds, matchedEmulatedMachine); + return true; ++ } else if (supported.contains(ChipsetType.VIRT.getChipsetName())) { ++ setClusterEmulatedMachine(vds, ChipsetType.VIRT.getChipsetName()); ++ return true; + } + return false; + } +diff --git a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +index f50171b..3f42535 100644 +--- a/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql ++++ b/packaging/dbscripts/upgrade/pre_upgrade/0000_config.sql +@@ -976,7 +976,7 @@ select fn_db_update_config_value('ClusterEmulatedMachines','pc-i440fx-rhel7.3.0, + select fn_db_update_config_value('ClusterEmulatedMachines','pc-i440fx-rhel7.6.0,pc-i440fx-2.12,pseries-rhel7.6.0-sxxm,s390-ccw-virtio-2.12','4.3'); + -- Since 4.4 every x86 cluster keeps two emulated machine types: for i440fx and q35 chipsets. Thus, host must support + -- both chipsets and ClusterEmulatedMachines list also should contain values for both of them. +-select fn_db_update_config_value_for_versions_from_up_to('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','4.5'); ++select fn_db_update_config_value_for_versions_from_up_to('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,virt','4.4','4.5'); + 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','general'); + select fn_db_update_config_value('SupportedVDSMVersions','4.20,4.30,4.40','general'); +-- +2.27.0 + diff --git a/0004-fit-cluster-can-not-find-error-under-aarch64-platform.patch b/0004-fit-cluster-can-not-find-error-under-aarch64-platform.patch new file mode 100644 index 0000000..17d3448 --- /dev/null +++ b/0004-fit-cluster-can-not-find-error-under-aarch64-platform.patch @@ -0,0 +1,209 @@ +From 4248a443e716f429c9625dcb61be3c5adce52ed7 Mon Sep 17 00:00:00 2001 +From: wangge +Date: Sat, 9 Oct 2021 15:11:00 +0800 +Subject: [PATCH] fit cluster can't find error under aarch64 platform + +--- + .../engine/core/bll/UpdateClusterCommand.java | 3 +- + .../core/bll/validator/ClusterValidator.java | 7 +-- + .../common/utils/ClusterEmulatedMachines.java | 56 +++++++++++++++++-- + .../builder/vminfo/LibvirtVmXmlBuilder.java | 7 ++- + .../monitoring/VirtMonitoringStrategy.java | 5 +- + 5 files changed, 64 insertions(+), 14 deletions(-) + +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 e23c76a..c66de52 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 +@@ -618,7 +618,8 @@ public class UpdateClusterCommand extends + 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/validator/ClusterValidator.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/ClusterValidator.java +index 9e13a3d..4f43154 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 +@@ -131,12 +131,11 @@ public class ClusterValidator { + */ + public ValidationResult cpuTypeSupportsVirtService() { + return ValidationResult.failWith(EngineMessage.ACTION_TYPE_FAILED_CPU_NOT_FOUND) +- .when(cluster.supportsVirtService() && !cpuExists()); ++ .when(!cluster.supportsVirtService() && !cpuExists()); + } + + protected boolean cpuExists() { +- return cluster.getCpuName() == null || "".equals(cluster.getCpuName()) || +- cpuFlagsManagerHandler.checkIfCpusExist(cluster.getCpuName(), cluster.getCompatibilityVersion()); ++ return cluster.getCpuName() == null || "".equals(cluster.getCpuName()) || cpuFlagsManagerHandler.checkIfCpusExist(cluster.getCpuName(), cluster.getCompatibilityVersion()); + } + + public ValidationResult versionSupported() { +@@ -283,7 +282,7 @@ public class ClusterValidator { + */ + public ValidationResult cpuNotFound(boolean cpusExist) { + return ValidationResult.failWith(EngineMessage.CLUSTER_CANNOT_UPDATE_CPU_ILLEGAL) +- .when(newCluster.supportsVirtService() ++ .when(!newCluster.supportsVirtService() + && (!"".equals(cluster.getCpuName()) || !"".equals(newCluster.getCpuName())) + && !cpusExist); + } +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 2928da4..36c4946 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,23 +6,50 @@ 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 emulatedMachine) { ++ if (emulatedMachine.contains(VIRT_CHIPSET_NAME)) { ++ this.virtType = VIRT_CHIPSET_NAME; ++ } ++ } ++ + private ClusterEmulatedMachines(String i440fxType, String q35Type) { + this.i440fxType = i440fxType; + this.q35Type = q35Type; + } + +- public static String build(String i440fxType, String q35Type) { +- if (i440fxType == null) { +- return q35Type; ++ public static String build(String i440fxType, String q35Type, String virtType) { ++ String matchedType = new String(); ++ if (i440fxType != null) { ++ if (!matchedType.isEmpty()) { ++ matchedType = matchedType + ";"; ++ } ++ matchedType = matchedType + i440fxType; ++ } ++ if (q35Type != null) { ++ if (!matchedType.isEmpty()) { ++ matchedType = matchedType + ";"; ++ } ++ matchedType = matchedType + q35Type; ++ } ++ if (virtType != null) { ++ if (!matchedType.isEmpty()) { ++ matchedType = matchedType + ";"; ++ } ++ matchedType = matchedType + virtType; ++ } ++ if (matchedType.isEmpty()) { ++ return null; + } else { +- return q35Type == null ? i440fxType : i440fxType + ";" + q35Type; ++ return matchedType; + } + } + +@@ -41,7 +68,13 @@ public class ClusterEmulatedMachines { + if (em.length == 2) { + return new ClusterEmulatedMachines(em[0], em[1]); + } ++ if (em.length > 2) { ++ return new ClusterEmulatedMachines(emulatedMachine); ++ } + ChipsetType chipsetType = ChipsetType.fromMachineType(emulatedMachine); ++ if (chipsetType == ChipsetType.VIRT) { ++ return new ClusterEmulatedMachines(VIRT_CHIPSET_NAME); ++ } + if (chipsetType == ChipsetType.Q35) { + return new ClusterEmulatedMachines(replaceChipset(emulatedMachine, ChipsetType.I440FX), emulatedMachine); + } else { +@@ -80,8 +113,21 @@ public class ClusterEmulatedMachines { + return q35Type; + } + ++ public String getVirtType() { ++ return virtType; ++ } ++ + public String getTypeByChipset(ChipsetType chipsetType) { +- return chipsetType == ChipsetType.Q35 ? q35Type : i440fxType; ++ switch (chipsetType) { ++ case Q35: ++ return q35Type; ++ case I440FX: ++ return i440fxType; ++ case VIRT: ++ return virtType; ++ default: ++ return q35Type; ++ } + } + + public static String forChipset(String emulatedMachine, ChipsetType chipsetType) { +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 4e7794a..712d3c3 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 +@@ -692,7 +692,7 @@ public class LibvirtVmXmlBuilder { + writer.writeAttributeString("secure", secureBoot ? "yes" : "no"); + writer.writeAttributeString("type", "pflash"); + if (vm.getClusterArch().getFamily() == ArchitectureType.aarch64) { +- writer.writeRaw("/usr/share/AAVMF/AAVMF_CODE.fd"); ++ writer.writeRaw("/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw"); + } else { + writer.writeRaw("/usr/share/OVMF/OVMF_CODE.secboot.fd"); + } +@@ -701,7 +701,7 @@ public class LibvirtVmXmlBuilder { + String nvramTemplate = vmCustomProperties.get("nvram_template"); + if (nvramTemplate == null) { + if(vm.getClusterArch().getFamily() == ArchitectureType.aarch64){ +- nvramTemplate = "/usr/share/AAVMF/AAVMF_CODE.fd"; ++ nvramTemplate = "/usr/share/edk2/aarch64/vars-template-pflash.raw"; + } else { + nvramTemplate = String.format("/usr/share/OVMF/%s", + secureBoot ? "OVMF_VARS.secboot.fd" : "OVMF_VARS.fd"); +@@ -1047,6 +1047,9 @@ public class LibvirtVmXmlBuilder { + case x86: + writeInput(); + break; ++ case aarch64: ++ writeInput(); ++ break; + case ppc: + if (vmInfoBuildUtils.hasUsbController(vm)) { + writeInput(); +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 b889773..b027275 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 +@@ -228,7 +228,7 @@ public class VirtMonitoringStrategy implements MonitoringStrategy { + return supported.contains(cluster.getEmulatedMachine()); + } else { + ClusterEmulatedMachines ems = ClusterEmulatedMachines.parse(cluster.getEmulatedMachine()); +- return supported.contains(ems.getI440fxType()) && supported.contains(ems.getQ35Type()); ++ return supported.contains(ems.getVirtType()) || (supported.contains(ems.getI440fxType()) && supported.contains(ems.getQ35Type())); + } + } + } +@@ -237,7 +237,8 @@ public class VirtMonitoringStrategy implements MonitoringStrategy { + String matchedI440fx = + EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.I440FX, supported, available); + String matchedQ35 = EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.Q35, supported, available); +- String matchedEmulatedMachine = ClusterEmulatedMachines.build(matchedI440fx, matchedQ35); ++ String matchedVirt = EmulatedMachineCommonUtils.getSupportedByChipset(ChipsetType.VIRT, supported, available); ++ String matchedEmulatedMachine = ClusterEmulatedMachines.build(matchedI440fx, matchedQ35, matchedVirt); + + if (!StringUtils.isEmpty(matchedEmulatedMachine)) { + setClusterEmulatedMachine(vds, matchedEmulatedMachine); +-- +2.27.0 + diff --git a/0005-fix-interface-report-an-error-when-emulatedMachine-is-null.patch b/0005-fix-interface-report-an-error-when-emulatedMachine-is-null.patch new file mode 100644 index 0000000..fee67c4 --- /dev/null +++ b/0005-fix-interface-report-an-error-when-emulatedMachine-is-null.patch @@ -0,0 +1,25 @@ +From 155932487ade8c3d05504434947eeb67fd76c59e Mon Sep 17 00:00:00 2001 +From: wang--ge +Date: Wed, 13 Oct 2021 09:43:38 +0800 +Subject: [PATCH] fix interface report an error when emulatedMachine is null + +--- + .../ovirt/engine/core/common/utils/ClusterEmulatedMachines.java | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +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 7d5c902..882b3be 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 +@@ -58,7 +58,7 @@ public class ClusterEmulatedMachines { + } + + public static ClusterEmulatedMachines parse(String emulatedMachine) { +- if (emulatedMachine == null) { ++ if (emulatedMachine == null || emulatedMachine.equals("")) { + return new ClusterEmulatedMachines(); + } + String[] em = emulatedMachine.split(";"); +-- +2.27.0 + diff --git a/0006-add-arm-biostype-in-front-end-api.patch b/0006-add-arm-biostype-in-front-end-api.patch new file mode 100644 index 0000000..c0426bd --- /dev/null +++ b/0006-add-arm-biostype-in-front-end-api.patch @@ -0,0 +1,24 @@ +From 0bae3aa6270eb2843a8e6aaaea6690350511233f Mon Sep 17 00:00:00 2001 +From: wang--ge +Date: Tue, 12 Oct 2021 18:54:58 +0800 +Subject: [PATCH] add arm biostype in front end api + +--- + src/main/java/types/BiosType.java | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/main/java/types/BiosType.java b/src/main/java/types/BiosType.java +index 9044d90..786eafd 100644 +--- a/src/main/java/types/BiosType.java ++++ b/src/main/java/types/BiosType.java +@@ -79,5 +79,6 @@ public enum BiosType { + * @status added + * @since 4.3 + */ +- Q35_SECURE_BOOT; ++ Q35_SECURE_BOOT, ++ VIRT_OVMF; + } +-- +2.27.0 + diff --git a/0007-add-config-item-for-openeuler.patch b/0007-add-config-item-for-openeuler.patch new file mode 100644 index 0000000..b982d90 --- /dev/null +++ b/0007-add-config-item-for-openeuler.patch @@ -0,0 +1,38 @@ +From f7411c6c0795c0936ae59a4fab6c04d74da2d2bc Mon Sep 17 00:00:00 2001 +From: wang--ge +Date: Tue, 16 Nov 2021 09:19:20 +0800 +Subject: [PATCH] add config item for openeuler + +--- + .../roles/ovirt-host-deploy-facts/tasks/host-os.yml | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/packaging/ansible-runner-service-project/project/roles/ovirt-host-deploy-facts/tasks/host-os.yml b/packaging/ansible-runner-service-project/project/roles/ovirt-host-deploy-facts/tasks/host-os.yml +index 7e42653..ef92743 100644 +--- a/packaging/ansible-runner-service-project/project/roles/ovirt-host-deploy-facts/tasks/host-os.yml ++++ b/packaging/ansible-runner-service-project/project/roles/ovirt-host-deploy-facts/tasks/host-os.yml +@@ -5,9 +5,15 @@ + if ansible_distribution == 'RedHat' or ansible_distribution == 'CentOS' + else 0 }}" + fc_ver: "{{ ansible_distribution_major_version|int +- if ansible_distribution == 'Fedora' ++ if (ansible_distribution == 'Fedora' or ansible_distribution == 'openEuler') + else 0 }}" + ++- name: Check if system is OpenEuler ++ set_fact: ++ ansible_python_interpreter: "{{ 'usr/bin/python3' }}" ++ when: ++ ansible_distribution == 'openEuler' ++ + - name: Fetch installed packages + package_facts: + manager: auto +@@ -26,3 +32,4 @@ + - name: Detect if host is a prebuilt image + set_fact: + node_host: "{{ not node_presence.changed }}" ++ +-- +2.27.0 + diff --git a/4.4.20.tar.gz b/4.4.20.tar.gz new file mode 100644 index 0000000..4649e36 Binary files /dev/null and b/4.4.20.tar.gz differ diff --git a/CVE-2020-10775.patch b/CVE-2020-10775.patch index 43731ee..438135e 100644 --- a/CVE-2020-10775.patch +++ b/CVE-2020-10775.patch @@ -1,6 +1,6 @@ diff -Naru a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java ---- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java 2021-07-20 03:39:24.000000000 +0800 -+++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java 2022-06-06 14:16:06.807214000 +0800 +--- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java 2020-11-19 01:15:47.000000000 +0800 ++++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/servlet/SsoPostLoginServlet.java 2022-06-06 10:28:53.426920000 +0800 @@ -8,6 +8,7 @@ import javax.naming.InitialContext; @@ -14,108 +14,14 @@ diff -Naru a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa @Override - public void init() { -+ public void init() throws ServletException { ++ public void init() throws ServletException { String strVal = getServletConfig().getInitParameter("login-as-admin"); if (strVal == null) { throw new RuntimeException("No login-as-admin init parameter specified for SsoPostLoginServlet."); -@@ -61,9 +62,8 @@ - @Override - protected void service(HttpServletRequest request, HttpServletResponse response) throws IOException { - log.debug("Entered SsoPostLoginServlet"); -- String username; -+ String username = null; - String profile = null; -- String authzName; - InitialContext ctx = null; - try { - String error_description = request.getParameter("error_description"); -@@ -90,12 +90,12 @@ - Map payload = (Map) jsonResponse.get("ovirt"); - - username = (String) jsonResponse.get("user_id"); -+ profile = ""; - int index = username.lastIndexOf("@"); - if (index != -1) { - profile = username.substring(index + 1); - username = username.substring(0, index); - } -- authzName = (String) jsonResponse.get("user_authz"); - - try { - ctx = new InitialContext(); -@@ -120,14 +120,12 @@ - "Unable to login user %s@%s with profile [%s]" + - " because the maximum number of allowed sessions %s is exceeded", - username, -- authzName, - profile, - maxUserSessions)); - } - throw new RuntimeException(String.format( - "The user %s@%s with profile [%s] is not authorized to perform login", - username, -- authzName, - profile)); - } else { - HttpSession httpSession = request.getSession(true); -@@ -143,9 +141,7 @@ - } catch (RuntimeException ex) { - throw ex; - } catch (Exception ex) { -- throw new RuntimeException( -- String.format("User login failure: %s@%s with profile [%s]", username, authzName, profile), -- ex); -+ throw new RuntimeException(String.format("User login failure: %s", username), ex); - } finally { - try { - if (ctx != null) { diff -Naru a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/SsoUtils.java b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/SsoUtils.java ---- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/SsoUtils.java 2021-07-20 03:39:24.000000000 +0800 -+++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/SsoUtils.java 2022-06-06 14:19:02.265717000 +0800 -@@ -33,7 +33,7 @@ - public static String createUserSession(HttpServletRequest req, - Map jsonResponse, - boolean loginAsAdmin) throws Exception { -- String engineSessionId; -+ String engineSessionId = null; - if (!FiltersHelper.isStatusOk(jsonResponse)) { - throw new RuntimeException((String) jsonResponse.get("MESSAGE")); - } -@@ -46,7 +46,6 @@ - profile = username.substring(index + 1); - username = username.substring(0, index); - } -- String authzName = (String) jsonResponse.get("user_authz"); - try { - ctx = new InitialContext(); - ActionReturnValue queryRetVal = FiltersHelper.getBackend(ctx).runAction(ActionType.CreateUserSession, -@@ -70,14 +69,12 @@ - "Unable to login user %s@%s with profile [%s] " + - "because the maximum number of allowed sessions %s is exceeded", - username, -- authzName, - profile, - EngineLocalConfig.getInstance().getInteger("ENGINE_MAX_USER_SESSIONS"))); - } - throw new RuntimeException(String.format( - "The user %s@%s with profile [%s] is not authorized to perform login", - username, -- authzName, - profile)); - } - engineSessionId = queryRetVal.getActionReturnValue(); -@@ -90,8 +87,8 @@ - true); - } - } catch (Exception ex) { -- log.error("User '{}@{}' with profile [{}] login failed: {}", username, authzName, profile, ex.getMessage()); -- log.debug("User '{}@{}' with profile [{}] login failed", username, authzName, profile, ex); -+ log.error("User '{}@{}' login failed: {}", username, profile, ex.getMessage()); -+ log.debug("User '{}@{}' login failed", username, profile, ex); - throw ex; - } finally { - try { -@@ -139,7 +136,6 @@ +--- a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/SsoUtils.java 2020-11-19 01:15:47.000000000 +0800 ++++ b/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa/SsoUtils.java 2022-06-06 10:27:53.774598000 +0800 +@@ -135,7 +135,6 @@ if (StringUtils.isNotBlank(alternateFqdnString)) { Arrays.stream(alternateFqdnString.trim().split("\\s *")) .filter(StringUtils::isNotBlank) @@ -123,7 +29,7 @@ diff -Naru a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa .forEach(allowedDomains::add); } -@@ -148,7 +144,7 @@ +@@ -144,7 +143,7 @@ private static String parseHostFromUrl(String url, String urlPropertyName) { try { @@ -133,8 +39,8 @@ diff -Naru a/backend/manager/modules/aaa/src/main/java/org/ovirt/engine/core/aaa throw new IllegalStateException(urlPropertyName + " not a valid URI: " + url); } diff -Naru a/backend/manager/modules/aaa/src/test/java/org/ovirt/engine/core/aaa/SsoUtilsTest.java b/backend/manager/modules/aaa/src/test/java/org/ovirt/engine/core/aaa/SsoUtilsTest.java ---- a/backend/manager/modules/aaa/src/test/java/org/ovirt/engine/core/aaa/SsoUtilsTest.java 2021-07-20 03:39:24.000000000 +0800 -+++ b/backend/manager/modules/aaa/src/test/java/org/ovirt/engine/core/aaa/SsoUtilsTest.java 2022-06-06 14:20:07.028614000 +0800 +--- a/backend/manager/modules/aaa/src/test/java/org/ovirt/engine/core/aaa/SsoUtilsTest.java 2020-11-19 01:15:47.000000000 +0800 ++++ b/backend/manager/modules/aaa/src/test/java/org/ovirt/engine/core/aaa/SsoUtilsTest.java 2022-06-06 10:26:52.261144000 +0800 @@ -38,23 +38,6 @@ } diff --git a/ovirt-engine-4.4.7.7.tar.gz b/ovirt-engine-4.4.4.1.tar.gz similarity index 71% rename from ovirt-engine-4.4.7.7.tar.gz rename to ovirt-engine-4.4.4.1.tar.gz index c072561..73b8da2 100644 Binary files a/ovirt-engine-4.4.7.7.tar.gz and b/ovirt-engine-4.4.4.1.tar.gz differ diff --git a/ovirt-engine.spec b/ovirt-engine.spec index a5b071d..7ade6f3 100644 --- a/ovirt-engine.spec +++ b/ovirt-engine.spec @@ -1,8 +1,8 @@ -%if 0%{?ovirt_build_user_agent:1} -%global _ovirt_build_user_agent %{ovirt_build_user_agent} -%else -%global _ovirt_build_user_agent gecko1_8 -%endif +# +# CUSTOMIZATION-BEGIN +# +# ovirt_build_extra_flags +# ovirt_build_ut %if 0%{?ovirt_build_quick} %global _ovirt_build_ut 0 %global ovirt_build_gwt 0 @@ -11,13 +11,13 @@ %global _ovirt_build_ut 0 %global ovirt_build_all_user_agents 0 %global ovirt_build_locales 0 -%global _ovirt_build_extra_flags -D gwt.userAgent=%{_ovirt_build_user_agent} +%global _ovirt_build_extra_flags -D gwt.userAgent=gecko1_8 %endif %if 0%{?ovirt_build_draft} %global _ovirt_build_ut 0 %global ovirt_build_all_user_agents 0 %global ovirt_build_locales 0 -%global _ovirt_build_extra_flags -D gwt.userAgent=%{_ovirt_build_user_agent} -P gwtdraft +%global _ovirt_build_extra_flags -D gwt.userAgent=gecko1_8 -P gwtdraft %endif %if 0%{!?ovirt_build_ut:1} %if 0%{?_ovirt_build_ut:1} @@ -36,11 +36,24 @@ %global ovirt_build_all_user_agents 1 %endif %global ovirt_provides_jboss 1 +# +# CUSTOMIZATION-END +# + +#raw # Do not repack .jar files, as it takes a long time and doesn't have a # real benefit: %global __jar_repack 0 +%if !%{ovirt_provides_jboss} +# +# unsign all provided jars +# see rhbz#1019637 +# +%global _jarsign_opts --unsign=/usr/share/ovirt-engine +%endif + # # rpm does not support override # nor modify of variables @@ -49,6 +62,11 @@ %global EXTRA_BUILD_FLAGS %{?_ovirt_build_extra_flags:%{_ovirt_build_extra_flags}}%{?ovirt_build_extra_flags: %{ovirt_build_extra_flags}} %endif +# +# Supported distributions: +# Fedora >= 30 +# EL >= 7 +# %global ovirt_install_poms 1 @@ -88,9 +106,6 @@ %global vdsm_uid 36 %global vdsm_user vdsm -# Minimal required OpenJDK version -%global openjdk_version 11.0.11 - %global openstack_java_version 3.2.9 # Macro to create an user: @@ -160,31 +175,37 @@ getent passwd %1 >/dev/null || useradd -r -u %2 -g %3 -c %5 -s /sbin/nologin -d %global ovirt_dependencies ovirt-dependencies/4.4 Name: ovirt-engine -Version: 4.4.7.7 -Release: 4 +Version: 4.4.4.1 +Release: 5 Summary: Management server for Open Virtualization Group: %{ovirt_product_group} License: Apache 2.0 URL: http://www.ovirt.org -Source0: http://resources.ovirt.org/pub/ovirt-master-snapshot/src/ovirt-engine/ovirt-engine-4.4.7.7.tar.gz -Source1: rxjava-2.2.4.jar -Source2: xalan-2.7.1.jbossorg-2.jar +Source0: http://resources.ovirt.org/pub/ovirt-master-snapshot/src/ovirt-engine/ovirt-engine-4.4.4.1.tar.gz +Source1: xalan-2.7.1.jbossorg-2.jar # wget https://repo1.maven.org/maven2/com/github/warmuuh/libsass-maven-plugin/0.2.8-libsass_3.4.4/libsass-maven-plugin-0.2.8-libsass_3.4.4.pom # version=`grep jsass libsass-maven-plugin-0.2.8-libsass_3.4.4.pom` -A 1| grep "version"|awk -F ">" '{print $2}' | awk -F "<" '{print $1}'` # sed -i "s/$version/5.10.3/g" libsass-maven-plugin-0.2.8-libsass_3.4.4.pom -Source3: libsass-maven-plugin-0.2.8-libsass_3.4.4.pom +Source2: libsass-maven-plugin-0.2.8-libsass_3.4.4.pom +Source3: https://github.com/oVirt/ovirt-engine-api-model/archive/refs/tags/4.4.20.tar.gz +Source4: 0006-add-arm-biostype-in-front-end-api.patch + Patch1: 0001-add-dependent-package-to-lib.patch -Patch2: CVE-2020-10775.patch +Patch2: 0002-add-support-running-on-kunpeng-platform.patch +Patch3: 0003-add-virt-chipset-support.patch +Patch4: 0004-fit-cluster-can-not-find-error-under-aarch64-platform.patch +Patch5: 0005-fix-interface-report-an-error-when-emulatedMachine-is-null.patch +Patch6: 0007-add-config-item-for-openeuler.patch +Patch7: CVE-2020-10775.patch BuildArch: noarch BuildRequires: assertj-core >= 2.2.0 BuildRequires: maven >= 3.5.0 BuildRequires: maven-enforcer-plugin -BuildRequires: java-11-openjdk-devel >= %{openjdk_version} +BuildRequires: java-11-openjdk-devel >= 11.0.4 BuildRequires: javapackages-tools BuildRequires: make BuildRequires: python3-devel -BuildRequires: python3-distro BuildRequires: systemd BuildRequires: unzip BuildRequires: ovirt-jboss-modules-maven-plugin >= 2.0.1 @@ -192,7 +213,10 @@ BuildRequires: javapackages-local Requires(pre): shadow-utils -Requires: ovirt-engine-wildfly-overlay >= 23 +Requires: ovirt-engine-wildfly-overlay = 19.1.0 +Requires: ansible +Requires: sudo >= 1.9.2 + Requires: %{name}-backend = %{version}-%{release} Requires: %{name}-dbscripts = %{version}-%{release} Requires: %{name}-restapi = %{version}-%{release} @@ -201,12 +225,11 @@ Requires: %{name}-webadmin-portal = %{version}-%{release} Requires: %{name}-websocket-proxy >= %{version}-%{release} Requires: %{name}-vmconsole-proxy-helper >= %{version}-%{release} Requires: %{name}-ui-extensions >= 1.0.4 -Requires: ansible >= 2.9.21, ansible < 2.10.0 Requires: ansible-runner-service >= 1.0.6 Requires: apache-commons-compress Requires: apache-commons-configuration Requires: apache-commons-jxpath -Requires: java-11-openjdk-headless >= %{openjdk_version} +Requires: java-11-openjdk-headless >= 11.0.4 Requires: javapackages-tools Requires: ovirt-imageio-daemon >= 2.0.10-1 Requires: python3-mod_wsgi >= 4.6.4 @@ -218,12 +241,18 @@ Requires: ovirt-web-ui Requires: ovirt-cockpit-sso Obsoletes: ovirt-engine-api-explorer +# This is required for OpenJDK keytool to work properly, when engine machine +# is running in FIPS mode. More info at https://bugzilla.redhat.com/1894083 +Requires: nss + # Metrics stuff Requires: collectd Requires: collectd-postgresql Requires: collectd-disk Requires: collectd-write_http Requires: collectd-write_syslog + + # Requirements for ovirt-engine-metrics Requires: rsyslog Requires: rsyslog-elasticsearch @@ -235,8 +264,8 @@ Requires: libestr Requires: postgresql-jdbc >= 42.2.3 -Requires: postgresql-server >= 12.0 -Requires: postgresql-contrib >= 12.0 +Requires: postgresql-server +Requires: postgresql-contrib Requires: openstack-java-cinder-client >= %{openstack_java_version} Requires: openstack-java-cinder-model >= %{openstack_java_version} @@ -249,8 +278,7 @@ Requires: openstack-java-quantum-client >= %{openstack_java_version} Requires: openstack-java-quantum-model >= %{openstack_java_version} Requires: openstack-java-resteasy-connector >= %{openstack_java_version} Requires: python3-dnf-plugin-versionlock -Requires: apache-sshd >= 2.6.0 -Requires: ed25519-java >= 0.3.0 +Requires: apache-sshd >= 2.5.0 Requires: slf4j-jdk14 >= 1.7.0 Requires: jcl-over-slf4j >= 1.7.0 Requires: snmp4j >= 2.4.1 @@ -288,6 +316,7 @@ Provides: bundled(js-patternfly-next) = 2.26.1 system that provides advanced capabilities for managing the Open virtualization infrastructure for Servers and Desktops. +%if !%{ovirt_provides_jboss} %package -n rhvm Summary: Red Hat Virtualization Manager Group: %{ovirt_product_group} @@ -302,11 +331,12 @@ Requires: spice-client-win-x86 >= %{spice_version} Red Hat Virtualization is a feature-rich server virtualization management system that provides advanced capabilities for managing Red Hat virtualization infrastructure for Servers and Desktops. +%endif %package -n python%{python3_pkgversion}-%{name}-lib Summary: %{ovirt_product_name_short} library Group: %{ovirt_product_group} -Requires: python3-cryptography +Requires: python3-m2crypto >= 0.28 Requires: python3-dateutil Requires: python3-daemon >= 2.1.2 @@ -318,20 +348,21 @@ Requires: python3-daemon >= 2.1.2 %package backend Summary: Engine core of %{ovirt_product_name_short} Group: %{ovirt_product_group} -License: Apache 2.0 and LGPLv3 and GPLv3 +License: ASL 2.0 and LGPLv3 and GPLv3 Requires: %{name} = %{version}-%{release} Requires: %{name}-extensions-api >= 1.0.0 Requires: aopalliance >= 1.0 Requires: curl Requires: httpd -Requires: java-11-openjdk-headless >= %{openjdk_version} +Requires: java-11-openjdk-headless Requires: logrotate Requires: mailcap Requires: mod_ssl Requires: novnc >= 1.0.0 Requires: python3-%{name}-lib >= %{version}-%{release} -Requires: openssh -Requires: vdsm-jsonrpc-java >= 1.6.0, vdsm-jsonrpc-java < 1.7.0 +Requires: openssh >= 8.2p1 +Requires: vdsm-jsonrpc-java >= 1.5.4 +Conflicts: vdsm-jsonrpm-java >= 1.6 Requires: java-client-kubevirt >= 0.5.0 Requires: openssl Requires: ovirt-engine-extension-aaa-jdbc >= 1.2.0 @@ -376,7 +407,6 @@ Requires: python3-libxml2 Requires: logrotate Requires: python3-otopi >= 1.9.0 Requires: python3-paramiko -Requires: python3-distro Requires(pre): shadow-utils Conflicts: %{name}-dwh < 4.4.0 Conflicts: %{name}-dwh-setup < 4.4.0 @@ -419,9 +449,9 @@ Requires: %{name}-setup-plugin-cinderlib = %{version}-%{release} Requires: %{name}-setup-plugin-imageio = %{version}-%{release} Requires: %{name}-dwh-setup >= 4.4.1.2 Requires: ovirt-engine-extension-aaa-jdbc >= 1.2.0 -Requires: openssh -Requires: postgresql-server >= 12.0 -Requires: postgresql-contrib >= 12.0 +Requires: openssh >= 8.2p1 +Requires: postgresql-server +Requires: postgresql-contrib Conflicts: %{name} < 4.4.0 # See rhbz# 1676461 Requires: ovirt-vmconsole >= 1.0.7 @@ -445,9 +475,9 @@ Requires: python3-libselinux Requires: policycoreutils-python-utils Requires: python3-psycopg2 Requires(pre): shadow-utils -Requires: java-11-openjdk-headless >= %{openjdk_version} +Requires: java-11-openjdk-headless >= 11.0.4 Requires: python3-pwquality -Requires: python3-cryptography +Requires: python3-m2crypto >= 0.28 Requires: python3-dnf # We can drop these conflicts when @@ -469,12 +499,13 @@ Requires: %{name} = %{version}-%{release} %description dbscripts Database scripts for %{ovirt_product_name_short} + %package webadmin-portal Summary: Web Admin Portal of %{ovirt_product_name_short} Group: %{ovirt_product_group} Requires: %{name} = %{version}-%{release} # Bundled JavaScript and CSS libraries use MIT license. -License: Apache 2.0 and GPLv2+ with exceptions and MIT +License: ASL 2.0 and GPLv2+ with exceptions and MIT %description webadmin-portal The web administration interface to %{ovirt_product_name_short} @@ -486,7 +517,7 @@ Requires: %{name} = %{version}-%{release} Requires: python3-%{name}-lib >= %{version}-%{release} Requires: %{name}-tools-backup = %{version}-%{release} Requires: ovirt-engine-metrics >= 1.3.4.1 -Requires: java-11-openjdk-headless >= %{openjdk_version} +Requires: java-11-openjdk-headless Requires: logrotate Requires: python3-dateutil Requires: python3-netaddr @@ -523,7 +554,7 @@ Requires: tar Requires: bzip2 Requires: xz Requires: python3-otopi >= 1.9.0 -Requires: postgresql >= 12.0 +Requires: postgresql Requires: sqlite %description tools-backup @@ -581,7 +612,7 @@ with ovirt-vmconsole-proxy package Summary: Setup and upgrade specific plugins for vmconsole-proxy-helper Requires: %{name}-setup-plugin-ovirt-engine = %{version}-%{release} Requires: %{name}-setup-plugin-ovirt-engine-common = %{version}-%{release} -Requires: openssh +Requires: openssh >= 8.2p1 %description setup-plugin-vmconsole-proxy-helper Setup and upgrade specific plugins for vmconsole-proxy-helper @@ -591,7 +622,6 @@ Summary: %{ovirt_product_name_short} health check bundler. Group: %{ovirt_product_group} Requires: %{name}-setup-base = %{version}-%{release} Requires: makeself >= 2.2 -Requires: python3-otopi-devtools >= 1.9.0 %description health-check-bundler A utility for creating a bundle script that runs a health check. @@ -600,7 +630,7 @@ A utility for creating a bundle script that runs a health check. Summary: Setup and upgrade specific plugins for cinderlib integration database Requires: %{name}-setup-plugin-ovirt-engine = %{version}-%{release} Requires: %{name}-setup-plugin-ovirt-engine-common = %{version}-%{release} -Requires: openssh +Requires: openssh >= 8.2p1 %description setup-plugin-cinderlib Setup and upgrade specific plugins for cinderlib integration database @@ -619,29 +649,52 @@ Setup imageio service. %setup -c -q %patch1 -p1 %patch2 -p1 -mvn install:install-file -DgroupId=io.reactive.rxjava2 -DartifactId=rxjava -Dversion=2.2.4 -Dpackaging=jar -Dfile=%{SOURCE1} -mvn install:install-file -DgroupId=xalan -DartifactId=xalan -Dversion=2.7.1.jbossorg-2 -Dpackaging=jar -Dfile=%{SOURCE2} +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch7 -p1 +sed -i '87s/@Test/\/\/@Test/g' backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/LibvirtVmXmlBuilderTest.java +sed -i '88s/@MockedConfig/\/\/@MockedConfig/g' backend/manager/modules/vdsbroker/src/test/java/org/ovirt/engine/core/vdsbroker/builder/vminfo/LibvirtVmXmlBuilderTest.java +sed -i '121s/@Test/\/\/@Test/g' backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddClusterCommandTest.java +sed -i '122s/@MockedConfig/\/\/@MockedConfig/g' backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/AddClusterCommandTest.java +sed -i '209s/@Test/\/\/@Test/g' backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/UpdateClusterCommandTest.java +sed -i '99s/@Test/\/\/@Test/g' backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/ClusterValidatorTest.java +sed -i '91s/@Test/\/\/@Test/g' backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/validator/ClusterValidatorTest.java + +pushd /usr/lib/jvm + dir=`ls | grep java-11-openjdk-` + export JAVA_HOME="/usr/lib/jvm/${dir}" +popd + +mkdir api-model +cp %{SOURCE3} ./api-model +pushd api-model + tar -xvf 4.4.20.tar.gz + mkdir -p ~/.gem/jruby/1.9 + cd ovirt-engine-api-model-4.4.20 + sed -i '/PPC64,/a\ AARCH64,' src/main/java/types/Architecture.java + cp %{SOURCE4} ./ + patch -p1 < 0006-add-arm-biostype-in-front-end-api.patch + mvn clean install -DskipTests +popd + +mvn install:install-file -DgroupId=xalan -DartifactId=xalan -Dversion=2.7.1.jbossorg-2 -Dpackaging=jar -Dfile=%{SOURCE1} mkdir -p ~/.m2/repository/com/github/warmuuh/libsass-maven-plugin/0.2.8-libsass_3.4.4 -cp %{SOURCE3} ~/.m2/repository/com/github/warmuuh/libsass-maven-plugin/0.2.8-libsass_3.4.4 +cp %{SOURCE2} ~/.m2/repository/com/github/warmuuh/libsass-maven-plugin/0.2.8-libsass_3.4.4 sed -i 's/require=\"10240\";/require=\"1024\";/g' Makefile sed -i 's/MAVEN_OPTS=\"/MAVEN_OPTS=\"-Xmx16384m -Xms16384m /g' Makefile -sed -i 's/$(BUILD_FLAGS) \\/-Dgwt.compiler.localWorkers=2 $(BUILD_FLAGS) \\/g' Makefile -sed -i '/s validity is {validity_in_days} days./d' packaging/setup/ovirt_engine_setup/engine_common/pki_utils.py -sed -i "s/'fedora'/'fedora', 'openeuler'/g" packaging/setup/ovirt_engine_setup/util.py - -cat <> 10-wsgi-python3.conf - - LoadModule wsgi_module modules/mod_wsgi_python3.so - -EOT - -cat <> gg-sso.conf -SSO_CALLBACK_PREFIX_CHECK=false -EOT +sed -i 's/$(BUILD_FLAGS) \\/-Dgwt.compiler.localWorkers=2 $(BUILD_FLAGS) \\/g' Makefile +sed -i 's/BUILD_ALL_USER_AGENTS=0/BUILD_ALL_USER_AGENTS=1/g' Makefile +sed -i "s/import platform/import distro/g" packaging/setup/ovirt_engine_setup/engine_common/postgres.py +sed -i "s/platform.linux_distribution/distro.linux_distribution/g" packaging/setup/ovirt_engine_setup/engine_common/postgres.py +sed -i "s/'centos'/'centos', 'openeuler'/g" packaging/setup/ovirt_engine_setup/engine_common/postgres.py +sed -i "s/BUILD_LOCALES=0/BUILD_LOCALES=1/g" automation/build-artifacts.sh +sed -i "s/BUILD_LOCALES=0/BUILD_LOCALES=1/g" Makefile +sed -i '/slf4j/a\ ' backend/manager/modules/utils/src/main/modules/org/ovirt/engine/core/utils/main/module.xml %build -# Set the location of the JDK that will be used for compilation: -pushd /usr/lib/jvm/ +pushd /usr/lib/jvm dir=`ls | grep java-11-openjdk-` export JAVA_HOME="/usr/lib/jvm/${dir}" popd @@ -806,13 +859,10 @@ common/com/woorea/openstack/sdk/main/openstack-client.jar openstack-java-sdk/ope common/com/woorea/openstack/sdk/main/quantum-client.jar openstack-java-sdk/quantum-client.jar common/com/woorea/openstack/sdk/main/quantum-model.jar openstack-java-sdk/quantum-model.jar common/com/woorea/openstack/sdk/main/resteasy-connector.jar openstack-java-sdk/resteasy-connector.jar -common/net/i2p/crypto/eddsa/main/eddsa.jar common/org/aopalliance/main/aopalliance.jar common/org/apache/commons/compress/main/commons-compress.jar common/org/apache/commons/configuration/main/commons-configuration.jar common/org/apache/commons/jxpath/main/commons-jxpath.jar -common/org/apache/sshd/main/sshd-core.jar apache-sshd/sshd-core.jar -common/org/apache/sshd/main/sshd-common.jar apache-sshd/sshd-common.jar common/org/apache/ws/commons/main/ws-commons-util.jar common/org/apache/xmlrpc/main/xmlrpc-client.jar common/org/apache/xmlrpc/main/xmlrpc-common.jar @@ -893,13 +943,13 @@ perl -i -pe 's/^SHA1-Digest: [^\n]+\n//g' "%{buildroot}%{engine_ear}/META-INF/MA %endif -install -dm 755 "%{buildroot}%{_sysconfdir}/httpd/conf.modules.d" -cp 10-wsgi-python3.conf %{buildroot}%{_sysconfdir}/httpd/conf.modules.d -cp gg-sso.conf %{buildroot}%{engine_etc}/engine.conf.d/ - install -dm 755 "%{buildroot}%{engine_data}/modules/common/org/apache/sshd/main" -cp backend/target/lib/sshd-core-2.6.0.jar %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main -sed -i '/sshd-core.jar/a\ ' %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main/module.xml +cp backend/target/lib/sshd-core-2.5.0.jar %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main +cp backend/target/lib/sshd-common-2.5.0.jar %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main +rm -rf %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main/sshd-core.jar +rm -rf %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main/sshd-common.jar +sed -i 's/sshd-common.jar/sshd-common-2.5.0.jar/g' %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main/module.xml +sed -i 's/sshd-core.jar/sshd-core-2.5.0.jar/g' %{buildroot}%{engine_data}/modules/common/org/apache/sshd/main/module.xml install -dm 755 "%{buildroot}%{_datadir}/java/ebay-cors-filter" cp backend/manager/modules/utils/target/lib/cors-filter-1.0.1.jar %{buildroot}%{_datadir}/java/ebay-cors-filter/cors-filter.jar @@ -1087,7 +1137,7 @@ fi %files setup %license LICENSE %dir %{engine_rpm_state_dir} -%config %{_sysconfdir}/httpd/conf.modules.d/10-wsgi-python3.conf + %files setup-plugin-ovirt-engine %license LICENSE @@ -1194,7 +1244,6 @@ fi %{engine_data}/ansible-runner-service-project/project/ovirt-host-deploy.yml %{engine_data}/ansible-runner-service-project/project/replace-gluster.yml %{engine_data}/ansible-runner-service-project/project/ovirt-host-enroll-certificate.yml -%{engine_data}/ansible-runner-service-project/project/ovirt-host-fix-encrypted-migrations.yml %{engine_data}/ansible-runner-service-project/project/ovirt-host-remove.yml %{engine_data}/ansible-runner-service-project/project/ovirt-host-upgrade.yml %{engine_data}/ansible-runner-service-project/project/ovirt-host-check-upgrade.yml @@ -1202,7 +1251,6 @@ fi %{engine_data}/ansible-runner-service-project/project/ovirt-host-remove-yum-conf.yml %{engine_data}/ansible-runner-service-project/project/ovirt-host-yum-conf.yml %{engine_data}/ansible-runner-service-project/project/ovirt-ova-export.yml -%{engine_data}/ansible-runner-service-project/project/ovirt-ova-external-data.yml %{engine_data}/ansible-runner-service-project/project/ovirt-ova-import.yml %{engine_data}/ansible-runner-service-project/project/ovirt-ova-query.yml %{engine_data}/ansible-runner-service-project/project/ovirt-image-measure.yml @@ -1255,14 +1303,17 @@ fi %{engine_data}/setup/bin/ovirt-engine-health %changelog -* Fri May 27 2022 yanghuan - 4.4.7.7-4 +* Fri May 27 2022 yanghuan - 4.4.4.1-5 - Fix CVE-2020-10775 -* Wed Sep 15 2021 Ge Wang - 4.4.7.7-3 -- Fix aarch64 setup error +* Wed May 18 2022 jiangxinyu - 4.4.4.1-4 +- Change requires from postgresql-13-contrib postgresql-13-server and ansible-2.9 to postgresql-contrib postgresql-server and ansible -* Tue Sep 14 2021 Ge Wang - 4.4.7.7-2 -- Fix access denied and setup error due to sshd-core version mismatch and distribution nonrecognition - -* Mon Jul 19 2021 Python_Bot - 4.4.7.7-1 -- Init package +* Tue Nov 16 2021 Ge Wang - 4.4.4.1-3 +- Modify install require version and add confit item for openeuler + +* Wed Oct 13 2021 Ge Wang - 4.4.4.1-2 +- Fix interface report error when emulatedMachine is null + +* Thu Sep 23 2021 Python_Bot - 4.4.4.1-1 +- Initial package diff --git a/rxjava-2.2.4.jar b/rxjava-2.2.4.jar deleted file mode 100644 index 9953fb2..0000000 Binary files a/rxjava-2.2.4.jar and /dev/null differ