mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-09 12:49:24 +00:00
config_tool: load default cpu affinity config by vm_name
1. load default cpu affinity config from scenario file by vm_name. Tracked-On: #6724 Signed-off-by: Weiyi Feng <weiyix.feng@intel.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
#
|
||||
# SPDX-License-Identifier: BSD-3-Clause
|
||||
#
|
||||
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
@@ -193,12 +193,6 @@ def main(args):
|
||||
err_dic['user_vmid err:'] = "--user_vmid shoudl be positive and less than total post vm count in scenario"
|
||||
if vm_th and vm_th not in post_num_list:
|
||||
err_dic['user_vmid err:'] = "--user_vmid generate the {} post vm, but this vm's config not in launch xml".format(vm_th)
|
||||
if launch_vm_count > post_vm_count:
|
||||
err_dic['xm config err:'] = "too many vms config than scenario"
|
||||
|
||||
for post_num in post_num_list:
|
||||
if post_num > post_vm_count:
|
||||
err_dic['xm config err:'] = "launch xml user vmid config is bigger than scenario post vm count"
|
||||
|
||||
# validate vm_names
|
||||
scenario_names = common.get_leaf_tag_map(scenario_info_file, "name").values()
|
||||
@@ -208,8 +202,11 @@ def main(args):
|
||||
err_dic[err_name] = 'vm_name only allowed 1-15 characters with letters, numbers & symbols ' \
|
||||
'(not include space)'
|
||||
if vm_name not in scenario_names:
|
||||
err_name = 'user_vm id="{}" name not found error:'.format(user_vm_id)
|
||||
err_dic[err_name] = 'user_vm id="{}" vm_name not found in it scenario file:'.format(user_vm_id)
|
||||
logging.warning(
|
||||
'user_vm id="{}"\'s vm_name ({}) not found in scenario file, set it to dynamic vm.'.format(
|
||||
user_vm_id, vm_name
|
||||
)
|
||||
)
|
||||
|
||||
if err_dic:
|
||||
return err_dic
|
||||
|
@@ -20,6 +20,7 @@ class AcrnDmArgs:
|
||||
def get_args(self):
|
||||
self.args["user_vm_type"] = common.get_leaf_tag_map(self.launch_info, "user_vm_type")
|
||||
self.args["rtos_type"] = common.get_leaf_tag_map(self.launch_info, "rtos_type")
|
||||
self.args['vm_name'] = common.get_leaf_tag_map(self.launch_info, 'vm_name')
|
||||
self.args["mem_size"] = common.get_leaf_tag_map(self.launch_info, "mem_size")
|
||||
self.args["vbootloader"] = common.get_leaf_tag_map(self.launch_info, "vbootloader")
|
||||
self.args["vuart0"] = common.get_leaf_tag_map(self.launch_info, "vuart0")
|
||||
@@ -27,12 +28,19 @@ class AcrnDmArgs:
|
||||
self.args["pm_channel"] = common.get_leaf_tag_map(self.launch_info, "poweroff_channel")
|
||||
self.args["cpu_affinity"] = common.get_leaf_tag_map(self.launch_info, "cpu_affinity", "pcpu_id")
|
||||
# get default cpu_affinity from scenario file
|
||||
scenario_names = {v: k for k, v in common.get_leaf_tag_map(self.scenario_info, "name").items()}
|
||||
scenario_cpu_aff = common.get_leaf_tag_map(self.scenario_info, "cpu_affinity", "pcpu_id")
|
||||
for vm_id, cpu_ids in self.args["cpu_affinity"].items():
|
||||
cpu_ids = [x for x in cpu_ids if x is not None]
|
||||
if cpu_ids:
|
||||
continue
|
||||
self.args["cpu_affinity"][vm_id] = scenario_cpu_aff[vm_id]
|
||||
vm_name = self.args['vm_name'][vm_id]
|
||||
if vm_name not in scenario_names:
|
||||
key = "vm:id={},{}".format(vm_id, 'cpu_affinity')
|
||||
launch_cfg_lib.ERR_LIST[key] = "Dynamic VM needs to configure cpu_affinity parameters"
|
||||
continue
|
||||
|
||||
self.args["cpu_affinity"][vm_id] = scenario_cpu_aff[scenario_names[vm_name]]
|
||||
|
||||
self.args["shm_enabled"] = common.get_hv_item_tag(self.scenario_info, "FEATURES", "IVSHMEM", "IVSHMEM_ENABLED")
|
||||
self.args["shm_regions"] = common.get_leaf_tag_map(self.launch_info, "shm_regions", "shm_region")
|
||||
@@ -57,7 +65,7 @@ class AcrnDmArgs:
|
||||
launch_cfg_lib.args_aval_check(self.args["enable_ptm"], "enable_ptm", launch_cfg_lib.y_n)
|
||||
launch_cfg_lib.args_aval_check(self.args["allow_trigger_s5"], "allow_trigger_s5", launch_cfg_lib.y_n)
|
||||
cpu_affinity = launch_cfg_lib.user_vm_cpu_affinity(self.args["cpu_affinity"])
|
||||
err_dic = scenario_cfg_lib.vm_cpu_affinity_check(self.scenario_info, cpu_affinity)
|
||||
err_dic = scenario_cfg_lib.vm_cpu_affinity_check(self.scenario_info, self.launch_info, cpu_affinity)
|
||||
launch_cfg_lib.ERR_LIST.update(err_dic)
|
||||
launch_cfg_lib.check_shm_regions(self.args["shm_regions"], self.scenario_info)
|
||||
launch_cfg_lib.check_console_vuart(self.args["console_vuart"], self.args["vuart0"], self.scenario_info)
|
||||
|
Reference in New Issue
Block a user