From 68f88a4bc9139f9677b38703dc85d7f015831f0d Mon Sep 17 00:00:00 2001 From: Kunhui-Li Date: Fri, 22 Apr 2022 13:47:00 +0800 Subject: [PATCH] config_tools: update virtio console to support multiple console sockets this patch updates virtio console in schema and launch script generation logic to support multiple console sockets. And check the schema and launch script, now we support multiple console/input/network/block, multiple gpu is not supported in schema. Tracked-On: #6690 Signed-off-by: Kunhui-Li Reviewed-by: Junjie Mao --- misc/config_tools/launch_config/launch_cfg_gen.py | 13 +++++++------ misc/config_tools/schema/config.xsd | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/misc/config_tools/launch_config/launch_cfg_gen.py b/misc/config_tools/launch_config/launch_cfg_gen.py index d7d5e6be4..6465924e6 100755 --- a/misc/config_tools/launch_config/launch_cfg_gen.py +++ b/misc/config_tools/launch_config/launch_cfg_gen.py @@ -262,22 +262,23 @@ def generate_for_one_vm(board_etree, hv_scenario_etree, vm_scenario_etree, vm_id elif backend_device_file is not None: script.add_virtual_device("virtio-input", options=backend_device_file) - for backend_type in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/console/backend_type[text() != '']/text()"): + for virtio_console_etree in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/console"): preceding_mask = "" - use_type = eval_xpath(vm_scenario_etree, ".//virtio_devices/console/use_type/text()") + use_type = eval_xpath(virtio_console_etree, "./use_type/text()") + backend_type = eval_xpath(virtio_console_etree, "./backend_type/text()") if use_type == "Virtio console": preceding_mask = "@" if backend_type == "file": - output_file_path = eval_xpath(vm_scenario_etree, ".//virtio_devices/console/output_file_path/text()") + output_file_path = eval_xpath(virtio_console_etree, "./output_file_path/text()") script.add_virtual_device("virtio-console", options=f"{preceding_mask}file:file_port={output_file_path}") elif backend_type == "tty": - tty_file_path = eval_xpath(vm_scenario_etree, ".//virtio_devices/console/tty_device_path/text()") + tty_file_path = eval_xpath(virtio_console_etree, "./tty_device_path/text()") script.add_virtual_device("virtio-console", options=f"{preceding_mask}tty:tty_port={tty_file_path}") elif backend_type == "sock server" or backend_type == "sock client": - sock_file_path = eval_xpath(vm_scenario_etree, ".//virtio_devices/console/sock_file_path/text()") + sock_file_path = eval_xpath(virtio_console_etree, "./sock_file_path/text()") script.add_virtual_device("virtio-console", options=f"socket:{os.path.basename(sock_file_path).split('.')[0]}={sock_file_path}:{backend_type.replace('sock ', '')}") - else: + elif backend_type == "pty" or backend_type == "stdio": script.add_virtual_device("virtio-console", options=f"{preceding_mask}{backend_type}:{backend_type}_port") for interface_name in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/network/interface_name[text() != '']/text()"): diff --git a/misc/config_tools/schema/config.xsd b/misc/config_tools/schema/config.xsd index 53c249d44..da7b07dec 100644 --- a/misc/config_tools/schema/config.xsd +++ b/misc/config_tools/schema/config.xsd @@ -443,7 +443,7 @@ argument and memory. - + Virtio console device for data input and output. The virtio console BE driver copies data from the frontend's transmitting virtqueue when it receives a kick on virtqueue (implemented as a vmexit).