From 2a42a01728d7847f8a99769fefb2f582f0154fb1 Mon Sep 17 00:00:00 2001 From: Abhishek Kumar Date: Thu, 7 Oct 2021 13:22:23 +0530 Subject: [PATCH] xcp-ng: fix vm boot options (#5543) * xcp-ng: fix vm boot options Use value boot option values from VM details directly similar to other hypervisor plugins instead of relying on boot properties explicitly set for VirtualMachineTO. Signed-off-by: Abhishek Kumar Co-authored-by: Harikrishna Patnala --- .../hypervisor/xenserver/resource/CitrixResourceBase.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java index bef6c41ad78..a9715765bf7 100644 --- a/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java +++ b/plugins/hypervisors/xenserver/src/main/java/com/cloud/hypervisor/xenserver/resource/CitrixResourceBase.java @@ -1426,7 +1426,9 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe throw new CloudRuntimeException("Unable to finalize VM MetaData: " + vmSpec); } try { - setVmBootDetails(vm, conn, vmSpec.getBootType(), vmSpec.getBootMode()); + String bootMode = org.apache.commons.lang3.StringUtils.defaultIfEmpty(vmSpec.getDetails().get(ApiConstants.BootType.UEFI.toString()), null); + String bootType = (bootMode == null) ? ApiConstants.BootType.BIOS.toString() : ApiConstants.BootType.UEFI.toString(); + setVmBootDetails(vm, conn, bootType, bootMode); } catch (final XenAPIException | XmlRpcException e) { throw new CloudRuntimeException(String.format("Unable to handle VM boot options: %s", vmSpec), e); } @@ -1938,9 +1940,6 @@ public abstract class CitrixResourceBase implements ServerResource, HypervisorRe } protected void setVmBootDetails(final VM vm, final Connection conn, String bootType, String bootMode) throws XenAPIException, XmlRpcException { - if (!ApiConstants.BootType.UEFI.toString().equals(bootType)) { - bootType = ApiConstants.BootType.BIOS.toString(); - } if (s_logger.isDebugEnabled()) { s_logger.debug(String.format("Setting boottype=%s and bootmode=%s for VM: %s", bootType, bootMode, vm.getUuid(conn))); }