Skip to content

Commit c1ab9fc

Browse files
fix(drivers): parse interface source by its own type, not hypervisor's
_domain2machine/_list_interfaces read a <source> element's attribute keyed by self._spec.network_type (the hypervisor's own bridge/network setting), but the boot-network port is always type='network' regardless of that setting (see the earlier create_machine fix). On a bridge-type hypervisor this made every boot-network interface look like it had no mac/source at all, breaking pool listing (and everything depending on it - pool_volume, pool_machine) for the entire hypervisor. Read the interface's own 'type' attribute instead of assuming it matches the hypervisor's network_type.
1 parent 4f06fdf commit c1ab9fc

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

exordos_core/compute/pool/drivers/libvirt.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -621,7 +621,11 @@ def _domain2machine(
621621
mac_el = iface.find("mac")
622622
source_el = iface.find("source")
623623
mac = mac_el.get("address")
624-
source = source_el.get(self._spec.network_type)
624+
# The boot-network port is always type='network' regardless of
625+
# the hypervisor's own network_type (see create_machine) - read
626+
# the source attribute this specific interface actually has
627+
# ('network' or 'bridge'), not the hypervisor's configured type.
628+
source = source_el.get(iface.get("type"))
625629

626630
if not mac or not source:
627631
raise ValueError(f"Interface {iface} has no mac or source")
@@ -700,7 +704,9 @@ def _list_interfaces(self, machine: models.Machine) -> tp.List[models.Port]:
700704
mac_el = iface.find("mac")
701705
source_el = iface.find("source")
702706
mac = mac_el.get("address")
703-
source = source_el.get(self._spec.network_type)
707+
# See _domain2machine: read the source attribute this specific
708+
# interface actually has, not the hypervisor's network_type.
709+
source = source_el.get(iface.get("type"))
704710

705711
if not mac or not source:
706712
raise ValueError(f"Interface {iface} has no mac or source")

0 commit comments

Comments
 (0)