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
1diff --git a/src/maasserver/rpc/boot.py b/src/maasserver/rpc/boot.py
2index 55cd113..602ff68 100644
3--- a/src/maasserver/rpc/boot.py
4+++ b/src/maasserver/rpc/boot.py
5@@ -348,7 +348,8 @@ def get_config(
6 machine.bios_boot_method = bios_boot_method
7
8 try:
9- machine.boot_interface = machine.interface_set.get(mac_address=mac)
10+ machine.boot_interface = machine.interface_set.get(
11+ type=INTERFACE_TYPE.PHYSICAL, mac_address=mac)
12 except ObjectDoesNotExist:
13 # MAC is unknown or wasn't sent. Determine the boot_interface using
14 # the boot_cluster_ip.
15diff --git a/src/maasserver/rpc/tests/test_boot.py b/src/maasserver/rpc/tests/test_boot.py
16index fcb3558..8ff0a11 100644
17--- a/src/maasserver/rpc/tests/test_boot.py
18+++ b/src/maasserver/rpc/tests/test_boot.py
19@@ -701,6 +701,23 @@ class TestGetConfig(MAASServerTestCase):
20 query_count=22)
21 self.assertEqual(nic, reload_object(node).boot_interface)
22
23+ def test__sets_boot_interface_handles_virtual_nics_same_mac(self):
24+ rack_controller = factory.make_RackController()
25+ local_ip = factory.make_ip_address()
26+ remote_ip = factory.make_ip_address()
27+ node = self.make_node()
28+ nic = node.get_boot_interface()
29+ # Create a bridge that has the same mac address as the parent nic.
30+ factory.make_Interface(
31+ INTERFACE_TYPE.BRIDGE, parents=[nic], mac_address=nic.mac_address)
32+ node.boot_interface = None
33+ node.save()
34+ mac = nic.mac_address
35+ get_config(
36+ rack_controller.system_id, local_ip, remote_ip, mac=mac,
37+ query_count=22)
38+ self.assertEqual(nic, reload_object(node).boot_interface)
39+
40 def test__updates_boot_interface_when_changed(self):
41 rack_controller = factory.make_RackController()
42 local_ip = factory.make_ip_address()

Subscribers

People subscribed via source and target branches