Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion server/src/main/java/com/cloud/vm/UserVmManagerImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -6388,8 +6388,8 @@ protected void persistExtraConfigKvm(String decodedUrl, UserVm vm) {
// validate config against denied cfg commands
validateKvmExtraConfig(decodedUrl, vm.getAccountId());
String[] extraConfigs = decodedUrl.split("\n\n");
int i = 1;
for (String cfg : extraConfigs) {
int i = 1;
String[] cfgParts = cfg.split("\n");
String extraConfigKey = ApiConstants.EXTRA_CONFIG;
String extraConfigValue;
Expand Down
2 changes: 2 additions & 0 deletions ui/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,8 @@
"label.externalid": "External Id",
"label.externalloadbalanceripaddress": "External load balancer IP address.",
"label.extra": "Extra arguments",
"label.extraconfig": "Additional Configuration",
"label.extraconfig.tooltip": "Additional configuration parameters (extraconfig) to pass to the instance in plain text",
"label.f5": "F5",
"label.f5.ip.loadbalancer": "F5 BIG-IP load balancer.",
"label.failed": "Failed",
Expand Down
25 changes: 24 additions & 1 deletion ui/src/views/compute/DeployVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -724,6 +724,12 @@
</div>
</a-card>
</a-form-item>
<a-form-item v-if="extraConfigEnabledValue" name="extraconfig" ref="extraconfig">
<template #label>
<tooltip-label :title="$t('label.extraconfig')" :tooltip="$t('label.extraconfig.tooltip')"/>
</template>
<a-textarea v-model:value="form.extraconfig"/>
</a-form-item>
<a-form-item :label="$t('label.affinity.groups')">
<affinity-group-selection
:items="options.affinityGroups"
Expand Down Expand Up @@ -979,7 +985,8 @@ export default {
keyboards: [],
bootTypes: [],
bootModes: [],
ioPolicyTypes: []
ioPolicyTypes: [],
extraConfigEnabled: []
},
rowCount: {},
loading: {
Expand Down Expand Up @@ -1024,6 +1031,7 @@ export default {
sshKeyPairs: [],
sshKeyPair: {},
userData: {},
extraConfig: {},
userDataParams: [],
userDataParamCols: [
{
Expand Down Expand Up @@ -1274,6 +1282,15 @@ export default {
type: 'Routing'
},
field: 'hostid'
},
extraConfigEnabled: {
list: 'listConfigurations',
isLoad: true,
options: {
accountid: store.getters.userInfo.accountid,
name: 'enable.additional.vm.configuration'
},
field: 'value'
}
}
},
Expand Down Expand Up @@ -1418,6 +1435,9 @@ export default {
dynamicScalingVmConfigValue () {
return this.$store.getters.features.dynamicscalingenabled
},
extraConfigEnabledValue () {
return this.options.extraConfigEnabled?.[0]?.value === 'true'
},
isCustomizedDiskIOPS () {
return this.diskSelected?.iscustomizediops || false
},
Expand Down Expand Up @@ -2054,6 +2074,9 @@ export default {
if (isUserdataAllowed && values.userdata && values.userdata.length > 0) {
deployVmData.userdata = this.$toBase64AndURIEncoded(values.userdata)
}
if (values.extraconfig && values.extraconfig.length > 0) {
deployVmData.extraconfig = encodeURIComponent(values.extraconfig)
}
// step 2: select template/iso
if (this.tabKey === 'templateid') {
deployVmData.templateid = values.templateid
Expand Down
25 changes: 24 additions & 1 deletion ui/src/views/compute/EditVM.vue
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,12 @@
<a-textarea v-model:value="form.userdata">
</a-textarea>
</a-form-item>
<a-form-item v-if="extraConfigEnabled">
<template #label>
<tooltip-label :title="$t('label.extraconfig')" :tooltip="$t('label.extraconfig.tooltip')"/>
</template>
<a-textarea v-model:value="form.extraconfig"/>
</a-form-item>
<a-form-item ref="securitygroupids" name="securitygroupids" :label="$t('label.security.groups')" v-if="securityGroupsEnabled">
<a-select
mode="multiple"
Expand Down Expand Up @@ -151,6 +157,7 @@ export default {
serviceOffering: {},
template: {},
userDataEnabled: false,
extraConfigEnabled: false,
securityGroupsEnabled: false,
loading: false,
securitygroups: {
Expand Down Expand Up @@ -185,7 +192,8 @@ export default {
deleteprotection: this.resource.deleteprotection,
group: this.resource.group,
userdata: '',
haenable: this.resource.haenable
haenable: this.resource.haenable,
extraconfig: ''
})
this.rules = reactive({})
},
Expand All @@ -197,6 +205,7 @@ export default {
this.fetchServiceOfferingData()
this.fetchTemplateData()
this.fetchUserData()
this.fetchExtraConfigEnabled()
},
fetchZoneDetails () {
api('listZones', {
Expand Down Expand Up @@ -315,6 +324,17 @@ export default {
})
})
},
fetchExtraConfigEnabled () {
api('listConfigurations', {
accountid: this.$store.getters.userInfo.accountid,
name: 'enable.additional.vm.configuration'
}).then(json => {
const configResponse = json.listconfigurationsresponse.configuration || []
this.extraConfigEnabled = configResponse[0]?.value === 'true'
}).catch(error => {
this.$notifyError(error)
})
},

handleSubmit () {
this.formRef.value.validate().then(() => {
Expand Down Expand Up @@ -342,6 +362,9 @@ export default {
if (values.userdata && values.userdata.length > 0) {
params.userdata = this.$toBase64AndURIEncoded(values.userdata)
}
if (values.extraconfig && values.extraconfig.length > 0) {
params.extraconfig = encodeURIComponent(values.extraconfig)
}
this.loading = true

api('updateVirtualMachine', {}, 'POST', params).then(json => {
Expand Down