Skip to content

Commit 2cd3ec5

Browse files
authored
virtual_network/ethernet: select interface more reliably (#6556)
Previously, the code used `interface_base.get_vm_iface` to select what ever that function determined to be the first guest interface inside the guest. However, this selection could fail leading to a mismatch in MTU values in test cases that have two interfaces on the VM. Instead, use `utils_net_get_linux_iface_info` to select the interface more reliably via the mac that's given by the previously obtained interface information from the VM XML. This assures that the vm interface corresponds to the selected domain xml element. Assisted-by: Cursor/Claude-4-Sonnet Signed-off-by: Sebastian Mitterle <[email protected]>
1 parent ae482a9 commit 2cd3ec5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

libvirt/tests/src/virtual_network/connectivity/connectivity_check_ethernet_interface.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from virttest.utils_libvirt import libvirt_vmxml
1313
from virttest.utils_test import libvirt
1414

15-
from provider.interface import interface_base
1615
from provider.virtual_network import network_base
1716

1817
LOG = logging.getLogger('avocado.' + __name__)
@@ -175,9 +174,10 @@ def run(test, params, env):
175174
LOG.info('MTU check of vmxml PASS')
176175

177176
# Check mtu inside vm
178-
vm_iface = interface_base.get_vm_iface(session)
179-
vm_iface_info = utils_net.get_linux_iface_info(iface=vm_iface,
177+
iface_mac = iface['mac_address']
178+
vm_iface_info = utils_net.get_linux_iface_info(mac=iface_mac,
180179
session=session)
180+
vm_iface = vm_iface_info['ifname']
181181
vm_mtu = vm_iface_info['mtu']
182182
if int(vm_mtu) != int(iface_mtu):
183183
test.fail(f'MTU of interface inside vm should be '

0 commit comments

Comments
 (0)