config_tools: fix the issue that got wrong device name after specifying mac address

If user add the specific mac address (eg: mac=00:16:3E:77:A9:41)
in launch script, we will get the device name with the specified mac address.
This is unexpected. This patch updates the parser to fix the issue.

v1-->v2:
Update the parser with regex.

Tracked-On: #7197
Signed-off-by: Kunhui-Li <kunhuix.li@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
This commit is contained in:
Kunhui-Li 2022-03-18 13:44:01 +08:00 committed by acrnsi-robot
parent 95a9c05a25
commit b6538a4299

View File

@ -127,8 +127,10 @@ function add_virtual_device() {
if [ "${kind}" = "virtio-net" ]; then
# Create the tap device
tap_conf=${options%,*}
create_tap "${tap_conf#tap=}" >> /dev/stderr
if [[ ${options} =~ tap=([^,]+) ]]; then
tap_conf="${BASH_REMATCH[1]}"
create_tap "${tap_conf}" >> /dev/stderr
fi
fi
echo -n "-s ${slot},${kind}"