From 0d7527ce2fecf199063548eba79420984578c802 Mon Sep 17 00:00:00 2001 From: "Yang,Yu-chu" Date: Mon, 12 Sep 2022 11:07:29 -0700 Subject: [PATCH] config-tools: diable real_time_vcpu for non real-time VM Reset the real_time_vcpu to 'n' if the VM is not a real-time VM. Tracked-On: #8145 Signed-off-by: Yang,Yu-chu Reviewed-by: Junjie Mao --- .../packages/configurator/src/pages/Config.vue | 10 ++++++++++ .../configurator/src/pages/Config/ConfigForm.vue | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue index c094ca3d0..90cec59de 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config.vue @@ -86,6 +86,7 @@ @deleteVM="deleteVM" @scenarioConfigFormDataUpdate="scenarioConfigFormDataUpdate" @vmNameChange="vmNameChange" + @updateCpuAffinity="updateCpuAffinity" /> @@ -344,6 +345,15 @@ export default { } } }, + updateCpuAffinity(vmid) { + this.scenario.vm.map((vmConfig, vmIndex) => { + if (vmConfig['@id'] === vmid) { + for (let i = 0; i < vmConfig['cpu_affinity']['pcpu'].length; i++) { + this.scenario.vm[vmIndex]['cpu_affinity']['pcpu'][i]['real_time_vcpu'] = 'n' + } + } + }) + }, assignVMID() { let vm_priority = { 'PRE_LAUNCHED_VM': 0, diff --git a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue index 7949f7358..f9571cb49 100644 --- a/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue +++ b/misc/config_tools/configurator/packages/configurator/src/pages/Config/ConfigForm.vue @@ -60,7 +60,7 @@ i18n.useLocal(localizeEn); export default { name: "ConfigForm", components: {Icon, Minus, VueForm, CAT, VUART, cpu_affinity, IVSHMEM_REGION}, - emits: ['scenarioConfigFormDataUpdate', 'deleteVM', 'vmNameChange'], + emits: ['scenarioConfigFormDataUpdate', 'deleteVM', 'vmNameChange', 'updateCpuAffinity'], props: { currentActiveVMID: {type: Number}, currentFormSchema: {type: Object}, @@ -125,6 +125,7 @@ export default { dataChange({newValue, oldValue}) { let newID = newValue.hasOwnProperty('@id') ? newValue['@id'] : -1; let oldID = oldValue.hasOwnProperty('@id') ? oldValue['@id'] : -1; + let vmType = newValue.hasOwnProperty('vm_type') ? newValue['vm_type'] : ""; if (newID === oldID) { // skip hv settings @@ -133,6 +134,9 @@ export default { this.$emit('vmNameChange', newValue.name, this.vmNameCache) this.vmNameCache = newValue.name; } + if (vmType != 'RTVM') { + this.$emit('updateCpuAffinity', newID) + } } this.$emit('scenarioConfigFormDataUpdate', newID, newValue) } else {