config-tools: check if the cpu_affinity is null

The cpu_affinity is null when creating a new scenario. Do not update the
pcpu properties if the cpu_affinity is null.

Tracked-On: #8145
Signed-off-by: Yang,Yu-chu <yu-chu.yang@intel.com>
This commit is contained in:
Yang,Yu-chu 2022-10-05 14:05:10 -07:00 committed by acrnsi-robot
parent 6a1acd7b5e
commit 914e7a1d25
1 changed files with 1 additions and 1 deletions

View File

@ -347,7 +347,7 @@ export default {
},
updateCpuAffinity(vmid) {
this.scenario.vm.map((vmConfig, vmIndex) => {
if (vmConfig['@id'] === vmid) {
if (vmConfig['@id'] === vmid && vmConfig['cpu_affinity'] != null) {
for (let i = 0; i < vmConfig['cpu_affinity']['pcpu'].length; i++) {
this.scenario.vm[vmIndex]['cpu_affinity']['pcpu'][i]['real_time_vcpu'] = 'n'
}