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 <yu-chu.yang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Yang,Yu-chu 2022-09-12 11:07:29 -07:00 committed by acrnsi-robot
parent d579a0be47
commit 0d7527ce2f
2 changed files with 15 additions and 1 deletions

View File

@ -86,6 +86,7 @@
@deleteVM="deleteVM"
@scenarioConfigFormDataUpdate="scenarioConfigFormDataUpdate"
@vmNameChange="vmNameChange"
@updateCpuAffinity="updateCpuAffinity"
/>
</div>
</div>
@ -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,

View File

@ -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 {