Merge ~adam-collard/maas:skip-ipoib-at-startup into maas:master
- Git
- lp:~adam-collard/maas
- skip-ipoib-at-startup
- Merge into master
Proposed by
Adam Collard
Status: | Merged |
---|---|
Approved by: | Adam Collard |
Approved revision: | de09a57fe717064a321efbd8f22fe5a1d988cd95 |
Merge reported by: | MAAS Lander |
Merged at revision: | not available |
Proposed branch: | ~adam-collard/maas:skip-ipoib-at-startup |
Merge into: | maas:master |
Diff against target: |
470 lines (+399/-2) 4 files modified
src/metadataserver/builtin_scripts/hooks.py (+4/-1) src/metadataserver/builtin_scripts/tests/test_hooks.py (+360/-0) src/provisioningserver/utils/ipaddr.py (+21/-1) src/provisioningserver/utils/tests/test_ipaddr.py (+14/-0) |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alberto Donato (community) | Approve | ||
MAAS Lander | Needs Fixing | ||
Review via email: mp+422969@code.launchpad.net |
Commit message
LP:1939456 Skip IPoIB interfaces at startup
Description of the change
To post a comment you must log in.
Revision history for this message
Alberto Donato (ack) wrote : | # |
The change looks good but is likely not enough to fix the issue.
I suspect we also need to skip the interfaces when processing networking during commissioning/
review:
Needs Information
- de09a57... by Adam Collard
-
Skip IPoIB for Controller refresh too
Revision history for this message
MAAS Lander (maas-lander) wrote : | # |
UNIT TESTS
-b skip-ipoib-
STATUS: FAILED
LOG: http://
COMMIT: f1ed458b85b8581
review:
Needs Fixing
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | diff --git a/src/metadataserver/builtin_scripts/hooks.py b/src/metadataserver/builtin_scripts/hooks.py |
2 | index 5289538..7b2039c 100644 |
3 | --- a/src/metadataserver/builtin_scripts/hooks.py |
4 | +++ b/src/metadataserver/builtin_scripts/hooks.py |
5 | @@ -50,6 +50,7 @@ from provisioningserver.refresh.node_info_scripts import ( |
6 | NODE_INFO_SCRIPTS, |
7 | ) |
8 | from provisioningserver.utils import kernel_to_debian_architecture |
9 | +from provisioningserver.utils.ipaddr import is_ipoib_mac |
10 | from provisioningserver.utils.lxd import parse_lxd_cpuinfo, parse_lxd_networks |
11 | |
12 | logger = logging.getLogger(__name__) |
13 | @@ -99,7 +100,9 @@ def parse_interfaces(node, data): |
14 | |
15 | def process_port(card, port): |
16 | mac = port.get("address") |
17 | - |
18 | + # See LP:1939456 |
19 | + if is_ipoib_mac(mac): |
20 | + return |
21 | interface = { |
22 | "name": port.get("id"), |
23 | "link_connected": port.get("link_detected"), |
24 | diff --git a/src/metadataserver/builtin_scripts/tests/test_hooks.py b/src/metadataserver/builtin_scripts/tests/test_hooks.py |
25 | index c7030e7..0ae561a 100644 |
26 | --- a/src/metadataserver/builtin_scripts/tests/test_hooks.py |
27 | +++ b/src/metadataserver/builtin_scripts/tests/test_hooks.py |
28 | @@ -55,6 +55,7 @@ from metadataserver.builtin_scripts.hooks import ( |
29 | get_dmi_data, |
30 | NODE_INFO_SCRIPTS, |
31 | parse_bootif_cmdline, |
32 | + parse_interfaces, |
33 | process_lxd_results, |
34 | retag_node_for_hardware_by_modalias, |
35 | update_node_fruid_metadata, |
36 | @@ -583,6 +584,350 @@ SAMPLE_LXD_RESOURCES_LP1906834 = { |
37 | }, |
38 | }, |
39 | } |
40 | +# This sample is from LP:1939456 |
41 | +SAMPLE_LXD_RESOURCES_NETWORK_LP1939456 = { |
42 | + "network": { |
43 | + "cards": [ |
44 | + { |
45 | + "driver": "ixgbe", |
46 | + "driver_version": "5.1.0-k", |
47 | + "ports": [ |
48 | + { |
49 | + "id": "eno1", |
50 | + "address": "44:a8:42:ba:a3:b4", |
51 | + "port": 0, |
52 | + "protocol": "ethernet", |
53 | + "supported_modes": [ |
54 | + "1000baseKX/Full", |
55 | + "10000baseKX4/Full", |
56 | + "10000baseKR/Full", |
57 | + ], |
58 | + "supported_ports": ["fibre"], |
59 | + "port_type": "other", |
60 | + "transceiver_type": "internal", |
61 | + "auto_negotiation": True, |
62 | + "link_detected": True, |
63 | + "link_speed": 10000, |
64 | + "link_duplex": "full", |
65 | + } |
66 | + ], |
67 | + "sriov": {"current_vfs": 0, "maximum_vfs": 63, "vfs": None}, |
68 | + "numa_node": 0, |
69 | + "pci_address": "0000:01:00.0", |
70 | + "vendor": "Intel Corporation", |
71 | + "vendor_id": "8086", |
72 | + "product": "82599 10 Gigabit Dual Port Backplane Connection", |
73 | + "product_id": "10f8", |
74 | + "firmware_version": "0x8000093f, 19.0.12", |
75 | + }, |
76 | + { |
77 | + "driver": "ixgbe", |
78 | + "driver_version": "5.1.0-k", |
79 | + "ports": [ |
80 | + { |
81 | + "id": "eno2", |
82 | + "address": "44:a8:42:ba:a3:b6", |
83 | + "port": 0, |
84 | + "protocol": "ethernet", |
85 | + "supported_modes": [ |
86 | + "1000baseKX/Full", |
87 | + "10000baseKX4/Full", |
88 | + "10000baseKR/Full", |
89 | + ], |
90 | + "supported_ports": ["fibre"], |
91 | + "port_type": "other", |
92 | + "transceiver_type": "internal", |
93 | + "auto_negotiation": True, |
94 | + "link_detected": False, |
95 | + } |
96 | + ], |
97 | + "sriov": {"current_vfs": 0, "maximum_vfs": 63, "vfs": None}, |
98 | + "numa_node": 0, |
99 | + "pci_address": "0000:01:00.1", |
100 | + "vendor": "Intel Corporation", |
101 | + "vendor_id": "8086", |
102 | + "product": "82599 10 Gigabit Dual Port Backplane Connection", |
103 | + "product_id": "10f8", |
104 | + "firmware_version": "0x8000093f, 19.0.12", |
105 | + }, |
106 | + { |
107 | + "driver": "mlx4_core", |
108 | + "driver_version": "4.9-3.1.5", |
109 | + "ports": [ |
110 | + { |
111 | + "id": "ibp4s0", |
112 | + "address": "a0:00:02:20:fe:80:00:00:00:00:00:00:e4:1d:2d:03:00:4f:06:e1", |
113 | + "port": 0, |
114 | + "protocol": "infiniband", |
115 | + "port_type": "other", |
116 | + "transceiver_type": "internal", |
117 | + "auto_negotiation": True, |
118 | + "link_detected": False, |
119 | + "infiniband": { |
120 | + "issm_name": "issm0", |
121 | + "issm_device": "231:64", |
122 | + "mad_name": "umad0", |
123 | + "mad_device": "231:0", |
124 | + "verb_name": "uverbs0", |
125 | + "verb_device": "231:192", |
126 | + }, |
127 | + }, |
128 | + { |
129 | + "id": "ibp4s0d1", |
130 | + "address": "a0:00:03:00:fe:80:00:00:00:00:00:00:e4:1d:2d:03:00:4f:06:e2", |
131 | + "port": 1, |
132 | + "protocol": "infiniband", |
133 | + "port_type": "other", |
134 | + "transceiver_type": "internal", |
135 | + "auto_negotiation": True, |
136 | + "link_detected": False, |
137 | + "infiniband": { |
138 | + "issm_name": "issm1", |
139 | + "issm_device": "231:65", |
140 | + "mad_name": "umad1", |
141 | + "mad_device": "231:1", |
142 | + "verb_name": "uverbs0", |
143 | + "verb_device": "231:192", |
144 | + }, |
145 | + }, |
146 | + ], |
147 | + "numa_node": 0, |
148 | + "pci_address": "0000:04:00.0", |
149 | + "vendor": "Mellanox Technologies", |
150 | + "vendor_id": "15b3", |
151 | + "product": "MT27500 Family [ConnectX-3]", |
152 | + "product_id": "1003", |
153 | + "firmware_version": "2.36.5000", |
154 | + }, |
155 | + { |
156 | + "driver": "cdc_ether", |
157 | + "driver_version": "5.4.0-80-generic", |
158 | + "ports": [ |
159 | + { |
160 | + "id": "idrac", |
161 | + "address": "10:98:36:99:7d:9e", |
162 | + "port": 0, |
163 | + "protocol": "ethernet", |
164 | + "auto_negotiation": False, |
165 | + "link_detected": False, |
166 | + } |
167 | + ], |
168 | + "numa_node": 0, |
169 | + "firmware_version": "CDC Ethernet Device", |
170 | + "usb_address": "1:4", |
171 | + }, |
172 | + ], |
173 | + "total": 4, |
174 | + } |
175 | +} |
176 | + |
177 | +SAMPLE_LXD_NETWORK_LP1939456 = { |
178 | + "bond0": { |
179 | + "addresses": [ |
180 | + { |
181 | + "family": "inet", |
182 | + "address": "10.206.123.143", |
183 | + "netmask": "24", |
184 | + "scope": "global", |
185 | + }, |
186 | + { |
187 | + "family": "inet6", |
188 | + "address": "fe80::60af:27ff:fe86:a7b5", |
189 | + "netmask": "64", |
190 | + "scope": "link", |
191 | + }, |
192 | + ], |
193 | + "counters": { |
194 | + "bytes_received": 61539371832, |
195 | + "bytes_sent": 12363017514, |
196 | + "packets_received": 46790270, |
197 | + "packets_sent": 26046855, |
198 | + }, |
199 | + "hwaddr": "62:af:27:86:a7:b5", |
200 | + "mtu": 1500, |
201 | + "state": "up", |
202 | + "type": "broadcast", |
203 | + "bond": { |
204 | + "mode": "802.3ad", |
205 | + "transmit_policy": "layer2", |
206 | + "up_delay": 0, |
207 | + "down_delay": 0, |
208 | + "mii_frequency": 100, |
209 | + "mii_state": "up", |
210 | + "lower_devices": ["eno2", "eno1"], |
211 | + }, |
212 | + "bridge": None, |
213 | + "vlan": None, |
214 | + }, |
215 | + "bond0.1": { |
216 | + "addresses": [ |
217 | + { |
218 | + "family": "inet", |
219 | + "address": "10.128.210.1", |
220 | + "netmask": "20", |
221 | + "scope": "global", |
222 | + }, |
223 | + { |
224 | + "family": "inet6", |
225 | + "address": "fe80::60af:27ff:fe86:a7b5", |
226 | + "netmask": "64", |
227 | + "scope": "link", |
228 | + }, |
229 | + ], |
230 | + "counters": { |
231 | + "bytes_received": 3264146, |
232 | + "bytes_sent": 1093111, |
233 | + "packets_received": 57665, |
234 | + "packets_sent": 5266, |
235 | + }, |
236 | + "hwaddr": "62:af:27:86:a7:b5", |
237 | + "mtu": 1500, |
238 | + "state": "up", |
239 | + "type": "broadcast", |
240 | + "bond": None, |
241 | + "bridge": None, |
242 | + "vlan": {"lower_device": "bond0", "vid": 1}, |
243 | + }, |
244 | + "bond0.240": { |
245 | + "addresses": [ |
246 | + { |
247 | + "family": "inet", |
248 | + "address": "10.240.0.1", |
249 | + "netmask": "24", |
250 | + "scope": "global", |
251 | + }, |
252 | + { |
253 | + "family": "inet6", |
254 | + "address": "fe80::60af:27ff:fe86:a7b5", |
255 | + "netmask": "64", |
256 | + "scope": "link", |
257 | + }, |
258 | + ], |
259 | + "counters": { |
260 | + "bytes_received": 7156780, |
261 | + "bytes_sent": 1035310179, |
262 | + "packets_received": 116634, |
263 | + "packets_sent": 75712, |
264 | + }, |
265 | + "hwaddr": "62:af:27:86:a7:b5", |
266 | + "mtu": 1500, |
267 | + "state": "up", |
268 | + "type": "broadcast", |
269 | + "bond": None, |
270 | + "bridge": None, |
271 | + "vlan": {"lower_device": "bond0", "vid": 240}, |
272 | + }, |
273 | + "eno1": { |
274 | + "addresses": [], |
275 | + "counters": { |
276 | + "bytes_received": 11639365749, |
277 | + "bytes_sent": 3271900148, |
278 | + "packets_received": 9125767, |
279 | + "packets_sent": 5627403, |
280 | + }, |
281 | + "hwaddr": "62:af:27:86:a7:b5", |
282 | + "mtu": 1500, |
283 | + "state": "up", |
284 | + "type": "broadcast", |
285 | + "bond": None, |
286 | + "bridge": None, |
287 | + "vlan": None, |
288 | + }, |
289 | + "eno2": { |
290 | + "addresses": [], |
291 | + "counters": { |
292 | + "bytes_received": 49900006083, |
293 | + "bytes_sent": 9091117366, |
294 | + "packets_received": 37664503, |
295 | + "packets_sent": 20419452, |
296 | + }, |
297 | + "hwaddr": "62:af:27:86:a7:b5", |
298 | + "mtu": 1500, |
299 | + "state": "down", |
300 | + "type": "broadcast", |
301 | + "bond": None, |
302 | + "bridge": None, |
303 | + "vlan": None, |
304 | + }, |
305 | + "ibp4s0": { |
306 | + "addresses": [], |
307 | + "counters": { |
308 | + "bytes_received": 0, |
309 | + "bytes_sent": 0, |
310 | + "packets_received": 0, |
311 | + "packets_sent": 0, |
312 | + }, |
313 | + "hwaddr": "a0:00:02:20:fe:80:00:00:00:00:00:00:e4:1d:2d:03:00:4f:06:e1", |
314 | + "mtu": 4092, |
315 | + "state": "down", |
316 | + "type": "broadcast", |
317 | + "bond": None, |
318 | + "bridge": None, |
319 | + "vlan": None, |
320 | + }, |
321 | + "ibp4s0d1": { |
322 | + "addresses": [], |
323 | + "counters": { |
324 | + "bytes_received": 0, |
325 | + "bytes_sent": 0, |
326 | + "packets_received": 0, |
327 | + "packets_sent": 0, |
328 | + }, |
329 | + "hwaddr": "a0:00:03:00:fe:80:00:00:00:00:00:00:e4:1d:2d:03:00:4f:06:e2", |
330 | + "mtu": 4092, |
331 | + "state": "down", |
332 | + "type": "broadcast", |
333 | + "bond": None, |
334 | + "bridge": None, |
335 | + "vlan": None, |
336 | + }, |
337 | + "idrac": { |
338 | + "addresses": [], |
339 | + "counters": { |
340 | + "bytes_received": 0, |
341 | + "bytes_sent": 0, |
342 | + "packets_received": 0, |
343 | + "packets_sent": 0, |
344 | + }, |
345 | + "hwaddr": "10:98:36:99:7d:9e", |
346 | + "mtu": 1500, |
347 | + "state": "down", |
348 | + "type": "broadcast", |
349 | + "bond": None, |
350 | + "bridge": None, |
351 | + "vlan": None, |
352 | + }, |
353 | + "lo": { |
354 | + "addresses": [ |
355 | + { |
356 | + "family": "inet", |
357 | + "address": "127.0.0.1", |
358 | + "netmask": "8", |
359 | + "scope": "local", |
360 | + }, |
361 | + { |
362 | + "family": "inet6", |
363 | + "address": "::1", |
364 | + "netmask": "128", |
365 | + "scope": "local", |
366 | + }, |
367 | + ], |
368 | + "counters": { |
369 | + "bytes_received": 15773896406, |
370 | + "bytes_sent": 15773896406, |
371 | + "packets_received": 14090610, |
372 | + "packets_sent": 14090610, |
373 | + }, |
374 | + "hwaddr": "", |
375 | + "mtu": 65536, |
376 | + "state": "up", |
377 | + "type": "loopback", |
378 | + "bond": None, |
379 | + "bridge": None, |
380 | + "vlan": None, |
381 | + }, |
382 | +} |
383 | + |
384 | |
385 | KERNEL_CMDLINE_OUTPUT = ( |
386 | "BOOT_IMAGE=http://10.245.136.6:5248/images/ubuntu/amd64/generic/bionic/" |
387 | @@ -4171,3 +4516,18 @@ class TestHardwareSyncMemoryNotify(MAASServerTestCase): |
388 | event.description, |
389 | f"1.1 GB of memory was added on node {node.system_id}", |
390 | ) |
391 | + |
392 | + |
393 | +class TestParseInterfaces(MAASServerTestCase): |
394 | + def test_skips_ipoib_mac(self): |
395 | + node = factory.make_Node(with_boot_disk=False, interface=True) |
396 | + resources = deepcopy(SAMPLE_LXD_RESOURCES) |
397 | + resources.update(SAMPLE_LXD_RESOURCES_NETWORK_LP1939456) |
398 | + data = make_lxd_output( |
399 | + resources=resources, networks=SAMPLE_LXD_NETWORK_LP1939456 |
400 | + ) |
401 | + interfaces = parse_interfaces(node, data) |
402 | + self.assertEqual( |
403 | + interfaces.keys(), |
404 | + {"44:a8:42:ba:a3:b4", "44:a8:42:ba:a3:b6", "10:98:36:99:7d:9e"}, |
405 | + ) |
406 | diff --git a/src/provisioningserver/utils/ipaddr.py b/src/provisioningserver/utils/ipaddr.py |
407 | index 5484ef1..885907e 100644 |
408 | --- a/src/provisioningserver/utils/ipaddr.py |
409 | +++ b/src/provisioningserver/utils/ipaddr.py |
410 | @@ -32,6 +32,20 @@ def get_ip_addr(): |
411 | return ifaces |
412 | |
413 | |
414 | +def is_ipoib_mac(mac: str) -> bool: |
415 | + """Is the given mac an IP over Infiniband device?""" |
416 | + # Regular MAC address as a string is 17 bytes: 6 octets, with 5 |
417 | + # colons e.g. |
418 | + # |
419 | + # DE:FE:C8:BE:EF:01 |
420 | + # ----|----|----|-| |
421 | + # 5 10 15 17 |
422 | + # |
423 | + # We skip longer ones which come from IP over Infiniband. See |
424 | + # LP:1939456 |
425 | + return len(mac) > 17 |
426 | + |
427 | + |
428 | def get_mac_addresses(): |
429 | """Returns a list of this system's MAC addresses. |
430 | |
431 | @@ -39,7 +53,13 @@ def get_mac_addresses(): |
432 | gathered. |
433 | """ |
434 | ip_addr = get_ip_addr() |
435 | - return list({iface["mac"] for iface in ip_addr.values() if iface["mac"]}) |
436 | + return list( |
437 | + { |
438 | + iface["mac"] |
439 | + for iface in ip_addr.values() |
440 | + if iface["mac"] and not is_ipoib_mac(iface["mac"]) |
441 | + } |
442 | + ) |
443 | |
444 | |
445 | def get_machine_default_gateway_ip(): |
446 | diff --git a/src/provisioningserver/utils/tests/test_ipaddr.py b/src/provisioningserver/utils/tests/test_ipaddr.py |
447 | index cfab537..21081e7 100644 |
448 | --- a/src/provisioningserver/utils/tests/test_ipaddr.py |
449 | +++ b/src/provisioningserver/utils/tests/test_ipaddr.py |
450 | @@ -176,6 +176,20 @@ class TestGetIPAddr(MAASTestCase): |
451 | observed = get_mac_addresses() |
452 | self.assertCountEqual(mac_addresses, observed) |
453 | |
454 | + def test_get_mac_addresses_skips_ipoib_mac_addresses(self): |
455 | + mac_addresses = [] |
456 | + results = {} |
457 | + for _ in range(3): |
458 | + mac = factory.make_mac_address() |
459 | + mac_addresses.append(mac) |
460 | + results[factory.make_name("eth")] = {"mac": mac} |
461 | + results[factory.make_name("ibp")] = { |
462 | + "mac": "a0:00:02:20:fe:80:00:00:00:00:00:00:e4:1d:2d:03:00:4f:06:e1" |
463 | + } |
464 | + self.patch(ipaddr_module, "get_ip_addr").return_value = results |
465 | + observed = get_mac_addresses() |
466 | + self.assertCountEqual(mac_addresses, observed) |
467 | + |
468 | |
469 | class TestUpdateInterfaceType(FakeSysProcTestCase): |
470 | def test_ipip(self): |
UNIT TESTS at-startup lp:~adam-collard/maas/+git/maas into -b master lp:~maas-committers/maas
-b skip-ipoib-
STATUS: SUCCESS db963f970c19f83 26cecc98bb
COMMIT: 1194a817477e106