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
This commit is contained in:
davidjumani 2022-02-11 23:58:59 +05:30 committed by GitHub
parent 2d8f070ea4
commit a094dbc76e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View File

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

View File

@ -563,8 +563,8 @@
v-if="vm.templateid && ['KVM', 'VMware', 'XenServer'].includes(hypervisor) && !template.deployasis">
<a-form-item :label="$t('label.boottype')">
<a-select
v-decorator="['boottype', { initialValue: options.bootTypes && options.bootTypes.length > 0 ? options.bootTypes[0].id : undefined }]"
@change="fetchBootModes"
v-decorator="['boottype', { initialValue: defaultBootType ? defaultBootType : options.bootTypes && options.bootTypes.length > 0 ? options.bootTypes[0].id : undefined }]"
@change="onBootTypeChange"
showSearch
optionFilterProp="children"
:filterOption="filterOption" >
@ -575,7 +575,7 @@
</a-form-item>
<a-form-item :label="$t('label.bootmode')">
<a-select
v-decorator="['bootmode', { initialValue: options.bootModes && options.bootModes.length > 0 ? options.bootModes[0].id : undefined }]"
v-decorator="['bootmode', { initialValue: defaultBootMode ? defaultBootMode : options.bootModes && options.bootModes.length > 0 ? options.bootModes[0].id : undefined }]"
showSearch
optionFilterProp="children"
:filterOption="filterOption" >
@ -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