-
Notifications
You must be signed in to change notification settings - Fork 1.2k
KVM/s390x Support: Add support for KVM on s390x architecture #10038
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
DaanHoogland
merged 3 commits into
apache:main
from
linux-on-ibm-z:feature_s390x_arch_kvm_support
Jan 29, 2025
Merged
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -247,8 +247,8 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv | |
| /** | ||
| * Machine type. | ||
| */ | ||
| private static final String PC = "pc"; | ||
| private static final String VIRT = "virt"; | ||
| private static final String PC = ("s390x".equals(System.getProperty("os.arch"))) ? "s390-ccw-virtio" : "pc"; | ||
| private static final String VIRT = ("s390x".equals(System.getProperty("os.arch"))) ? "s390-ccw-virtio" : "virt"; | ||
|
|
||
| /** | ||
| * Possible devices to add to VM. | ||
|
|
@@ -305,6 +305,10 @@ public class LibvirtComputingResource extends ServerResourceBase implements Serv | |
| * Constant that defines ARM64 (aarch64) guest architectures. | ||
| */ | ||
| private static final String AARCH64 = "aarch64"; | ||
| /** | ||
| * Constant that defines IBM Z Arch (s390x) guest architectures. | ||
| */ | ||
| private static final String S390X = "s390x"; | ||
|
|
||
| public static final String RESIZE_NOTIFY_ONLY = "NOTIFYONLY"; | ||
| public static final String BASEPATH = "/usr/share/cloudstack-common/vms/"; | ||
|
|
@@ -1796,7 +1800,8 @@ private String matchPifFileInDirectory(final String bridgeName) { | |
| "^dummy", | ||
| "^lo", | ||
| "^p\\d+p\\d+", | ||
| "^vni" | ||
| "^vni", | ||
| "^enc" | ||
| }; | ||
|
|
||
| /** | ||
|
|
@@ -2642,12 +2647,15 @@ protected DevicesDef createDevicesDef(VirtualMachineTO vmTO, GuestDef guest, int | |
| } | ||
|
|
||
| devices.addDevice(createChannelDef(vmTO)); | ||
| devices.addDevice(createWatchDogDef()); | ||
| if (!isGuestS390x()) { | ||
| devices.addDevice(createWatchDogDef()); | ||
| } | ||
| devices.addDevice(createVideoDef(vmTO)); | ||
| devices.addDevice(createConsoleDef()); | ||
| devices.addDevice(createGraphicDef(vmTO)); | ||
| devices.addDevice(createTabletInputDef()); | ||
|
|
||
| if (!isGuestS390x()) { | ||
| devices.addDevice(createTabletInputDef()); | ||
| } | ||
| if (isGuestAarch64()) { | ||
| createArm64UsbDef(devices); | ||
| } | ||
|
|
@@ -2754,7 +2762,9 @@ protected FeaturesDef createFeaturesDef(Map<String, String> customParams, boolea | |
| FeaturesDef features = new FeaturesDef(); | ||
| features.addFeatures(PAE); | ||
| features.addFeatures(APIC); | ||
| features.addFeatures(ACPI); | ||
| if (!"s390x".equals(System.getProperty("os.arch"))) { | ||
|
||
| features.addFeatures(ACPI); | ||
| } | ||
| if (isUefiEnabled && isSecureBoot) { | ||
| features.addFeatures(SMM); | ||
| } | ||
|
|
@@ -2846,6 +2856,10 @@ private boolean isGuestAarch64() { | |
| return AARCH64.equals(guestCpuArch); | ||
| } | ||
|
|
||
| private boolean isGuestS390x() { | ||
| return S390X.equals(guestCpuArch); | ||
| } | ||
|
|
||
| /** | ||
| * Creates a guest definition from a VM specification. | ||
| */ | ||
|
|
@@ -2856,7 +2870,7 @@ protected GuestDef createGuestFromSpec(VirtualMachineTO vmTO, LibvirtVMDef vm, S | |
| guest.setManufacturer(vmTO.getMetadataManufacturer()); | ||
| guest.setProduct(vmTO.getMetadataProductName()); | ||
| guest.setGuestArch(guestCpuArch != null ? guestCpuArch : vmTO.getArch()); | ||
| guest.setMachineType(isGuestAarch64() ? VIRT : PC); | ||
| guest.setMachineType((isGuestAarch64() || isGuestS390x()) ? VIRT : PC); | ||
| guest.setBootType(GuestDef.BootType.BIOS); | ||
| if (MapUtils.isNotEmpty(customParams)) { | ||
| if (customParams.containsKey(GuestDef.BootType.UEFI.toString())) { | ||
|
|
@@ -2870,7 +2884,9 @@ protected GuestDef createGuestFromSpec(VirtualMachineTO vmTO, LibvirtVMDef vm, S | |
| guest.setIothreads(customParams.containsKey(VmDetailConstants.IOTHREADS)); | ||
| } | ||
| guest.setUuid(uuid); | ||
| guest.setBootOrder(GuestDef.BootOrder.CDROM); | ||
| if(!isGuestS390x()) { | ||
| guest.setBootOrder(GuestDef.BootOrder.CDROM); | ||
| } | ||
| guest.setBootOrder(GuestDef.BootOrder.HARDISK); | ||
| return guest; | ||
| } | ||
|
|
@@ -3110,7 +3126,7 @@ public int compare(final DiskTO arg0, final DiskTO arg1) { | |
| final DiskDef.DiskType diskType = getDiskType(physicalDisk); | ||
| disk.defISODisk(volPath, devId, isUefiEnabled, diskType); | ||
|
|
||
| if (guestCpuArch != null && guestCpuArch.equals("aarch64")) { | ||
| if (guestCpuArch != null && (guestCpuArch.equals("aarch64") || guestCpuArch.equals("s390x"))) { | ||
| disk.setBusType(DiskDef.DiskBus.SCSI); | ||
| } | ||
| } else { | ||
|
|
@@ -3208,7 +3224,7 @@ public int compare(final DiskTO arg0, final DiskTO arg1) { | |
| if (vmSpec.getType() != VirtualMachine.Type.User) { | ||
| final DiskDef iso = new DiskDef(); | ||
| iso.defISODisk(sysvmISOPath, DiskDef.DiskType.FILE); | ||
| if (guestCpuArch != null && guestCpuArch.equals("aarch64")) { | ||
| if (guestCpuArch != null && (guestCpuArch.equals("aarch64") || guestCpuArch.equals("s390x"))) { | ||
| iso.setBusType(DiskDef.DiskBus.SCSI); | ||
| } | ||
| vm.getDevices().addDevice(iso); | ||
|
|
@@ -4276,7 +4292,7 @@ private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator, boolean | |
| return DiskDef.DiskBus.VIRTIO; | ||
| } else if (isUefiEnabled && StringUtils.startsWithAny(platformEmulator, "Windows", "Other")) { | ||
| return DiskDef.DiskBus.SATA; | ||
| } else if (guestCpuArch != null && guestCpuArch.equals("aarch64")) { | ||
| } else if (guestCpuArch != null && (guestCpuArch.equals("aarch64") || guestCpuArch.equals("s390x"))) { | ||
| return DiskDef.DiskBus.SCSI; | ||
| } else { | ||
| return DiskDef.DiskBus.IDE; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.