From a094dbc76e8393f53b1e39b069b79c4b332b9af4 Mon Sep 17 00:00:00 2001 From: davidjumani Date: Fri, 11 Feb 2022 23:58:59 +0530 Subject: [PATCH] Add option to infer boot type and mode from template (#5974) * Add option to infer boot type and mode from template * Rename to defaultBootType and mode --- .../java/com/cloud/api/query/QueryManagerImpl.java | 2 ++ ui/src/views/compute/DeployVM.vue | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java index 57ac7d03394..d6a3ab6474a 100644 --- a/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java +++ b/server/src/main/java/com/cloud/api/query/QueryManagerImpl.java @@ -3969,6 +3969,8 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q throw new CloudRuntimeException("Invalid/null detail-options response object passed"); } + options.put(ApiConstants.BootType.UEFI.toString(), Arrays.asList(ApiConstants.BootMode.LEGACY.toString(), + ApiConstants.BootMode.SECURE.toString())); options.put(VmDetailConstants.KEYBOARD, Arrays.asList("uk", "us", "jp", "fr")); options.put(VmDetailConstants.CPU_CORE_PER_SOCKET, Collections.emptyList()); options.put(VmDetailConstants.ROOT_DISK_SIZE, Collections.emptyList()); diff --git a/ui/src/views/compute/DeployVM.vue b/ui/src/views/compute/DeployVM.vue index b955dafc2c9..f5af72ebd90 100644 --- a/ui/src/views/compute/DeployVM.vue +++ b/ui/src/views/compute/DeployVM.vue @@ -563,8 +563,8 @@ v-if="vm.templateid && ['KVM', 'VMware', 'XenServer'].includes(hypervisor) && !template.deployasis"> @@ -575,7 +575,7 @@ @@ -846,6 +846,8 @@ export default { }, instanceConfig: {}, template: {}, + defaultBootType: '', + defaultBootMode: '', templateConfigurations: [], templateNics: [], templateLicenses: [], @@ -1532,6 +1534,9 @@ export default { if (template) { var size = template.size / (1024 * 1024 * 1024) || 0 // bytes to GB this.dataPreFill.minrootdisksize = Math.ceil(size) + this.defaultBootType = this.template?.details?.UEFI ? 'UEFI' : '' + this.fetchBootModes(this.defaultBootType) + this.defaultBootMode = this.template?.details?.UEFI } } else if (name === 'isoid') { this.templateConfigurations = [] @@ -2326,7 +2331,8 @@ export default { }, onBootTypeChange (value) { this.fetchBootModes(value) - this.updateFieldValue('bootmode', this.options.bootModes?.[0]?.id || undefined) + this.defaultBootMode = this.options.bootModes?.[0]?.id || undefined + this.updateFieldValue('bootmode', this.defaultBootMode) }, handleNicsNetworkSelection (nicToNetworkSelection) { this.nicToNetworkSelection = nicToNetworkSelection