Date
1 - 2 of 2
[PATCH v1] config-tools: clean up the vm names which do not exist
Yang, Yu-chu
From: "Yang,Yu-chu" <yu-chu.yang@...>
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 <yu-chu.yang@...> --- .../configurator/pyodide/populateDefaultValues.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/misc/config_tools/configurator/pyodide/populateDefaultValues.py b/misc/config_tools/configurator/pyodide/populateDefaultValues.py index dcc94eb38..24b9d449a 100644 --- a/misc/config_tools/configurator/pyodide/populateDefaultValues.py +++ b/misc/config_tools/configurator/pyodide/populateDefaultValues.py @@ -37,6 +37,19 @@ 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 = [] + for name in etree.findall(".//name"): + vmNames.append(name.text) + for name in etree.findall(".//VM_NAME"): + if name.text not in vmNames: + name.text = "" + for name in etree.findall(".//vm_name"): + if name.text not in vmNames: + name.text = "" + result = tostring(obj.get("scenario_etree").getroot()) result = result.decode() result = convert_result({ -- 2.25.1 |
|
Junjie Mao
toggle quoted message
Show quoted text
-----Original Message-----You may want to be more specific on the XPATH here, as we also have "name" nodes under "vuart_connection". + vmNames.append(name.text)Here you should be more specific on the context of those nodes as well. Also you can concatenate the results of different XPATHs to avoid duplicate the loop body. --- Best Regards Junjie Mao + if name.text not in vmNames: |
|