mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-18 11:47:30 +00:00
acrn-config: refinement for library config
Some API calls have the same function in library config, the patch refines the API calls. Tracked-On: #3854 Signed-off-by: Wei Liu <weix.w.liu@intel.com> Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
parent
1e2333647e
commit
71c51a8f6f
@ -438,6 +438,10 @@ def dm_arg_set(names, sel, dm, vmid, config):
|
||||
# uuid get
|
||||
scenario_uuid = launch_cfg_lib.get_scenario_uuid()
|
||||
sos_vmid = launch_cfg_lib.get_sos_vmid()
|
||||
if not str(sos_vmid).isnumeric():
|
||||
sos_vmid = 0
|
||||
key = "launch config err:"
|
||||
launch_cfg_lib.ERR_LIST[key] = "There is no SOS_VM in scenario config file!"
|
||||
|
||||
# clearlinux/android/alios
|
||||
dm_str = 'acrn-dm -A -m $mem_size -s 0:0,hostbridge -U {}'.format(scenario_uuid[vmid + sos_vmid])
|
||||
|
@ -14,14 +14,14 @@ class AcrnDmArgs:
|
||||
self.launch_info = launch_info
|
||||
|
||||
def get_args(self):
|
||||
self.args["uos_type"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "uos_type")
|
||||
self.args["rtos_type"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "rtos_type")
|
||||
self.args["mem_size"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "mem_size")
|
||||
self.args["gvt_args"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "gvt_args")
|
||||
self.args["rootfs_dev"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "rootfs_dev")
|
||||
self.args["rootfs_img"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "rootfs_img")
|
||||
self.args["vbootloader"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "vbootloader")
|
||||
self.args["console_type"] = launch_cfg_lib.get_sub_tree_tag(self.launch_info, "console_type")
|
||||
self.args["uos_type"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "uos_type")
|
||||
self.args["rtos_type"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "rtos_type")
|
||||
self.args["mem_size"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "mem_size")
|
||||
self.args["gvt_args"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "gvt_args")
|
||||
self.args["rootfs_dev"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "rootfs_dev")
|
||||
self.args["rootfs_img"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "rootfs_img")
|
||||
self.args["vbootloader"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "vbootloader")
|
||||
self.args["console_type"] = launch_cfg_lib.get_leaf_tag_map(self.launch_info, "console_type")
|
||||
self.args["off_pcpus"] = launch_cfg_lib.get_leaf_tag_map(self.scenario_info, "vcpu_affinity", "pcpu_id")
|
||||
|
||||
def check_item(self):
|
||||
|
@ -155,16 +155,6 @@ def get_tree_tag(config_file, tag_str):
|
||||
return common.get_tree_tag_val(config_file, tag_str)
|
||||
|
||||
|
||||
def get_sub_tree_tag(config_file, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
:param config_file: it is a file what contains information for script to read from
|
||||
:param tag_str: it is key of pattern to config file item
|
||||
:return: value of tag_str item
|
||||
"""
|
||||
return common.get_branch_tag_val(config_file, tag_str)
|
||||
|
||||
|
||||
def get_sub_leaf_tag(config_file, branch_tag, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
|
@ -23,6 +23,23 @@ GUEST_FLAG = ["0UL", "GUEST_FLAG_SECURE_WORLD_ENABLED", "GUEST_FLAG_LAPIC_PASSTH
|
||||
START_HPA_SIZE_LIST = ['0x20000000', '0x40000000', '0x80000000', 'CONFIG_SOS_RAM_SIZE', 'VM0_MEM_SIZE']
|
||||
|
||||
|
||||
MULTI_ITEM = ["guest_flag", "pcpu_id"]
|
||||
|
||||
|
||||
class MultiItem():
|
||||
|
||||
def __init__(self):
|
||||
self.guest_flag = []
|
||||
self.pcpu_id = []
|
||||
self.vir_console = []
|
||||
self.vir_net = []
|
||||
|
||||
class TmpItem():
|
||||
|
||||
def __init__(self):
|
||||
self.tag = {}
|
||||
self.multi = MultiItem
|
||||
|
||||
def open_license():
|
||||
""" Get the license """
|
||||
with open(HV_LICENSE_FILE, 'r') as f_licence:
|
||||
@ -331,84 +348,8 @@ def get_tree_tag_val(config_file, tag_str):
|
||||
return False
|
||||
|
||||
|
||||
def get_branch_tag_val(config_file, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
:param config_file: it is a file what contains information for script to read from
|
||||
:param tag_str: it is key of pattern to config file item
|
||||
:return: value of tag_str item list
|
||||
"""
|
||||
tmp_tag = []
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
for sub in item:
|
||||
if sub.tag == tag_str:
|
||||
tmp_tag.append(sub.text)
|
||||
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_spec_branch_tag_val(config_file, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
:param config_file: it is a file what contains information for script to read from
|
||||
:param tag_str: it is key of pattern to config file item
|
||||
:return: value of tag_str item list
|
||||
"""
|
||||
tmp_tag = {}
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
id_i = int(item.attrib['id'])
|
||||
for sub in item:
|
||||
if sub.tag == tag_str:
|
||||
if sub.text == None or not sub.text:
|
||||
tmp_tag[id_i] = ''
|
||||
else:
|
||||
tmp_tag[id_i] = sub.text
|
||||
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_branch_tag_map(config_file, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
:param config_file: it is a file what contains information for script to read from
|
||||
:param tag_str: it is key of pattern to config file item
|
||||
:return: value of tag_str item dictionary
|
||||
"""
|
||||
tmp_tag = {}
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
vm_id = int(item.attrib['id'])
|
||||
for sub in item:
|
||||
if sub.tag == tag_str:
|
||||
tmp_tag[vm_id] = sub.text
|
||||
|
||||
#if item.tag == "vm":
|
||||
# vm_id += 1
|
||||
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_spec_leaf_tag_val(config_file, branch_tag, tag_str):
|
||||
tmp_tag = {}
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
id_i = int(item.attrib['id'])
|
||||
for sub in item:
|
||||
if sub.tag == branch_tag:
|
||||
for leaf in sub:
|
||||
if leaf.tag == tag_str and tag_str != "guest_flag" and tag_str != "pcpu_id" and\
|
||||
sub.tag != "vuart":
|
||||
if leaf.text == None or not leaf.text:
|
||||
tmp_tag[id_i] = ''
|
||||
else:
|
||||
tmp_tag[id_i] = leaf.text
|
||||
continue
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_leaf_tag_val(config_file, branch_tag, tag_str):
|
||||
# TODO: This will be abandonment in future
|
||||
def get_leaf_tag_val(config_file, branch_tag, tag_str=''):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
:param config_file: it is a file what contains information for script to read from
|
||||
@ -419,13 +360,18 @@ def get_leaf_tag_val(config_file, branch_tag, tag_str):
|
||||
tmp_tag = []
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
# for each 2th level item
|
||||
for sub in item:
|
||||
tmp_flag = []
|
||||
tmp_cpus = []
|
||||
if sub.tag == branch_tag:
|
||||
if not tag_str:
|
||||
tmp_tag.append(sub.text)
|
||||
continue
|
||||
|
||||
# for each 3rd level item
|
||||
for leaf in sub:
|
||||
if leaf.tag == tag_str and tag_str != "guest_flag" and tag_str != "pcpu_id" and\
|
||||
sub.tag != "vuart":
|
||||
if leaf.tag == tag_str and tag_str not in MULTI_ITEM and sub.tag != "vuart":
|
||||
tmp_tag.append(leaf.text)
|
||||
continue
|
||||
|
||||
@ -450,10 +396,33 @@ def get_leaf_tag_val(config_file, branch_tag, tag_str):
|
||||
tmp_tag.append(tmp_cpus)
|
||||
continue
|
||||
|
||||
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_leaf_value(tmp, tag_str, leaf):
|
||||
|
||||
# get guest flag for logical partition vm1
|
||||
if leaf.tag == "guest_flag" and tag_str == "guest_flag":
|
||||
t_flag = find_tmp_flag(leaf.text)
|
||||
tmp.multi.guest_flag.append(t_flag)
|
||||
|
||||
# get cpu for vm
|
||||
if leaf.tag == "pcpu_id" and tag_str == "pcpu_id":
|
||||
tmp.multi.pcpu_id.append(leaf.text)
|
||||
|
||||
|
||||
def get_sub_value(tmp, tag_str, vm_id):
|
||||
|
||||
# append guest flags for each vm
|
||||
if tmp.multi.guest_flag and tag_str == "guest_flag":
|
||||
tmp.tag[vm_id] = tmp.multi.guest_flag
|
||||
tmp.tag.append(tmp.multi.guest_flag)
|
||||
|
||||
# append cpus for vm
|
||||
if tmp.multi.pcpu_id and tag_str == "pcpu_id":
|
||||
tmp.tag[vm_id] = tmp.multi.pcpu_id
|
||||
|
||||
|
||||
def get_leaf_tag_map(config_file, branch_tag, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
@ -462,45 +431,35 @@ def get_leaf_tag_map(config_file, branch_tag, tag_str):
|
||||
:param tag_str: it is key of pattern to config file leaf tag item
|
||||
:return: value of tag_str item map
|
||||
"""
|
||||
tmp_tag = {}
|
||||
vm_id = 0
|
||||
tmp = TmpItem()
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
vm_id = int(item.attrib['id'])
|
||||
# for each 2th level item
|
||||
for sub in item:
|
||||
tmp_flag = []
|
||||
tmp_cpus = []
|
||||
tmp.multi = MultiItem()
|
||||
if sub.tag == branch_tag:
|
||||
if not tag_str:
|
||||
if sub.text == None or not sub.text:
|
||||
tmp.tag[vm_id] = ''
|
||||
else:
|
||||
tmp.tag[vm_id] = sub.text
|
||||
continue
|
||||
|
||||
# for each 3rd level item
|
||||
for leaf in sub:
|
||||
if leaf.tag == tag_str and tag_str != "guest_flag" and tag_str != "pcpu_id"\
|
||||
and sub.tag != "vuart":
|
||||
tmp_tag[vm_id] = leaf.text
|
||||
if leaf.tag == tag_str and tag_str not in MULTI_ITEM and sub.tag != "vuart":
|
||||
if leaf.text == None or not leaf.text:
|
||||
tmp.tag[vm_id] = ''
|
||||
else:
|
||||
tmp.tag[vm_id] = leaf.text
|
||||
continue
|
||||
|
||||
# get guest flag for logical partition vm1
|
||||
if leaf.tag == "guest_flag" and tag_str == "guest_flag":
|
||||
tmp_flag = find_tmp_flag(tmp_flag, leaf.text)
|
||||
continue
|
||||
get_leaf_value(tmp, tag_str, leaf)
|
||||
|
||||
# get cpu for vm
|
||||
if leaf.tag == "pcpu_id" and tag_str == "pcpu_id":
|
||||
tmp_cpus.append(leaf.text)
|
||||
continue
|
||||
get_sub_value(tmp, tag_str, vm_id)
|
||||
|
||||
# append guest flags for each vm
|
||||
if tmp_flag and tag_str == "guest_flag":
|
||||
tmp_tag[vm_id] = tmp_flag
|
||||
continue
|
||||
|
||||
# append cpus for vm
|
||||
if tmp_cpus and tag_str == "pcpu_id":
|
||||
tmp_tag[vm_id] = tmp_cpus
|
||||
continue
|
||||
|
||||
if item.tag == "vm":
|
||||
vm_id += 1
|
||||
|
||||
|
||||
return tmp_tag
|
||||
return tmp.tag
|
||||
|
||||
|
||||
def order_type_map_vmid(config_file, vm_count):
|
||||
@ -511,7 +470,7 @@ def order_type_map_vmid(config_file, vm_count):
|
||||
:return: table of id:order type dictionary
|
||||
"""
|
||||
order_id_dic = {}
|
||||
load_type_list = get_branch_tag_val(config_file, "load_order")
|
||||
load_type_list = get_leaf_tag_val(config_file, "load_order")
|
||||
for i in range(vm_count):
|
||||
order_id_dic[i] = load_type_list[i]
|
||||
|
||||
@ -570,7 +529,7 @@ def vm_pre_launch_cnt(config_file):
|
||||
:return: number of pre launched vm
|
||||
"""
|
||||
pre_launch_cnt = 0
|
||||
load_type_list = get_branch_tag_val(config_file, "load_order")
|
||||
load_type_list = get_leaf_tag_val(config_file, "load_order")
|
||||
|
||||
for vm_type in load_type_list:
|
||||
if vm_type == "PRE_LAUNCHED_VM":
|
||||
@ -586,7 +545,7 @@ def post_vm_cnt(config_file):
|
||||
:return: number of post launched vm
|
||||
"""
|
||||
post_launch_cnt = 0
|
||||
load_type_list = get_branch_tag_val(config_file, "load_order")
|
||||
load_type_list = get_leaf_tag_val(config_file, "load_order")
|
||||
|
||||
for vm_type in load_type_list:
|
||||
if vm_type == "POST_LAUNCHED_VM":
|
||||
|
@ -150,13 +150,6 @@ def get_param(args):
|
||||
return (err_dic, board_info_file, scenario_info_file, launch_info_file, int(vm_th), enable_commit)
|
||||
|
||||
|
||||
def get_scenario_uuid():
|
||||
# {id_num:uuid} (id_num:0~max)
|
||||
scenario_uuid_dic = {}
|
||||
scenario_uuid_dic = common.get_branch_tag_map(SCENARIO_INFO_FILE, 'uuid')
|
||||
return scenario_uuid_dic
|
||||
|
||||
|
||||
def get_post_num_list():
|
||||
"""
|
||||
Get board name from launch.xml at fist line
|
||||
@ -314,35 +307,40 @@ def is_config_file_match():
|
||||
return (err_dic, match)
|
||||
|
||||
|
||||
def get_leaf_tag_map(info_file, prime_item, item=''):
|
||||
"""
|
||||
:param info_file: some configurations in the info file
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: the item in xml file
|
||||
:return: dictionary which item value could be indexed by vmid
|
||||
"""
|
||||
vmid_item_dic = common.get_leaf_tag_map(info_file, prime_item, item)
|
||||
return vmid_item_dic
|
||||
|
||||
|
||||
def get_scenario_uuid():
|
||||
# {id_num:uuid} (id_num:0~max)
|
||||
scenario_uuid_dic = {}
|
||||
scenario_uuid_dic = get_leaf_tag_map(SCENARIO_INFO_FILE, 'uuid')
|
||||
return scenario_uuid_dic
|
||||
|
||||
|
||||
def get_sos_vmid():
|
||||
|
||||
load_list = common.get_branch_tag_val(SCENARIO_INFO_FILE, "load_order")
|
||||
load_dic = get_leaf_tag_map(SCENARIO_INFO_FILE, "load_order")
|
||||
|
||||
sos_id = 0
|
||||
for load_order in load_list:
|
||||
sos_id = ''
|
||||
for idx,load_order in load_dic.items():
|
||||
if load_order == "SOS_VM":
|
||||
sos_id = idx
|
||||
break
|
||||
|
||||
sos_id += 1
|
||||
|
||||
return sos_id
|
||||
|
||||
|
||||
def get_sub_tree_tag(config_file, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
:param config_file: it is a file what contains information for script to read from
|
||||
:param tag_str: it is key of pattern to config file item
|
||||
:return: value of tag_str item
|
||||
"""
|
||||
arg = common.get_spec_branch_tag_val(config_file, tag_str)
|
||||
|
||||
return arg
|
||||
|
||||
|
||||
def get_bdf_from_tag(config_file, branch_tag, tag_str):
|
||||
bdf_list = {}
|
||||
bdf_list = common.get_spec_leaf_tag_val(config_file, branch_tag, tag_str)
|
||||
bdf_list = get_leaf_tag_map(config_file, branch_tag, tag_str)
|
||||
|
||||
# split b:d:f from pci description
|
||||
for idx, bdf_v in bdf_list.items():
|
||||
@ -393,7 +391,7 @@ def get_uos_type():
|
||||
"""
|
||||
Get uos name from launch.xml at fist line
|
||||
"""
|
||||
uos_types = get_sub_tree_tag(LAUNCH_INFO_FILE, "uos_type")
|
||||
uos_types = get_leaf_tag_map(LAUNCH_INFO_FILE, "uos_type")
|
||||
|
||||
return uos_types
|
||||
|
||||
|
@ -224,7 +224,7 @@ def get_vm_num(config_file):
|
||||
return common.get_vm_count(config_file)
|
||||
|
||||
|
||||
def get_sub_leaf_tag(config_file, branch_tag, tag_str):
|
||||
def get_sub_leaf_tag(config_file, branch_tag, tag_str=''):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
:param config_file: it is a file what contains information for script to read from
|
||||
@ -370,7 +370,7 @@ def uuid_format_check(uuid_dic, item):
|
||||
ERR_LIST[key] = "VM uuid format unknown"
|
||||
|
||||
|
||||
def get_leaf_tag_map(info_file, prime_item, item):
|
||||
def get_leaf_tag_map(info_file, prime_item, item=''):
|
||||
"""
|
||||
:param info_file: some configurations in the info file
|
||||
:param prime_item: the prime item in xml file
|
||||
@ -396,9 +396,10 @@ def cpus_per_vm_check(id_cpus_per_vm_dic, item):
|
||||
ERR_LIST[key] = "VM have no assignment cpus"
|
||||
|
||||
|
||||
def mem_start_hpa_check(id_start_hpa_dic, item):
|
||||
def mem_start_hpa_check(id_start_hpa_dic, prime_item, item):
|
||||
"""
|
||||
Check host physical address
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm start_hpa item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -418,9 +419,10 @@ def mem_start_hpa_check(id_start_hpa_dic, item):
|
||||
ERR_LIST[key] = "Address should be Hex format"
|
||||
|
||||
|
||||
def mem_size_check(id_hpa_size_dic, item):
|
||||
def mem_size_check(id_hpa_size_dic, prime_item, item):
|
||||
"""
|
||||
Check host physical size
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm size item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -444,9 +446,10 @@ def mem_size_check(id_hpa_size_dic, item):
|
||||
ERR_LIST[key] = "Mem size should less than 2GB"
|
||||
|
||||
|
||||
def os_kern_name_check(id_kern_name_dic, item):
|
||||
def os_kern_name_check(id_kern_name_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel name
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config name item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -457,9 +460,10 @@ def os_kern_name_check(id_kern_name_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel name length should be in range [1,32] bytes"
|
||||
|
||||
|
||||
def os_kern_type_check(id_kern_type_dic, item):
|
||||
def os_kern_type_check(id_kern_type_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel type
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config type item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -476,9 +480,10 @@ def os_kern_type_check(id_kern_type_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel type unknown"
|
||||
|
||||
|
||||
def os_kern_mod_check(id_kern_mod_dic, item):
|
||||
def os_kern_mod_check(id_kern_mod_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel mod
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config mod item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -489,9 +494,10 @@ def os_kern_mod_check(id_kern_mod_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel mod tag should be in range [1,32] bytes"
|
||||
|
||||
|
||||
def os_kern_args_check(id_kern_args_dic, item):
|
||||
def os_kern_args_check(id_kern_args_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel args
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config args item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -504,9 +510,10 @@ def os_kern_args_check(id_kern_args_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel service os should be SOS_VM_BOOTARGS"
|
||||
|
||||
|
||||
def os_kern_console_check(id_kern_console_dic, item):
|
||||
def os_kern_console_check(id_kern_console_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel console
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config console item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -517,9 +524,10 @@ def os_kern_console_check(id_kern_console_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel console should be ttyS[0..3]"
|
||||
|
||||
|
||||
def os_kern_load_addr_check(id_kern_load_addr_dic, item):
|
||||
def os_kern_load_addr_check(id_kern_load_addr_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel load address
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config load address item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -536,9 +544,10 @@ def os_kern_load_addr_check(id_kern_load_addr_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel load address should Hex format"
|
||||
|
||||
|
||||
def os_kern_entry_addr_check(id_kern_entry_addr_dic, item):
|
||||
def os_kern_entry_addr_check(id_kern_entry_addr_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel entry address
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config entry address item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -555,9 +564,10 @@ def os_kern_entry_addr_check(id_kern_entry_addr_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel entry address should Hex format"
|
||||
|
||||
|
||||
def os_kern_root_dev_check(id_kern_rootdev_dic, item):
|
||||
def os_kern_root_dev_check(id_kern_rootdev_dic, prime_item, item):
|
||||
"""
|
||||
Check os kernel rootfs partitions
|
||||
:param prime_item: the prime item in xml file
|
||||
:param item: vm os config rootdev item in xml
|
||||
:return: None
|
||||
"""
|
||||
@ -568,16 +578,6 @@ def os_kern_root_dev_check(id_kern_rootdev_dic, item):
|
||||
ERR_LIST[key] = "VM os config kernel root device should not empty"
|
||||
|
||||
|
||||
def get_branch_tag_map(info_file, item):
|
||||
"""
|
||||
:param info_file: some configurations in the info file
|
||||
:param item: the item in xml file
|
||||
:return: dictionary which item value could be indexed by vmid
|
||||
"""
|
||||
vmid_item_dic = common.get_branch_tag_map(info_file, item)
|
||||
return vmid_item_dic
|
||||
|
||||
|
||||
def pci_dev_num_check(id_dev_num_dic, item):
|
||||
"""
|
||||
Check vm pci device number
|
||||
|
@ -108,14 +108,14 @@ class CfgOsKern:
|
||||
Check all items in this class
|
||||
:return: None
|
||||
"""
|
||||
scenario_cfg_lib.os_kern_name_check(self.kern_name, "name")
|
||||
scenario_cfg_lib.os_kern_type_check(self.kern_type, "kern_type")
|
||||
scenario_cfg_lib.os_kern_mod_check(self.kern_mod, "kern_mod")
|
||||
scenario_cfg_lib.os_kern_args_check(self.kern_args, "kern_args")
|
||||
scenario_cfg_lib.os_kern_console_check(self.kern_console, "console")
|
||||
scenario_cfg_lib.os_kern_load_addr_check(self.kern_load_addr, "kern_load_addr")
|
||||
scenario_cfg_lib.os_kern_entry_addr_check(self.kern_entry_addr, "kern_entry_addr")
|
||||
scenario_cfg_lib.os_kern_root_dev_check(self.kern_root_dev, "rootdev")
|
||||
scenario_cfg_lib.os_kern_name_check(self.kern_name, "os_config", "name")
|
||||
scenario_cfg_lib.os_kern_type_check(self.kern_type, "os_config", "kern_type")
|
||||
scenario_cfg_lib.os_kern_mod_check(self.kern_mod, "os_config", "kern_mod")
|
||||
scenario_cfg_lib.os_kern_args_check(self.kern_args, "os_config", "kern_args")
|
||||
scenario_cfg_lib.os_kern_console_check(self.kern_console, "os_config", "console")
|
||||
scenario_cfg_lib.os_kern_load_addr_check(self.kern_load_addr, "os_config", "kern_load_addr")
|
||||
scenario_cfg_lib.os_kern_entry_addr_check(self.kern_entry_addr, "os_config", "kern_entry_addr")
|
||||
scenario_cfg_lib.os_kern_root_dev_check(self.kern_root_dev, "os_config", "rootdev")
|
||||
|
||||
|
||||
class VuartTarget:
|
||||
@ -195,8 +195,8 @@ class MemInfo:
|
||||
Check all items in this class
|
||||
:return: None
|
||||
"""
|
||||
scenario_cfg_lib.mem_start_hpa_check(self.mem_start_hpa, "start_hpa")
|
||||
scenario_cfg_lib.mem_size_check(self.mem_size, "size")
|
||||
scenario_cfg_lib.mem_start_hpa_check(self.mem_start_hpa, "memory", "start_hpa")
|
||||
scenario_cfg_lib.mem_size_check(self.mem_size, "memory", "size")
|
||||
|
||||
|
||||
class CfgPci:
|
||||
@ -212,14 +212,14 @@ class CfgPci:
|
||||
Get pci device number items
|
||||
:return: None
|
||||
"""
|
||||
self.pci_dev_num = scenario_cfg_lib.get_branch_tag_map(self.scenario_info, "pci_dev_num")
|
||||
self.pci_dev_num = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "pci_dev_num")
|
||||
|
||||
def get_pci_devs(self):
|
||||
"""
|
||||
Get pci devices items
|
||||
:return: None
|
||||
"""
|
||||
self.pci_devs = scenario_cfg_lib.get_branch_tag_map(self.scenario_info, "pci_devs")
|
||||
self.pci_devs = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "pci_devs")
|
||||
|
||||
def get_info(self):
|
||||
"""
|
||||
@ -274,14 +274,14 @@ class VmInfo:
|
||||
Get all items which belong to this class
|
||||
:return: None
|
||||
"""
|
||||
self.name = scenario_cfg_lib.get_branch_tag_map(self.scenario_info, "name")
|
||||
self.load_order = scenario_cfg_lib.get_branch_tag_map(self.scenario_info, "load_order")
|
||||
self.uuid = scenario_cfg_lib.get_branch_tag_map(self.scenario_info, "uuid")
|
||||
self.name = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "name")
|
||||
self.load_order = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "load_order")
|
||||
self.uuid = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "uuid")
|
||||
self.guest_flag_idx = scenario_cfg_lib.get_sub_leaf_tag(
|
||||
self.scenario_info, "guest_flags", "guest_flag")
|
||||
self.cpus_per_vm = scenario_cfg_lib.get_leaf_tag_map(
|
||||
self.scenario_info, "vcpu_affinity", "pcpu_id")
|
||||
self.clos_set = scenario_cfg_lib.get_branch_tag_map(self.scenario_info, "clos")
|
||||
self.clos_set = scenario_cfg_lib.get_leaf_tag_map(self.scenario_info, "clos")
|
||||
self.epc_section.get_info()
|
||||
self.mem_info.get_info()
|
||||
self.os_cfg.get_info()
|
||||
|
Loading…
Reference in New Issue
Block a user