DaanHoogland commented on a change in pull request #3638: UEFI Support on
CloudStack
URL: https://github.com/apache/cloudstack/pull/3638#discussion_r391681116
##########
File path:
plugins/hypervisors/kvm/src/main/java/com/cloud/hypervisor/kvm/resource/LibvirtComputingResource.java
##########
@@ -2098,11 +2140,44 @@ public LibvirtVMDef createVMFromSpec(final
VirtualMachineTO vmTO) {
}
guest.setGuestArch(_guestCpuArch != null ? _guestCpuArch :
vmTO.getArch());
guest.setMachineType(_guestCpuArch != null &&
_guestCpuArch.equals("aarch64") ? "virt" : "pc");
+ guest.setBootType(GuestDef.BootType.BIOS);
+ if (MapUtils.isNotEmpty(customParams) &&
customParams.containsKey(GuestDef.BootType.UEFI.toString())) {
+ guest.setBootType(GuestDef.BootType.UEFI);
+ guest.setBootMode(GuestDef.BootMode.LEGACY);
+ if
(StringUtils.isNotBlank(customParams.get(GuestDef.BootType.UEFI.toString())) &&
"secure".equalsIgnoreCase(customParams.get(GuestDef.BootType.UEFI.toString())))
{
+ guest.setMachineType("q35");
+ guest.setBootMode(GuestDef.BootMode.SECURE); // setting to
secure mode
+ }
+ }
guest.setUuid(uuid);
guest.setBootOrder(GuestDef.BootOrder.CDROM);
guest.setBootOrder(GuestDef.BootOrder.HARDISK);
- vm.addComp(guest);
+ if (isUefiEnabled) {
+ if (_uefiProperties.getProperty(GuestDef.GUEST_LOADER_SECURE) !=
null && "secure".equalsIgnoreCase(bootMode)) {
+
guest.setLoader(_uefiProperties.getProperty(GuestDef.GUEST_LOADER_SECURE));
+ }
+
+ if (_uefiProperties.getProperty(GuestDef.GUEST_LOADER_LEGACY) !=
null && "legacy".equalsIgnoreCase(bootMode)) {
+
guest.setLoader(_uefiProperties.getProperty(GuestDef.GUEST_LOADER_LEGACY));
+ }
+
+ if (_uefiProperties.getProperty(GuestDef.GUEST_NVRAM_PATH) !=
null) {
+
guest.setNvram(_uefiProperties.getProperty(GuestDef.GUEST_NVRAM_PATH));
+ }
+
+ if (isSecureBoot) {
+ if
(_uefiProperties.getProperty(GuestDef.GUEST_NVRAM_TEMPLATE_SECURE) != null &&
"secure".equalsIgnoreCase(bootMode)) {
+
guest.setNvramTemplate(_uefiProperties.getProperty(GuestDef.GUEST_NVRAM_TEMPLATE_SECURE));
+ }
+ } else {
+ if
(_uefiProperties.getProperty(GuestDef.GUEST_NVRAM_TEMPLATE_LEGACY) != null) {
+
guest.setNvramTemplate(_uefiProperties.getProperty(GuestDef.GUEST_NVRAM_TEMPLATE_LEGACY));
+ }
+ }
+ }
+
+ vm.addComp(guest);
Review comment:
please extract, see above
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services