From 54f82a3ea0cdae2895d97184359f6e18773bce5d Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Mon, 5 Jul 2021 15:14:01 -0400 Subject: [PATCH] Fix bug in VM network list with SR-IOV --- client-cli/pvc/cli_lib/vm.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/client-cli/pvc/cli_lib/vm.py b/client-cli/pvc/cli_lib/vm.py index 1d994769..029c7092 100644 --- a/client-cli/pvc/cli_lib/vm.py +++ b/client-cli/pvc/cli_lib/vm.py @@ -713,7 +713,14 @@ def vm_networks_get(config, vm): for interface in parsed_xml.devices.find('interface'): mac_address = interface.mac.attrib.get('address') model = interface.model.attrib.get('type') - network = re.match(r'[vm]*br([0-9a-z]+)', interface.source.attrib.get('bridge')).group(1) + interface_type = interface.attrib.get('type') + if interface_type == 'bridge': + network = re.search(r'[vm]*br([0-9a-z]+)', interface.source.attrib.get('bridge')).group(1) + elif interface_type == 'direct': + network = 'macvtap:{}'.format(interface.source.attrib.get('dev')) + elif interface_type == 'hostdev': + network = 'hostdev:{}'.format(interface.source.attrib.get('dev')) + network_data.append((network, mac_address, model)) return True, network_data