Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/maasserver/models/bmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1107,8 +1107,16 @@ def _assign_interfaces(
# configuration.
created_interfaces = []
for idx, discovered_nic in enumerate(discovered_machine.interfaces):
# For the scenario of lxd, it returns the interfaces ordered
Comment thread
AloizioMacedo marked this conversation as resolved.
# alphabetically likely due to it being written in Go. So we need
# to properly match the correct name here instead of relying on
# order.
# When coming from virsh, the interfaces do not have a meaningful
# name. So we fall back to the previous behavior (which might
# be even correct in that scenario.)
name = discovered_nic.name or interface_names[idx]
interface = self._create_interface(
discovered_nic, machine, name=interface_names[idx]
discovered_nic, machine, name=name
)
created_interfaces.append(interface)
if discovered_nic.boot:
Expand Down
1 change: 1 addition & 0 deletions src/provisioningserver/drivers/pod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ class DiscoveredMachineInterface:
attach_name = attr.ib(
converter=converter_obj(str, optional=True), default=None
)
name = attr.ib(converter=converter_obj(str, optional=True), default=None)


@attr.s
Expand Down
1 change: 1 addition & 0 deletions src/provisioningserver/drivers/pod/lxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,7 @@ def _get_discovered_interface(name, device, boot):
boot=boot,
attach_type=attach_type,
attach_name=attach_name,
name=name,
)

extra_block_devices = 0
Expand Down
6 changes: 6 additions & 0 deletions src/provisioningserver/drivers/pod/tests/test_lxd.py
Original file line number Diff line number Diff line change
Expand Up @@ -995,6 +995,7 @@ def test_get_discovered_machine(self):
boot=True,
attach_type=InterfaceAttachType.BRIDGE,
attach_name="lxdbr0",
name="eth0",
Comment thread
AloizioMacedo marked this conversation as resolved.
),
)
self.assertEqual(
Expand All @@ -1006,6 +1007,7 @@ def test_get_discovered_machine(self):
boot=False,
attach_type=InterfaceAttachType.BRIDGE,
attach_name="br1",
name="eth1",
),
)
self.assertEqual(
Expand All @@ -1017,6 +1019,7 @@ def test_get_discovered_machine(self):
boot=False,
attach_type=InterfaceAttachType.MACVLAN,
attach_name="eno2",
name="eth2",
),
)
self.assertEqual(
Expand All @@ -1028,6 +1031,7 @@ def test_get_discovered_machine(self):
boot=False,
attach_type=InterfaceAttachType.SRIOV,
attach_name="eno3",
name="eth3",
),
)
self.assertEqual(
Expand All @@ -1039,6 +1043,7 @@ def test_get_discovered_machine(self):
boot=False,
attach_type=InterfaceAttachType.SRIOV,
attach_name="eno3",
name="eth4",
),
)
self.assertEqual(
Expand All @@ -1050,6 +1055,7 @@ def test_get_discovered_machine(self):
boot=False,
attach_type=InterfaceAttachType.SRIOV,
attach_name="eno3",
name="eth5",
),
)
self.assertEqual([], discovered_machine.tags)
Expand Down
Loading