mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-20 20:53:46 +00:00
config_tools: add logic for virtio_framework in launch script
If the user select "Kernel based (Virtual Host)" in virtio_framework entry, the "vhost" string will be added to the dm parameter. The generated launch script will look like below: "virtio-net tap=WaaG,vhost,mac_seed=${mac:0:17}-POST_STD_VM1" Tracked-On: #6690 Signed-off-by: Kunhui-Li <kunhuix.li@intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
parent
cceb169347
commit
8d78136ffb
@ -298,10 +298,14 @@ def generate_for_one_vm(board_etree, hv_scenario_etree, vm_scenario_etree, vm_id
|
||||
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()"):
|
||||
for virtio_network_etree in eval_xpath_all(vm_scenario_etree, ".//virtio_devices/network"):
|
||||
virtio_framework = eval_xpath(virtio_network_etree, "./virtio_framework/text()")
|
||||
interface_name = eval_xpath(virtio_network_etree, "./interface_name/text()")
|
||||
params = interface_name.split(",", maxsplit=1)
|
||||
tap_conf = f"tap={params[0]}"
|
||||
params = [tap_conf] + params[1:]
|
||||
if virtio_framework == "Kernel based (Virtual Host)":
|
||||
params.append("vhost")
|
||||
script.add_init_command(f"mac=$(cat /sys/class/net/e*/address)")
|
||||
params.append(f"mac_seed=${{mac:0:17}}-{vm_name}")
|
||||
script.add_virtual_device("virtio-net", options=",".join(params))
|
||||
|
Loading…
Reference in New Issue
Block a user