acrn-hypervisor/misc/config_tools/static_allocators/main.py
hangliu1 816a88f7f7 config tool: add load_order and redefine vm_type
This patch includes:
1.add load_order(PRE_LAUNCHED_VM/SERVICE_VM/POST_LAUNCHED_VM) parameter
2.change vm_type parameter to values as RTVM, STANDARD_VM, TEE, REE
  TEE and REE are hide in UI.
3.deduce vm severity in vm_configuration from vm_type and load_order

This patch not includes:
change for scenario_config and functions called by scenario_config about checking

v2->v3:
*Refine template load_order

v1->v2:
*Change variable name from vm_type to load_order
*Change LoadOptionType to LoadOrderType
*Change VMOptionsType to VMType
*Add TEE_VM/REE_VM description
*Refine acrn:is-pre-launched-vm

Tracked-On: #6690
Signed-off-by: hangliu1 <hang1.liu@linux.intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
2022-02-22 16:25:27 +08:00

42 lines
1.5 KiB
Python
Executable File

#!/usr/bin/env python3
#
# Copyright (C) 2021 Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
import sys, os
import lxml.etree
import argparse
sys.path.append(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'library'))
import common
from importlib import import_module
def main(args):
# Initialize configuration libraries for backward compatibility
common.BOARD_INFO_FILE = args.board
common.SCENARIO_INFO_FILE = args.scenario
common.get_vm_num(args.scenario)
common.get_load_order()
scripts_path = os.path.dirname(os.path.realpath(__file__))
current = os.path.basename(__file__)
board_etree = lxml.etree.parse(args.board)
scenario_etree = lxml.etree.parse(args.scenario)
allocation_etree = lxml.etree.ElementTree(element=lxml.etree.fromstring("<acrn-config></acrn-config>"))
for script in [f for f in os.listdir(scripts_path) if f.endswith(".py") and f != current]:
module_name = os.path.splitext(script)[0]
module = import_module(f"{module_name}")
module.fn(board_etree, scenario_etree, allocation_etree)
allocation_etree.write(args.output, pretty_print=True)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--board", help="the XML file summarizing characteristics of the target board")
parser.add_argument("--scenario", help="the XML file specifying the scenario to be set up")
parser.add_argument("--output", help="location of the output XML")
args = parser.parse_args()
main(args)