Skip to content

Commit 832f648

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 2321661 commit 832f648

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
@@ -1198,8 +1198,13 @@ def attach_port(self, machine: models.Machine, port: models.Port) -> None:
11981198
raise
11991199

12001200
# Build interface XML
1201+
# Always type='network': `port.source` is the logical libvirt
1202+
# network name the orchestrator tracks (see create_machine), not
1203+
# necessarily a literal host bridge device - a bridge-type
1204+
# hypervisor still needs it resolved through a local libvirt
1205+
# network that forwards onto the real bridge.
12011206
interface_xml = XMLLibvirtInstance.interface_xml(
1202-
iface_type=self._spec.network_type,
1207+
iface_type="network",
12031208
mac=port.mac,
12041209
rom=self._spec.iface_rom_file,
12051210
mtu=self._spec.iface_mtu,
@@ -1298,12 +1303,11 @@ def create_machine(
12981303
mac=port.mac,
12991304
rom=self._spec.iface_rom_file,
13001305
mtu=self._spec.iface_mtu,
1301-
# The port a machine is created with is always the transient
1302-
# boot network (see pool.py's MetaMachine.dump_to_dp), which
1303-
# is always a plain libvirt virtual network - never the
1304-
# hypervisor's own (possibly bridge-type) main network. The
1305-
# real port replaces it later via attach_port(), which does
1306-
# use self._spec.network_type.
1306+
# Always type='network': `port.source` is a logical
1307+
# libvirt network name the orchestrator tracks (the boot
1308+
# network at initial creation, or the main network when
1309+
# recreate_machine() rebuilds the domain post-flash), not
1310+
# necessarily a literal host bridge device.
13071311
iface_type="network",
13081312
source=port.source,
13091313
)

0 commit comments

Comments
 (0)