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 <abhishek.mrt22@gmail.com>

Co-authored-by: Harikrishna Patnala <harikrishna.patnala@gmail.com>
This commit is contained in:
Abhishek Kumar 2021-10-07 13:22:23 +05:30 committed by GitHub
parent 6ac834a358
commit 2a42a01728
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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)));
}