Merge ~blake-rouse/maas:fix-1817894 into maas:master

Proposed by Blake Rouse
Status: Merged
Approved by: Blake Rouse
Approved revision: 9eea2f8fb1b14429daa28351eb1b0933d8c32495
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~blake-rouse/maas:fix-1817894
Merge into: maas:master
Diff against target: 42 lines (+19/-1)
2 files modified
src/maasserver/rpc/boot.py (+2/-1)
src/maasserver/rpc/tests/test_boot.py (+17/-0)
Reviewer Review Type Date Requested Status
Andres Rodriguez (community) Approve
Review via email: mp+363745@code.launchpad.net

Commit message

LP: #1817894 - Fix PXE mechanism where PXE interface shares a MAC address with a bridge or bond.

To post a comment you must log in.
Revision history for this message
Andres Rodriguez (andreserl) wrote :

lgtm!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/maasserver/rpc/boot.py b/src/maasserver/rpc/boot.py
index 55cd113..602ff68 100644
--- a/src/maasserver/rpc/boot.py
+++ b/src/maasserver/rpc/boot.py
@@ -348,7 +348,8 @@ def get_config(
348 machine.bios_boot_method = bios_boot_method348 machine.bios_boot_method = bios_boot_method
349349
350 try:350 try:
351 machine.boot_interface = machine.interface_set.get(mac_address=mac)351 machine.boot_interface = machine.interface_set.get(
352 type=INTERFACE_TYPE.PHYSICAL, mac_address=mac)
352 except ObjectDoesNotExist:353 except ObjectDoesNotExist:
353 # MAC is unknown or wasn't sent. Determine the boot_interface using354 # MAC is unknown or wasn't sent. Determine the boot_interface using
354 # the boot_cluster_ip.355 # the boot_cluster_ip.
diff --git a/src/maasserver/rpc/tests/test_boot.py b/src/maasserver/rpc/tests/test_boot.py
index fcb3558..8ff0a11 100644
--- a/src/maasserver/rpc/tests/test_boot.py
+++ b/src/maasserver/rpc/tests/test_boot.py
@@ -701,6 +701,23 @@ class TestGetConfig(MAASServerTestCase):
701 query_count=22)701 query_count=22)
702 self.assertEqual(nic, reload_object(node).boot_interface)702 self.assertEqual(nic, reload_object(node).boot_interface)
703703
704 def test__sets_boot_interface_handles_virtual_nics_same_mac(self):
705 rack_controller = factory.make_RackController()
706 local_ip = factory.make_ip_address()
707 remote_ip = factory.make_ip_address()
708 node = self.make_node()
709 nic = node.get_boot_interface()
710 # Create a bridge that has the same mac address as the parent nic.
711 factory.make_Interface(
712 INTERFACE_TYPE.BRIDGE, parents=[nic], mac_address=nic.mac_address)
713 node.boot_interface = None
714 node.save()
715 mac = nic.mac_address
716 get_config(
717 rack_controller.system_id, local_ip, remote_ip, mac=mac,
718 query_count=22)
719 self.assertEqual(nic, reload_object(node).boot_interface)
720
704 def test__updates_boot_interface_when_changed(self):721 def test__updates_boot_interface_when_changed(self):
705 rack_controller = factory.make_RackController()722 rack_controller = factory.make_RackController()
706 local_ip = factory.make_ip_address()723 local_ip = factory.make_ip_address()

Subscribers

People subscribed via source and target branches