diff --git a/misc/config_tools/data/cfl-k700-i7/hybrid_launch_2user_vm.xml b/misc/config_tools/data/cfl-k700-i7/hybrid_launch_2user_vm.xml index d8d7b4404..0955d98a1 100644 --- a/misc/config_tools/data/cfl-k700-i7/hybrid_launch_2user_vm.xml +++ b/misc/config_tools/data/cfl-k700-i7/hybrid_launch_2user_vm.xml @@ -148,7 +148,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -173,8 +176,14 @@ Disable - @stdio:stdio_port - YaaG + + Virtio console + stdio + + + + YaaG + ./YaaG.img diff --git a/misc/config_tools/data/cfl-k700-i7/shared_launch_6user_vm.xml b/misc/config_tools/data/cfl-k700-i7/shared_launch_6user_vm.xml index 1fb5f549b..ece3b39a5 100644 --- a/misc/config_tools/data/cfl-k700-i7/shared_launch_6user_vm.xml +++ b/misc/config_tools/data/cfl-k700-i7/shared_launch_6user_vm.xml @@ -102,7 +102,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -130,8 +133,14 @@ Disable - @stdio:stdio_port - RT + + Virtio console + stdio + + + + RT + ./core-image-weston-intel-corei7-64.wic @@ -158,8 +167,14 @@ Disable - @stdio:stdio_port - YaaG3 + + Virtio console + stdio + + + + YaaG3 + ./YaaG.img @@ -186,8 +201,14 @@ Disable - @stdio:stdio_port - YaaG4 + + Virtio console + stdio + + + + YaaG4 + ./YaaG.img @@ -214,8 +235,14 @@ Disable - @stdio:stdio_port - YaaG5 + + Virtio console + stdio + + + + YaaG5 + ./YaaG.img @@ -242,8 +269,14 @@ Disable - @stdio:stdio_port - YaaG6 + + Virtio console + stdio + + + + YaaG6 + ./YaaG.img diff --git a/misc/config_tools/data/generic_board/hybrid_launch_2user_vm.xml b/misc/config_tools/data/generic_board/hybrid_launch_2user_vm.xml index f32678d7e..1d71948c4 100644 --- a/misc/config_tools/data/generic_board/hybrid_launch_2user_vm.xml +++ b/misc/config_tools/data/generic_board/hybrid_launch_2user_vm.xml @@ -148,7 +148,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -173,8 +176,14 @@ Disable - @stdio:stdio_port - YaaG + + Virtio console + stdio + + + + YaaG + ./YaaG.img diff --git a/misc/config_tools/data/generic_board/shared_launch_6user_vm.xml b/misc/config_tools/data/generic_board/shared_launch_6user_vm.xml index 3835b0920..ead9df745 100644 --- a/misc/config_tools/data/generic_board/shared_launch_6user_vm.xml +++ b/misc/config_tools/data/generic_board/shared_launch_6user_vm.xml @@ -110,7 +110,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -138,8 +141,14 @@ Disable - @stdio:stdio_port - RT + + Virtio console + stdio + + + + RT + ./core-image-weston-intel-corei7-64.wic @@ -166,8 +175,14 @@ Disable - @stdio:stdio_port - YaaG3 + + Virtio console + stdio + + + + YaaG3 + ./YaaG.img @@ -194,8 +209,14 @@ Disable - @stdio:stdio_port - YaaG4 + + Virtio console + stdio + + + + YaaG4 + ./YaaG.img @@ -222,8 +243,14 @@ Disable - @stdio:stdio_port - YaaG5 + + Virtio console + stdio + + + + YaaG5 + ./YaaG.img @@ -250,8 +277,14 @@ Disable - @stdio:stdio_port - YaaG6 + + Virtio console + stdio + + + + YaaG6 + ./YaaG.img diff --git a/misc/config_tools/data/nuc11tnbi5/hybrid_launch_2user_vm.xml b/misc/config_tools/data/nuc11tnbi5/hybrid_launch_2user_vm.xml index 3bbe4a27b..ec6179b6d 100644 --- a/misc/config_tools/data/nuc11tnbi5/hybrid_launch_2user_vm.xml +++ b/misc/config_tools/data/nuc11tnbi5/hybrid_launch_2user_vm.xml @@ -148,7 +148,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -173,8 +176,14 @@ Disable - @stdio:stdio_port - YaaG + + Virtio console + stdio + + + + YaaG + ./YaaG.img diff --git a/misc/config_tools/data/nuc11tnbi5/shared_launch_6user_vm.xml b/misc/config_tools/data/nuc11tnbi5/shared_launch_6user_vm.xml index 6d068344e..32ad31b4e 100644 --- a/misc/config_tools/data/nuc11tnbi5/shared_launch_6user_vm.xml +++ b/misc/config_tools/data/nuc11tnbi5/shared_launch_6user_vm.xml @@ -122,7 +122,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -150,8 +153,14 @@ Disable - @stdio:stdio_port - RT + + Virtio console + stdio + + + + RT + ./core-image-weston-intel-corei7-64.wic @@ -178,8 +187,14 @@ Disable - @stdio:stdio_port - YaaG3 + + Virtio console + stdio + + + + YaaG3 + ./YaaG.img @@ -206,8 +221,14 @@ Disable - @stdio:stdio_port - YaaG4 + + Virtio console + stdio + + + + YaaG4 + ./YaaG.img @@ -234,8 +255,14 @@ Disable - @stdio:stdio_port - YaaG5 + + Virtio console + stdio + + + + YaaG5 + ./YaaG.img @@ -262,8 +289,14 @@ Disable - @stdio:stdio_port - YaaG6 + + Virtio console + stdio + + + + YaaG6 + ./YaaG.img diff --git a/misc/config_tools/data/tgl-vecow-spc-7100-Corei7/shared_launch_2user_vm.xml b/misc/config_tools/data/tgl-vecow-spc-7100-Corei7/shared_launch_2user_vm.xml index 32b6b0681..ba7da9270 100644 --- a/misc/config_tools/data/tgl-vecow-spc-7100-Corei7/shared_launch_2user_vm.xml +++ b/misc/config_tools/data/tgl-vecow-spc-7100-Corei7/shared_launch_2user_vm.xml @@ -123,8 +123,14 @@ Disable - @stdio:stdio_port - WaaG + + Virtio console + stdio + + + + WaaG + ./win10-ltsc.img @@ -153,8 +159,14 @@ Disable - @stdio:stdio_port - RT + + Virtio console + stdio + + + + RT + ./core-image-weston-intel-corei7-64.wic diff --git a/misc/config_tools/data/whl-ipc-i5/hybrid_rt_launch_1user_vm_waag.xml b/misc/config_tools/data/whl-ipc-i5/hybrid_rt_launch_1user_vm_waag.xml index 3f4cee614..52a2d4b94 100644 --- a/misc/config_tools/data/whl-ipc-i5/hybrid_rt_launch_1user_vm_waag.xml +++ b/misc/config_tools/data/whl-ipc-i5/hybrid_rt_launch_1user_vm_waag.xml @@ -164,7 +164,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img diff --git a/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_hardrt.xml b/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_hardrt.xml index 8234bef57..b0822735d 100644 --- a/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_hardrt.xml +++ b/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_hardrt.xml @@ -113,8 +113,14 @@ Disable - @stdio:stdio_port - RT + + Virtio console + stdio + + + + RT + ./core-image-weston-intel-corei7-64.wic diff --git a/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_vxworks.xml b/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_vxworks.xml index b9f3147b6..f0a5a56f1 100644 --- a/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_vxworks.xml +++ b/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_vxworks.xml @@ -99,7 +99,10 @@ Disable - @stdio:stdio_port + + Virtio console + stdio + ./VxWorks.img diff --git a/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_waag.xml b/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_waag.xml index 92d6fdc8a..b4d5d0fbe 100644 --- a/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_waag.xml +++ b/misc/config_tools/data/whl-ipc-i5/shared_launch_1user_vm_waag.xml @@ -103,7 +103,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img diff --git a/misc/config_tools/data/whl-ipc-i5/shared_launch_2user_vm.xml b/misc/config_tools/data/whl-ipc-i5/shared_launch_2user_vm.xml index 4f6246e85..a0b3a6aa9 100644 --- a/misc/config_tools/data/whl-ipc-i5/shared_launch_2user_vm.xml +++ b/misc/config_tools/data/whl-ipc-i5/shared_launch_2user_vm.xml @@ -103,7 +103,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -131,8 +134,14 @@ Disable - @stdio:stdio_port - RT + + Virtio console + stdio + + + + RT + ./core-image-weston-intel-corei7-64.wic diff --git a/misc/config_tools/data/whl-ipc-i5/shared_launch_6user_vm.xml b/misc/config_tools/data/whl-ipc-i5/shared_launch_6user_vm.xml index ad8872840..0bb91fc73 100644 --- a/misc/config_tools/data/whl-ipc-i5/shared_launch_6user_vm.xml +++ b/misc/config_tools/data/whl-ipc-i5/shared_launch_6user_vm.xml @@ -103,7 +103,10 @@ - WaaG + + + WaaG + ./win10-ltsc.img @@ -131,8 +134,14 @@ Disable - @stdio:stdio_port - RT + + Virtio console + stdio + + + + RT + ./core-image-weston-intel-corei7-64.wic diff --git a/misc/config_tools/scenario_config/upgrader.py b/misc/config_tools/scenario_config/upgrader.py index 3292ae364..1bbd22de4 100755 --- a/misc/config_tools/scenario_config/upgrader.py +++ b/misc/config_tools/scenario_config/upgrader.py @@ -232,6 +232,73 @@ class SharedMemoryRegions: node.append(region.format_xml_element()) return node +class VirtioDevices(object): + + def __init__(self, old_xml_etree): + self.blocks = [] + self.inputs = [] + self.networks = [] + self.console = namedtuple("console", ["use_type", "backend_type", "file_path"]) + self.old_xml_etree = old_xml_etree + + def console_encoding(self, text): + if text is not None: + self.console.use_type = "Virtio console" if text.startswith("@") else "Virtio serial port" + self.console.backend_type = text.split(":")[0].replace("@", "") + self.console.file_path = text.split("=")[1].split(":")[0] if "=" in text else None + else: + self.console = self.console(use_type=None, backend_type=None, file_path=None) + return self.console + + def format_console_element(self): + node = etree.Element("console") + etree.SubElement(node, "use_type").text = self.console.use_type + etree.SubElement(node, "backend_type").text = self.console.backend_type + if self.console.backend_type == "socket": + etree.SubElement(node, "sock_file_path").text = self.console.file_path + if self.console.backend_type == "tty": + etree.SubElement(node, "tty_device_path").text = self.console.file_path + if self.console.backend_type == "file": + etree.SubElement(node, "output_file_path").text = self.console.file_path + return node + + def format_network_element(self, network): + node = etree.Element("network") + etree.SubElement(node, "virtio_framework") + etree.SubElement(node, "interface_name").text = network + return node + + def format_input_element(self, input): + node = etree.Element("input") + etree.SubElement(node, "backend_device_file").text = input + etree.SubElement(node, "id") + return node + + def format_block_element(self, block): + node = etree.Element("block") + node.text = block + return node + + def format_xml_element(self): + node = etree.Element("virtio_devices") + node.append(self.format_console_element()) + for network in self.networks: + node.append(self.format_network_element(network)) + for input in self.inputs: + node.append(self.format_input_element(input)) + for block in self.blocks: + node.append(self.format_block_element(block)) + return node + + def add_virtio_devices(self, virtio_device_node): + self.console = self.console_encoding(virtio_device_node.xpath("./console")[0].text) + for virtio_network in virtio_device_node.xpath("./network"): + self.networks.append(virtio_network.text) + for virtio_input in virtio_device_node.xpath("./input"): + self.inputs.append(virtio_input.text) + for virtio_block in virtio_device_node.xpath("./block"): + self.blocks.append(virtio_block.text) + class ScenarioUpgrader(ScenarioTransformer): @classmethod def get_node(cls, element, xpath): @@ -295,6 +362,22 @@ class ScenarioUpgrader(ScenarioTransformer): self.move_data_by_xpath(".//BUILD_TYPE", xsd_element_node, xml_parent_node, new_nodes) return False + def move_virtio_devices(self, xsd_element_node, xml_parent_node, new_nodes): + virtio = VirtioDevices(self.old_xml_etree) + + try: + old_data_virtio = self.get_from_old_data(xml_parent_node, ".//virtio_devices").pop() + except IndexError as e: + logging.debug(e) + return + old_data_virtio = self.get_from_old_data(xml_parent_node, ".//virtio_devices").pop() + virtio.add_virtio_devices(old_data_virtio) + for child in old_data_virtio.iter(): + self.old_data_nodes.discard(child) + + new_nodes.append(virtio.format_xml_element()) + return False + def move_console_vuart(self, xsd_element_node, xml_parent_node, new_nodes): new_node = etree.Element(xsd_element_node.get("name")) new_node.text = "None" @@ -554,7 +637,6 @@ class ScenarioUpgrader(ScenarioTransformer): "console_vuart/base": partialmethod(move_data_by_xpath, ".//console_vuart/base"), "epc_section/size": partialmethod(move_data_by_xpath, ".//epc_section/size"), "memory/size": partialmethod(move_data_by_xpath, ".//memory/size"), - "virtio_devices/network": partialmethod(move_data_by_xpath, ".//virtio_devices/network"), # Guest flags "lapic_passthrough": move_lapic_passthrough, @@ -579,6 +661,7 @@ class ScenarioUpgrader(ScenarioTransformer): "IVSHMEM": move_ivshmem, "vm_type": move_vm_type, "os_type": move_os_type, + "virtio_devices": move_virtio_devices, "memory/whole": partialmethod(rename_data, "memory/whole", ".//mem_size"), "default": move_data_by_same_tag,