Skip to content

Commit 22f84cc

Browse files
fix(drivers): attach_port always uses type='network' too
Same issue as create_machine's boot port: attach_port() used self._spec.network_type as the raw libvirt interface type, treating port.source as a literal host bridge device. port.source is always the logical libvirt network name the orchestrator tracks (e.g. "exordos-core-net") - on a bridge-type hypervisor that name must be resolved through a local libvirt network forwarding onto the real bridge, not used directly as a bridge device name.
1 parent 0700363 commit 22f84cc

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

exordos_core/compute/pool/drivers/libvirt.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1188,8 +1188,13 @@ def attach_port(self, machine: models.Machine, port: models.Port) -> None:
11881188
raise
11891189

11901190
# Build interface XML
1191+
# Always type='network': `port.source` is the logical libvirt
1192+
# network name the orchestrator tracks (see create_machine), not
1193+
# necessarily a literal host bridge device - a bridge-type
1194+
# hypervisor still needs it resolved through a local libvirt
1195+
# network that forwards onto the real bridge.
11911196
interface_xml = XMLLibvirtInstance.interface_xml(
1192-
iface_type=self._spec.network_type,
1197+
iface_type="network",
11931198
mac=port.mac,
11941199
rom=self._spec.iface_rom_file,
11951200
mtu=self._spec.iface_mtu,
@@ -1288,12 +1293,11 @@ def create_machine(
12881293
mac=port.mac,
12891294
rom=self._spec.iface_rom_file,
12901295
mtu=self._spec.iface_mtu,
1291-
# The port a machine is created with is always the transient
1292-
# boot network (see pool.py's MetaMachine.dump_to_dp), which
1293-
# is always a plain libvirt virtual network - never the
1294-
# hypervisor's own (possibly bridge-type) main network. The
1295-
# real port replaces it later via attach_port(), which does
1296-
# use self._spec.network_type.
1296+
# Always type='network': `port.source` is a logical
1297+
# libvirt network name the orchestrator tracks (the boot
1298+
# network at initial creation, or the main network when
1299+
# recreate_machine() rebuilds the domain post-flash), not
1300+
# necessarily a literal host bridge device.
12971301
iface_type="network",
12981302
source=port.source,
12991303
)

0 commit comments

Comments
 (0)