From aada036ac6bc363839f2a984625c49a19730bb66 Mon Sep 17 00:00:00 2001 From: "Yang,Yu-chu" Date: Wed, 19 Oct 2022 15:56:45 -0700 Subject: [PATCH] config-tools: clean up the vm names which do not exist Clean up vm_name of vuart and/or VM_NAME of IVSHMEM which is not defined in //vm/name while loading scenario XML. Signed-off-by: Yang,Yu-chu Rviewed-by: Junjie Mao Tracked-On: #8270 --- .../configurator/pyodide/populateDefaultValues.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/misc/config_tools/configurator/pyodide/populateDefaultValues.py b/misc/config_tools/configurator/pyodide/populateDefaultValues.py index dcc94eb38..23f22f37a 100644 --- a/misc/config_tools/configurator/pyodide/populateDefaultValues.py +++ b/misc/config_tools/configurator/pyodide/populateDefaultValues.py @@ -37,6 +37,15 @@ def main(scenario): schema_path=scenario_xml_schema_path, ) pipeline.run(obj) + + # Clean up the VM_NAME and/or vm_name which does not exist + etree = obj.get("scenario_etree").getroot() + vmNames = [name.text for name in etree.findall(".//vm/name")] + for name in etree.findall(".//IVSHMEM_VM/VM_NAME") + \ + etree.findall(".//vuart_connection/endpoint/vm_name"): + if name.text not in vmNames: + name.text = "" + result = tostring(obj.get("scenario_etree").getroot()) result = result.decode() result = convert_result({