Repository navigation
Fix deploy VM from ISOs with UEFI #4773
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
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2405,7 +2405,7 @@ So if getMinSpeed() returns null we fall back to getSpeed(). | |
| DiskDef.DiskBus busT = getDiskModelFromVMDetail(vmTO); | ||
|
|
||
| if (busT == null) { | ||
| busT = getGuestDiskModel(vmTO.getPlatformEmulator()); | ||
| busT = getGuestDiskModel(vmTO.getPlatformEmulator(), isUefiEnabled); | ||
| } | ||
|
|
||
| // If we're using virtio scsi, then we need to add a virtual scsi controller | ||
|
|
@@ -2490,7 +2490,8 @@ public int compare(final DiskTO arg0, final DiskTO arg1) { | |
| } | ||
| }); | ||
|
|
||
| if (MapUtils.isNotEmpty(details) && details.containsKey(GuestDef.BootType.UEFI.toString())) { | ||
| boolean isUefiEnabled = MapUtils.isNotEmpty(details) && details.containsKey(GuestDef.BootType.UEFI.toString()); | ||
| if (isUefiEnabled) { | ||
| isSecureBoot = isSecureMode(details.get(GuestDef.BootType.UEFI.toString())); | ||
| } | ||
| if (vmSpec.getOs().toLowerCase().contains("window")) { | ||
|
|
@@ -2554,7 +2555,7 @@ public int compare(final DiskTO arg0, final DiskTO arg1) { | |
| // if params contains a rootDiskController key, use its value (this is what other HVs are doing) | ||
| DiskDef.DiskBus diskBusType = getDiskModelFromVMDetail(vmSpec); | ||
| if (diskBusType == null) { | ||
| diskBusType = getGuestDiskModel(vmSpec.getPlatformEmulator()); | ||
| diskBusType = getGuestDiskModel(vmSpec.getPlatformEmulator(), isUefiEnabled); | ||
| } | ||
|
|
||
| // I'm not sure why previously certain DATADISKs were hard-coded VIRTIO and others not, however this | ||
|
|
@@ -2564,16 +2565,9 @@ public int compare(final DiskTO arg0, final DiskTO arg1) { | |
| final DiskDef disk = new DiskDef(); | ||
| int devId = volume.getDiskSeq().intValue(); | ||
| if (volume.getType() == Volume.Type.ISO) { | ||
| if (volPath == null) { | ||
| if (isSecureBoot) { | ||
| disk.defISODisk(null, devId,isSecureBoot,isWindowsTemplate); | ||
| } else { | ||
| /* Add iso as placeholder */ | ||
| disk.defISODisk(null, devId); | ||
| } | ||
| } else { | ||
| disk.defISODisk(volPath, devId); | ||
| } | ||
|
|
||
| disk.defISODisk(volPath, devId, isUefiEnabled); | ||
|
|
||
| if (_guestCpuArch != null && _guestCpuArch.equals("aarch64")) { | ||
| disk.setBusType(DiskDef.DiskBus.SCSI); | ||
| } | ||
|
|
@@ -2598,14 +2592,14 @@ public int compare(final DiskTO arg0, final DiskTO arg1) { | |
| disk.defNetworkBasedDisk(glusterVolume + path.replace(mountpoint, ""), pool.getSourceHost(), pool.getSourcePort(), null, | ||
| null, devId, diskBusType, DiskProtocol.GLUSTER, DiskDef.DiskFmtType.QCOW2); | ||
| } else if (pool.getType() == StoragePoolType.CLVM || physicalDisk.getFormat() == PhysicalDiskFormat.RAW) { | ||
| if (volume.getType() == Volume.Type.DATADISK) { | ||
| if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) { | ||
| disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData); | ||
| } | ||
| else { | ||
| disk.defBlockBasedDisk(physicalDisk.getPath(), devId, diskBusType); | ||
| } | ||
| } else { | ||
| if (volume.getType() == Volume.Type.DATADISK) { | ||
| if (volume.getType() == Volume.Type.DATADISK && !(isWindowsTemplate && isUefiEnabled)) { | ||
| disk.defFileBasedDisk(physicalDisk.getPath(), devId, diskBusTypeData, DiskDef.DiskFmtType.QCOW2); | ||
| } else { | ||
| if (isSecureBoot) { | ||
|
|
@@ -3410,7 +3404,7 @@ private String getHypervisorPath(final Connect conn) { | |
| } | ||
|
|
||
| boolean isGuestPVEnabled(final String guestOSName) { | ||
| DiskDef.DiskBus db = getGuestDiskModel(guestOSName); | ||
| DiskDef.DiskBus db = getGuestDiskModel(guestOSName, false); | ||
| return db != DiskDef.DiskBus.IDE; | ||
| } | ||
|
|
||
|
|
@@ -3445,7 +3439,7 @@ public DiskDef.DiskBus getDiskModelFromVMDetail(final VirtualMachineTO vmTO) { | |
| return null; | ||
| } | ||
|
|
||
| private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) { | ||
| private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator, boolean isUefiEnabled) { | ||
| if (_guestCpuArch != null && _guestCpuArch.equals("aarch64")) { | ||
| return DiskDef.DiskBus.SCSI; | ||
| } | ||
|
|
@@ -3454,6 +3448,8 @@ private DiskDef.DiskBus getGuestDiskModel(final String platformEmulator) { | |
| return DiskDef.DiskBus.IDE; | ||
| } else if (platformEmulator.startsWith("Other PV Virtio-SCSI")) { | ||
| return DiskDef.DiskBus.SCSI; | ||
| } else if (isUefiEnabled && platformEmulator.startsWith("Windows")) { | ||
| return DiskDef.DiskBus.SATA; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this only required in case of UEFI secure mode only?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is required for both secure/legacy UEFI boot type on Windows machines |
||
| } else if (platformEmulator.contains("Ubuntu") || | ||
| platformEmulator.startsWith("Fedora") || | ||
| platformEmulator.startsWith("CentOS") || | ||
|
|
||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
third param here is UEFI secure mode or not, please check.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sureshanaparti here we check if UEFI is enabled because cdrom disk controller should be SATA for q35 machines