Merge lp:~mpontillo/curtin/fix-improper-bond-parameters-bug-1588547 into lp:~curtin-dev/curtin/trunk

Proposed by Mike Pontillo
Status: Merged
Merged at revision: 390
Proposed branch: lp:~mpontillo/curtin/fix-improper-bond-parameters-bug-1588547
Merge into: lp:~curtin-dev/curtin/trunk
Diff against target: 71 lines (+16/-4)
3 files modified
curtin/net/__init__.py (+10/-3)
examples/tests/bonding_network.yaml (+2/-0)
tests/unittests/test_net.py (+4/-1)
To merge this branch: bzr merge lp:~mpontillo/curtin/fix-improper-bond-parameters-bug-1588547
Reviewer Review Type Date Requested Status
Ryan Harper (community) Approve
Review via email: mp+296469@code.launchpad.net

This proposal supersedes a proposal from 2016-06-03.

Commit message

Don't add additional parameters to alias interfaces.

To post a comment you must log in.
Revision history for this message
Mike Pontillo (mpontillo) wrote : Posted in a previous version of this proposal

Note that this change also removed the 'mtu' output from the alias interface on another test case. (I don't think it would have any effect anyway; setting the MTU on an alias just sets it on the parent.)

Revision history for this message
Ryan Harper (raharper) wrote : Posted in a previous version of this proposal

This looks good. Comments below, mostly would like to re-use the existing bonding config as this will automatically get validated in unittest and in vmtests if you update the current bonding_network.yaml in examples/tests/ dir instead of inlining it in the unittest.

review: Needs Fixing
Revision history for this message
Mike Pontillo (mpontillo) wrote : Posted in a previous version of this proposal

Do the vmtests need to change as well? I only ran the unit tests when I did the fix.

Revision history for this message
Mike Pontillo (mpontillo) wrote : Posted in a previous version of this proposal

Thanks for the review; some replies below.

Revision history for this message
Ryan Harper (raharper) wrote : Posted in a previous version of this proposal

On Fri, Jun 3, 2016 at 2:44 PM, Mike Pontillo <email address hidden>
wrote:

> Thanks for the review; some replies below.
>
> Diff comments:
>
> > === modified file 'curtin/net/__init__.py'
> > --- curtin/net/__init__.py 2016-06-03 00:35:50 +0000
> > +++ curtin/net/__init__.py 2016-06-03 00:35:50 +0000
> > @@ -331,7 +331,12 @@
> >
> >
> > # TODO: switch to valid_map for attrs
> > -def iface_add_attrs(iface):
> > +def iface_add_attrs(iface, index):
> > + # If the index is non-zero, this is an alias interface. Alias
> interfaces
> > + # represent additional interface addresses, and cannot have
> additional
> > + # attributes. So if this is an alias, stop right here.
>
> Well, ifupdown doesn't do much in the way of model validation. ;-) An
> alias is really just a (deprecated, I think) way to add more addresses to
> an interface. (that is to say, ifupdown may well allow them, I can't think
> of any cases where that isn't arguably a bug in ifupdown.)
>
> https://bugs.launchpad.net/maas/+bug/1588547/comments/5
>
>
It's probably worth supplying what the preferred eni should look like;
I'm certainly no bonding expert but attempted to apply formatting as
suggested
by the ifenslave documentation.

Ryan

Revision history for this message
Ryan Harper (raharper) wrote :

Looks good. I'll handle any errors during the vmtest run.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'curtin/net/__init__.py'
--- curtin/net/__init__.py 2016-04-20 20:03:00 +0000
+++ curtin/net/__init__.py 2016-06-03 19:53:48 +0000
@@ -331,7 +331,14 @@
331331
332332
333# TODO: switch to valid_map for attrs333# TODO: switch to valid_map for attrs
334def iface_add_attrs(iface):334def iface_add_attrs(iface, index):
335 # If the index is non-zero, this is an alias interface. Alias interfaces
336 # represent additional interface addresses, and should not have additional
337 # attributes. (extra attributes here are almost always either incorrect,
338 # or are applied to the parent interface.) So if this is an alias, stop
339 # right here.
340 if index != 0:
341 return ""
335 content = ""342 content = ""
336 ignore_map = [343 ignore_map = [
337 'control',344 'control',
@@ -432,13 +439,13 @@
432439
433 content += iface_start_entry(iface, index)440 content += iface_start_entry(iface, index)
434 content += iface_add_subnet(iface, subnet)441 content += iface_add_subnet(iface, subnet)
435 content += iface_add_attrs(iface)442 content += iface_add_attrs(iface, index)
436 else:443 else:
437 # ifenslave docs say to auto the slave devices444 # ifenslave docs say to auto the slave devices
438 if 'bond-master' in iface:445 if 'bond-master' in iface:
439 content += "auto {name}\n".format(**iface)446 content += "auto {name}\n".format(**iface)
440 content += "iface {name} {inet} {mode}\n".format(**iface)447 content += "iface {name} {inet} {mode}\n".format(**iface)
441 content += iface_add_attrs(iface)448 content += iface_add_attrs(iface, index)
442449
443 for route in network_state.get('routes'):450 for route in network_state.get('routes'):
444 content += render_route(route)451 content += render_route(route)
445452
=== modified file 'examples/tests/bonding_network.yaml'
--- examples/tests/bonding_network.yaml 2016-05-17 20:04:00 +0000
+++ examples/tests/bonding_network.yaml 2016-06-03 19:53:48 +0000
@@ -26,6 +26,8 @@
26 subnets:26 subnets:
27 - type: static27 - type: static
28 address: 10.23.23.2/2428 address: 10.23.23.2/24
29 - type: static
30 address: 10.23.24.2/24
2931
30curthooks_commands:32curthooks_commands:
31 # use curtin to disable open-iscsi ifupdown hooks for precise; they're33 # use curtin to disable open-iscsi ifupdown hooks for precise; they're
3234
=== modified file 'tests/unittests/test_net.py'
--- tests/unittests/test_net.py 2016-05-17 20:04:00 +0000
+++ tests/unittests/test_net.py 2016-06-03 19:53:48 +0000
@@ -517,6 +517,10 @@
517 hwaddress 52:54:00:12:34:06517 hwaddress 52:54:00:12:34:06
518 bond-slaves none518 bond-slaves none
519519
520 auto bond0:1
521 iface bond0:1 inet static
522 address 10.23.24.2/24
523
520 source /etc/network/interfaces.d/*.cfg524 source /etc/network/interfaces.d/*.cfg
521 """)525 """)
522 net_ifaces = net.render_interfaces(ns.network_state)526 net_ifaces = net.render_interfaces(ns.network_state)
@@ -549,7 +553,6 @@
549 auto interface1:1553 auto interface1:1
550 iface interface1:1 inet static554 iface interface1:1 inet static
551 address 192.168.14.4/24555 address 192.168.14.4/24
552 mtu 1492
553556
554 allow-hotplug interface2557 allow-hotplug interface2
555 iface interface2 inet static558 iface interface2 inet static

Subscribers

People subscribed via source and target branches