From 06813ca8fbb84eaa60523b8bfc6054f26b1818ef Mon Sep 17 00:00:00 2001 From: libhe Date: Thu, 26 Sep 2024 21:12:05 +0800 Subject: [PATCH] Adds debug logs to print out all network interfaces --- os_tests/libs/resources_libvirt.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/os_tests/libs/resources_libvirt.py b/os_tests/libs/resources_libvirt.py index f2180da7..60b4f7bc 100644 --- a/os_tests/libs/resources_libvirt.py +++ b/os_tests/libs/resources_libvirt.py @@ -67,11 +67,17 @@ def floating_ip(self): dom = self.conn.lookupByUUIDString(uuid) net = dom.interfaceAddresses( libvirt.VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE, 0) - + + # Log all network interfaces and addresses + LOG.debug(f"Interfaces for VM {self.vm_name}: {net}") + for k, v in net.items(): + LOG.debug(f"Interface: {k}, Details: {v}") if v["addrs"]: for ipaddr in v["addrs"]: f_ip = ipaddr["addr"] + LOG.info(f"Floating IP found: {f_ip}") + return f_ip if not f_ip: LOG.warning(f"No floating IP found for VM {self.vm_name}. Checking VM status.")