mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2026-06-08 18:14:53 +00:00
acrn-config: modify rootfs tag in board information
1. grap 'ext4' rootfs, and store it as "BLOCK_DEVICE_INFO" tag
2. remove 'Tab' from app tools
3. add support to parse ' ' from scenario xml
v1-v2:
1). modify the board info "ROOT_DEVICE_INFO" -> "BLOCK_DEVICE_INFO"
Tracked-On: #3602
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Terry Zou <terry.zou@intel.com>
This commit is contained in:
@@ -285,9 +285,8 @@ def get_post_vm_count(config_file):
|
||||
# get post vm number
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
for sub in item:
|
||||
if sub.tag == "load_order" and sub.text == "POST_LAUNCHED_VM":
|
||||
post_vm_count += 1
|
||||
if item.tag == "uos":
|
||||
post_vm_count += 1
|
||||
|
||||
return post_vm_count
|
||||
|
||||
@@ -307,22 +306,23 @@ def get_tree_tag_val(config_file, tag_str):
|
||||
return False
|
||||
|
||||
|
||||
def get_branch_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 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(config_file, tag_str, p_id):
|
||||
# """
|
||||
# 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:
|
||||
# if item.tag != 'vm' and item.attrib['id'] != str(p_id):
|
||||
# continue
|
||||
# for sub in item:
|
||||
# if sub.tag == tag_str:
|
||||
# tmp_tag = sub.text
|
||||
#
|
||||
# return tmp_tag
|
||||
|
||||
|
||||
def get_branch_tag_val(config_file, tag_str):
|
||||
@@ -342,6 +342,25 @@ def get_branch_tag_val(config_file, tag_str):
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_spec_branch_tag_val(config_file, tag_str, uos_id):
|
||||
"""
|
||||
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:
|
||||
if item.attrib['id'] != uos_id:
|
||||
continue
|
||||
for sub in item:
|
||||
if sub.tag == tag_str:
|
||||
tmp_tag = 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
|
||||
@@ -363,6 +382,22 @@ def get_branch_tag_map(config_file, tag_str):
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_spec_leaf_tag_val(config_file, branch_tag, tag_str, uos_id):
|
||||
tmp_tag = ''
|
||||
root = get_config_root(config_file)
|
||||
for item in root:
|
||||
if item.attrib['id'] != uos_id:
|
||||
continue
|
||||
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":
|
||||
tmp_tag = leaf.text
|
||||
continue
|
||||
return tmp_tag
|
||||
|
||||
|
||||
def get_leaf_tag_val(config_file, branch_tag, tag_str):
|
||||
"""
|
||||
This is get tag value by tag_str from config file
|
||||
@@ -534,6 +569,18 @@ def vm_pre_launch_cnt(config_file):
|
||||
return pre_launch_cnt
|
||||
|
||||
|
||||
def handle_root_dev(line):
|
||||
"""Handle if it match root device information pattern
|
||||
:param line: one line of information which had decoded to 'ASCII'
|
||||
"""
|
||||
for root_type in line.split():
|
||||
# only support ext4 rootfs
|
||||
if "ext4" in root_type:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def get_max_clos(board_file):
|
||||
"""
|
||||
Parse CLOS information
|
||||
|
||||
Reference in New Issue
Block a user