Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -157,15 +157,18 @@ private static class CpuFlagsManager {
private List<ServerCpu> amdCpuList;
private List<ServerCpu> ibmCpuList;
private List<ServerCpu> s390CpuList;
private List<ServerCpu> armCpuList;
private List<ServerCpu> allCpuList = new ArrayList<>();
private Map<String, ServerCpu> intelCpuByNameDictionary = new HashMap<>();
private Map<String, ServerCpu> amdCpuByNameDictionary = new HashMap<>();
private Map<String, ServerCpu> ibmCpuByNameDictionary = new HashMap<>();
private Map<String, ServerCpu> s390CpuByNameDictionary = new HashMap<>();
private Map<String, ServerCpu> armCpuByNameDictionary = new HashMap<>();
private Map<String, ServerCpu> intelCpuByVdsNameDictionary = new HashMap<>();
private Map<String, ServerCpu> amdCpuByVdsNameDictionary = new HashMap<>();
private Map<String, ServerCpu> ibmCpuByVdsNameDictionary = new HashMap<>();
private Map<String, ServerCpu> s390CpuByVdsNameDictionary = new HashMap<>();
private Map<String, ServerCpu> armCpuByVdsNameDictionary = new HashMap<>();

public CpuFlagsManager(Version ver) {
initDictionaries(ver);
Expand Down Expand Up @@ -200,6 +203,8 @@ public String getVendorByCpuName(String cpuName) {
result = CpuVendor.IBM.name();
} else if (s390CpuByNameDictionary.get(cpuName) != null) {
result = CpuVendor.IBMS390.name();
} else if (armCpuByNameDictionary.get(cpuName) != null) {
result = CpuVendor.AARCH64.name();
}
}
return result;
Expand All @@ -222,6 +227,10 @@ public ServerCpu getServerCpuByName(String cpuName) {
if (result == null) {
result = s390CpuByNameDictionary.get(cpuName);
}

if (result == null) {
result = armCpuByNameDictionary.get(cpuName);
}
}
return result;
}
Expand All @@ -233,6 +242,7 @@ public void initDictionaries(Version ver) {
amdCpuByNameDictionary.clear();
ibmCpuByNameDictionary.clear();
s390CpuByNameDictionary.clear();
armCpuByNameDictionary.clear();
allCpuList.clear();

String[] cpus = Config.<String> getValue(ConfigValues.ServerCPUList, ver.toString()).trim().split("[;]", -1);
Expand Down Expand Up @@ -271,6 +281,9 @@ public void initDictionaries(Version ver) {
} else if (sc.getFlags().contains(CpuVendor.IBMS390.getFlag())) {
s390CpuByNameDictionary.put(sc.getCpuName(), sc);
s390CpuByVdsNameDictionary.put(sc.getVdsVerbData(), sc);
} else if (sc.getFlags().contains(CpuVendor.AARCH64.getFlag())) {
armCpuByNameDictionary.put(sc.getCpuName(), sc);
armCpuByVdsNameDictionary.put(sc.getVdsVerbData(), sc);
}

allCpuList.add(sc);
Expand All @@ -283,6 +296,7 @@ public void initDictionaries(Version ver) {
amdCpuList = new ArrayList<>(amdCpuByNameDictionary.values());
ibmCpuList = new ArrayList<>(ibmCpuByNameDictionary.values());
s390CpuList = new ArrayList<>(s390CpuByNameDictionary.values());
armCpuList = new ArrayList<>(armCpuByNameDictionary.values());

Comparator<ServerCpu> cpuComparator = Comparator.comparingInt(ServerCpu::getLevel);

Expand All @@ -292,6 +306,7 @@ public void initDictionaries(Version ver) {
Collections.sort(amdCpuList, cpuComparator);
Collections.sort(ibmCpuList, cpuComparator);
Collections.sort(s390CpuList, cpuComparator);
Collections.sort(armCpuList, cpuComparator);
}

public String getVDSVerbDataByCpuName(String name) {
Expand All @@ -301,7 +316,8 @@ public String getVDSVerbDataByCpuName(String name) {
if ((sc = intelCpuByNameDictionary.get(name)) != null
|| (sc = amdCpuByNameDictionary.get(name)) != null
|| (sc = ibmCpuByNameDictionary.get(name)) != null
|| (sc = s390CpuByNameDictionary.get(name)) != null) {
|| (sc = s390CpuByNameDictionary.get(name)) != null
|| (sc = armCpuByNameDictionary.get(name)) != null) {
result = sc.getVdsVerbData();
}
}
Expand All @@ -315,7 +331,8 @@ public String getCpuNameByCpuId(String vdsName) {
if ((sc = intelCpuByVdsNameDictionary.get(vdsName)) != null
|| (sc = amdCpuByVdsNameDictionary.get(vdsName)) != null
|| (sc = ibmCpuByVdsNameDictionary.get(vdsName)) != null
|| (sc = s390CpuByVdsNameDictionary.get(vdsName)) != null) {
|| (sc = s390CpuByVdsNameDictionary.get(vdsName)) != null
|| (sc = armCpuByVdsNameDictionary.get(vdsName)) != null) {
result = sc.getCpuName();
}
}
Expand Down Expand Up @@ -346,6 +363,7 @@ public List<String> missingServerCpuFlags(String clusterCpuName, String serverFl
|| (clusterCpu = amdCpuByNameDictionary.get(clusterCpuName)) != null
|| (clusterCpu = ibmCpuByNameDictionary.get(clusterCpuName)) != null
|| (clusterCpu = s390CpuByNameDictionary.get(clusterCpuName)) != null
|| (clusterCpu = armCpuByNameDictionary.get(clusterCpuName)) != null
)) {
for (String flag : clusterCpu.getFlags()) {
if (!lstServerflags.contains(flag)) {
Expand Down Expand Up @@ -393,6 +411,10 @@ public boolean checkIfCpusSameManufacture(String cpuName1, String cpuName2) {
return s390CpuByNameDictionary.containsKey(cpuName2);
}

if (armCpuByNameDictionary.containsKey(cpuName1)) {
return armCpuByNameDictionary.containsKey(cpuName2);
}

return false;
}

Expand All @@ -401,7 +423,8 @@ public boolean checkIfCpusExist(String cpuName) {
&& (intelCpuByNameDictionary.containsKey(cpuName)
|| amdCpuByNameDictionary.containsKey(cpuName)
|| ibmCpuByNameDictionary.containsKey(cpuName)
|| s390CpuByNameDictionary.containsKey(cpuName));
|| s390CpuByNameDictionary.containsKey(cpuName)
|| armCpuByNameDictionary.containsKey(cpuName));
}

/**
Expand Down Expand Up @@ -441,6 +464,12 @@ public List<ServerCpu> findServerCpusByFlags(String flags) {
foundCpus.add(s390CpuList.get(i));
}
}
} else if (lstFlags.contains(CpuVendor.AARCH64.getFlag())) {
for (int i = armCpuList.size() - 1; i >= 0; i--) {
if (checkIfFlagsContainsCpuFlags(armCpuList.get(i), lstFlags)) {
foundCpus.add(armCpuList.get(i));
}
}
}
return foundCpus;
}
Expand Down Expand Up @@ -478,6 +507,12 @@ public List<ServerCpu> getSupportedServerCpuList(String maxCpuName) {
for (int i = 0; i <= selectedCpuIndex; i++) {
supportedCpus.add(s390CpuList.get(i));
}
} else if (armCpuByNameDictionary.containsKey(maxCpuName)) {
ServerCpu selected = armCpuByNameDictionary.get(maxCpuName);
int selectedCpuIndex = armCpuList.indexOf(selected);
for (int i = 0; i <= selectedCpuIndex; i++) {
supportedCpus.add(armCpuList.get(i));
}
}
return supportedCpus;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ public void runForS390X() {
hasMaximum = VmCommand.MAX_VIRTIO_CCW_DISKS == countDisks(DiskInterface.VirtIO);
}

@Override
public void runForAARCH64() {
hasMaximum = VmCommand.MAX_IDE_SLOTS == countDisks(DiskInterface.IDE);
}

public boolean returnValue() {
return hasMaximum;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ private static Map<String, Integer> createMaxNumberOfVmCpusMap() {
maxVmCpusMap.put("s390x", 384);
maxVmCpusMap.put("x86", 512);
maxVmCpusMap.put("ppc", 384);
maxVmCpusMap.put("aarch64", 384);
Comment thread
This conversation was marked as resolved.
return maxVmCpusMap;
}

Expand All @@ -179,6 +180,7 @@ private static Map<String, String> createHotPlugMemorySupportedMap() {
hotPlugMemoryMap.put("s390x", "false");
hotPlugMemoryMap.put("x86", "true");
hotPlugMemoryMap.put("ppc", "true");
hotPlugMemoryMap.put("aarch64", "true");
return hotPlugMemoryMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ private static Map<String, Integer> createMaxNumberOfVmCpusMap() {
maxVmCpusMap.put("s390x", 384);
maxVmCpusMap.put("x86", 710);
maxVmCpusMap.put("ppc", 384);
maxVmCpusMap.put("aarch64", 384);
Comment thread
This conversation was marked as resolved.
return maxVmCpusMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ private static Map<String, Integer> createMaxNumberOfVmCpusMap() {
maxVmCpusMap.put("s390x", 384);
maxVmCpusMap.put("x86", MAX_NUM_CPUS);
maxVmCpusMap.put("ppc", 384);
maxVmCpusMap.put("aarch64", 384);
Comment thread
This conversation was marked as resolved.
return maxVmCpusMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ private static Map<String, Integer> createMaxNumberOfVmCpusMap() {
maxVmCpusMap.put("s390x", 384);
maxVmCpusMap.put("x86", 16);
maxVmCpusMap.put("ppc", 384);
maxVmCpusMap.put("aarch64", 384);
Comment thread
This conversation was marked as resolved.
return maxVmCpusMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ public enum ArchitectureType implements Identifiable {
ppc(3),
/* Host & Guest architecture */
s390x(7),
/* Host & Guest architecture */
aarch64(8),

// Specific architectures
/* Host & Guest architecture */
Expand All @@ -25,6 +27,7 @@ public enum ArchitectureType implements Identifiable {
/* Guest architecture */
ppcle(6, ppc);

public static final int HOTPLUG_MEMORY_FACTOR_ARM_MB = 128;
public static final int HOTPLUG_MEMORY_FACTOR_PPC_MB = 256;
public static final int HOTPLUG_MEMORY_FACTOR_X86_MB = 128;
private int value;
Expand Down Expand Up @@ -64,6 +67,8 @@ public int getHotplugMemorySizeFactorMb() {
return HOTPLUG_MEMORY_FACTOR_X86_MB;
case ppc:
return HOTPLUG_MEMORY_FACTOR_PPC_MB;
case aarch64:
return HOTPLUG_MEMORY_FACTOR_ARM_MB;
default:
return getFamily().getHotplugMemorySizeFactorMb();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public interface OsRepository {
int DEFAULT_X86_OS = 0;
int DEFAULT_PPC_OS = 1001;
int DEFAULT_S390_OS = 2001;
int DEFAULT_AARCH64_OS = 3001;

/*
* This value is used to enable the auto selection of an appropriate OS when
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ public enum CpuVendor implements Serializable {
INTEL("vmx"),
AMD("svm"),
IBM("powernv"),
IBMS390("sie");
IBMS390("sie"),
AARCH64("asimd");

private final String flag;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,10 @@
<level>3</level>
<architecture>PPC64</architecture>
</cpu>
<cpu id="ARM64 v8">
<level>2</level>
<architecture>AARCH64</architecture>
</cpu>
</cpus>
<power_managers>
<power_management type="apc">
Expand Down Expand Up @@ -545,6 +549,7 @@
<os_type>ubuntu_13_04</os_type>
<os_type>ubuntu_12_10</os_type>
<os_type>windows_7x64</os_type>
<os_type>other_linux_aarch64</os_type>
</os_types>
<disk_formats>
<disk_format>cow</disk_format>
Expand Down Expand Up @@ -1236,18 +1241,21 @@
<architectures>undefined</architectures>
<architectures>x86_64</architectures>
<architectures>ppc64</architectures>
<architectures>aarch64</architectures>
</architecture_capability>
<architecture_capability>
<name>memory snapshot</name>
<architectures>undefined</architectures>
<architectures>x86_64</architectures>
<architectures>ppc64</architectures>
<architectures>aarch64</architectures>
</architecture_capability>
<architecture_capability>
<name>suspend</name>
<architectures>undefined</architectures>
<architectures>x86_64</architectures>
<architectures>ppc64</architectures>
<architectures>aarch64</architectures>
</architecture_capability>
</architecture_capabilities>
<serial_number_policies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ public static ArchitectureType map(Architecture model,
return ArchitectureType.ppc64;
case S390X:
return ArchitectureType.s390x;
case AARCH64:
return ArchitectureType.aarch64;
default:
return null;
}
Expand All @@ -52,6 +54,8 @@ public static Architecture map(ArchitectureType model,
return Architecture.PPC64;
case s390x:
return Architecture.S390X;
case aarch64:
return Architecture.AARCH64;
default:
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,13 @@ public enum OsRepositoryImpl implements OsRepository {
*/
private Map<Integer, String> idToUnameLookup;
private Map<String, Integer> backwardCompatibleNamesToIds;
private static Map<ArchitectureType, Integer> defaultOsMap = new HashMap<>(3);
private static Map<ArchitectureType, Integer> 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);
Comment thread
This conversation was marked as resolved.
}

public void init(MapBackedPreferences preferences) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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 extends ArchCommand> T run(T c) {
c.runForAARCH64();
return c;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ public interface ArchCommand {
void runForPPC64();

void runForS390X();

void runForAARCH64();
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ void booleanValue() : {} {
}

void archValue() : {} {
valueSpecifier() ("x86_64" | "ppc64" | "s390x")
valueSpecifier() ("x86_64" | "ppc64" | "s390x" | "aarch64")
}

void busValue() : {} {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ private static Map<String, Integer> createMaxNumberOfVmCpusMap() {
maxVmCpusMap.put("s390x", 384);
maxVmCpusMap.put("x86", 160);
maxVmCpusMap.put("ppc", 384);
maxVmCpusMap.put("aarch64", 384);
return maxVmCpusMap;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,9 @@ public void runForS390X() {
// For now same as on x86
runForX86_64();
}

@Override
public void runForAARCH64() {
// TODO, check for required settings
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,9 @@ public void runForS390X() {
// For now same as on x86
runForX86_64();
}

@Override
public void runForAARCH64() {
// There are not any additional controllers necessary for the aarch64 guests to work properly
}
}
Loading