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

Proposed by Mike Pontillo
Status: Superseded
Proposed branch: lp:~mpontillo/curtin/fix-improper-bond-parameters-bug-1588547
Merge into: lp:~curtin-dev/curtin/trunk
Prerequisite: lp:~mpontillo/curtin/fix-improper-inet6-bug-1588547
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) Needs Fixing
Review via email: mp+296382@code.launchpad.net

This proposal has been superseded by 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 :

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 :

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 :

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 :

Thanks for the review; some replies below.

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

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

390. By Mike Pontillo

Don't add additional parameters to alias interfaces. (Rebase from trunk and address review comments.)

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'curtin/net/__init__.py'
2--- curtin/net/__init__.py 2016-04-20 20:03:00 +0000
3+++ curtin/net/__init__.py 2016-06-03 19:53:40 +0000
4@@ -331,7 +331,14 @@
5
6
7 # TODO: switch to valid_map for attrs
8-def iface_add_attrs(iface):
9+def iface_add_attrs(iface, index):
10+ # If the index is non-zero, this is an alias interface. Alias interfaces
11+ # represent additional interface addresses, and should not have additional
12+ # attributes. (extra attributes here are almost always either incorrect,
13+ # or are applied to the parent interface.) So if this is an alias, stop
14+ # right here.
15+ if index != 0:
16+ return ""
17 content = ""
18 ignore_map = [
19 'control',
20@@ -432,13 +439,13 @@
21
22 content += iface_start_entry(iface, index)
23 content += iface_add_subnet(iface, subnet)
24- content += iface_add_attrs(iface)
25+ content += iface_add_attrs(iface, index)
26 else:
27 # ifenslave docs say to auto the slave devices
28 if 'bond-master' in iface:
29 content += "auto {name}\n".format(**iface)
30 content += "iface {name} {inet} {mode}\n".format(**iface)
31- content += iface_add_attrs(iface)
32+ content += iface_add_attrs(iface, index)
33
34 for route in network_state.get('routes'):
35 content += render_route(route)
36
37=== modified file 'examples/tests/bonding_network.yaml'
38--- examples/tests/bonding_network.yaml 2016-05-17 20:04:00 +0000
39+++ examples/tests/bonding_network.yaml 2016-06-03 19:53:40 +0000
40@@ -26,6 +26,8 @@
41 subnets:
42 - type: static
43 address: 10.23.23.2/24
44+ - type: static
45+ address: 10.23.24.2/24
46
47 curthooks_commands:
48 # use curtin to disable open-iscsi ifupdown hooks for precise; they're
49
50=== modified file 'tests/unittests/test_net.py'
51--- tests/unittests/test_net.py 2016-05-17 20:04:00 +0000
52+++ tests/unittests/test_net.py 2016-06-03 19:53:40 +0000
53@@ -517,6 +517,10 @@
54 hwaddress 52:54:00:12:34:06
55 bond-slaves none
56
57+ auto bond0:1
58+ iface bond0:1 inet static
59+ address 10.23.24.2/24
60+
61 source /etc/network/interfaces.d/*.cfg
62 """)
63 net_ifaces = net.render_interfaces(ns.network_state)
64@@ -549,7 +553,6 @@
65 auto interface1:1
66 iface interface1:1 inet static
67 address 192.168.14.4/24
68- mtu 1492
69
70 allow-hotplug interface2
71 iface interface2 inet static

Subscribers

People subscribed via source and target branches