acrn-config: add virtio-net mediator support for launch config

Add virtio-net mediator support to parse and get 'virtio-network' item value
from launch config files, these values are editable by user.

Tracked-On: #4185
Signed-off-by: Wei Liu <weix.w.liu@intel.com>
Acked-by: Victor Sun <victor.sun@intel.com>
This commit is contained in:
Wei Liu
2019-12-03 09:47:23 +08:00
committed by wenlingz
parent 25b2a26e34
commit 7838b53763
3 changed files with 66 additions and 31 deletions

View File

@@ -23,7 +23,7 @@ GUEST_FLAG = ["0UL", "GUEST_FLAG_SECURE_WORLD_ENABLED", "GUEST_FLAG_LAPIC_PASSTH
START_HPA_SIZE_LIST = ['0x20000000', '0x40000000', '0x80000000', 'CONFIG_SOS_RAM_SIZE', 'VM0_MEM_SIZE']
MULTI_ITEM = ["guest_flag", "pcpu_id", "input", "block"]
MULTI_ITEM = ["guest_flag", "pcpu_id", "input", "block", "network"]
class MultiItem():
@@ -34,7 +34,7 @@ class MultiItem():
self.vir_input = []
self.vir_block = []
self.vir_console = []
self.vir_net = []
self.vir_network = []
class TmpItem():
@@ -420,6 +420,10 @@ def get_leaf_value(tmp, tag_str, leaf):
if leaf.tag == "block" and tag_str == "block":
tmp.multi.vir_block.append(leaf.text)
# get virtio-net for vm
if leaf.tag == "network" and tag_str == "network":
tmp.multi.vir_network.append(leaf.text)
def get_sub_value(tmp, tag_str, vm_id):
@@ -440,6 +444,10 @@ def get_sub_value(tmp, tag_str, vm_id):
if tmp.multi.vir_block and tag_str == "block":
tmp.tag[vm_id] = tmp.multi.vir_block
# append virtio network for vm
if tmp.multi.vir_network and tag_str == "network":
tmp.tag[vm_id] = tmp.multi.vir_network
def get_leaf_tag_map(config_file, branch_tag, tag_str):
"""