Merge ~rjschwei/cloud-init:activateNet into cloud-init:master

Proposed by Robert Schweikert
Status: Merged
Approved by: Chad Smith
Approved revision: 6732e10fa677566a2ddcbc7ff6727cf697d35761
Merge reported by: Server Team CI bot
Merged at revision: not available
Proposed branch: ~rjschwei/cloud-init:activateNet
Merge into: cloud-init:master
Diff against target: 412 lines (+50/-0)
3 files modified
cloudinit/net/sysconfig.py (+2/-0)
tests/unittests/test_distros/test_netconfig.py (+8/-0)
tests/unittests/test_net.py (+40/-0)
Reviewer Review Type Date Requested Status
Server Team CI bot continuous-integration Approve
Chad Smith Approve
Review via email: mp+357710@code.launchpad.net

Commit message

sysconfig: On SUSE, use STARTMODE instead of ONBOOT

ONBOOT is not recognized on openSUSE and SUSE Linux Enterprise,
add the STARTMODE setting

LP: #1799540

To post a comment you must log in.
Revision history for this message
Server Team CI bot (server-team-bot) wrote :

PASSED: Continuous integration, rev:6732e10fa677566a2ddcbc7ff6727cf697d35761
https://jenkins.ubuntu.com/server/job/cloud-init-ci/409/
Executed test runs:
    SUCCESS: Checkout
    SUCCESS: Unit & Style Tests
    SUCCESS: Ubuntu LTS: Build
    SUCCESS: Ubuntu LTS: Integration
    IN_PROGRESS: Declarative: Post Actions

Click here to trigger a rebuild:
https://jenkins.ubuntu.com/server/job/cloud-init-ci/409/rebuild

review: Approve (continuous-integration)
Revision history for this message
Ryan Harper (raharper) wrote :

I think this should be OK if Centos images will ignore the STARTMODE variable, right? or that it's in-sync with the ONBOOT value?

If this is a SUSE/wicked only setting, we may want to have some way to toggle the left-hand side value to be either ONBOOT or STARTMODE depending on the distro?

Revision history for this message
Robert Schweikert (rjschwei) wrote :

> I think this should be OK if Centos images will ignore the STARTMODE variable,
> right? or that it's in-sync with the ONBOOT value?

I do not know the behavior of the tools on Centos when they see values they do not understand. wicked simply ignores unknown stuff and one would hope that Centos tools work the same way, but it would have to be tested.

>
> If this is a SUSE/wicked only setting, we may want to have some way to toggle
> the left-hand side value to be either ONBOOT or STARTMODE depending on the
> distro?

I don't think that we have any notion in the sysconfig.py implementation about where we are, see my comment in lp#1799540 (which is why I didn't take that and provide a patch). I think if we want to toggle the left hand side it requires bigger surgery.

Revision history for this message
Mina Galić (minagalic) wrote :

> > I think this should be OK if Centos images will ignore the STARTMODE
> variable,
> > right? or that it's in-sync with the ONBOOT value?
>
> I do not know the behavior of the tools on Centos when they see values they do

Would be pretty cool if Jenkins could tell us…

Revision history for this message
Chad Smith (chad.smith) wrote :

Confirmed that ifconfig ignores invalid/unknown values on CentOS6.

Revision history for this message
Chad Smith (chad.smith) wrote :

This looks good as is, the underlying parsing of left-hand values seems to silently ignore unexpected values on centos and opensuse. I don't feel like this use case is big enough/significant enough to distro-specialize the renderer at the moment.

Revision history for this message
Chad Smith (chad.smith) :
review: Approve
Revision history for this message
Chad Smith (chad.smith) wrote :

We can revisit a specialized implementation if a bug/feature requires us to work around distro behavior.

Revision history for this message
Server Team CI bot (server-team-bot) wrote :

Commit message lints:
 - Expected empty line on line 2 of the commit message

review: Needs Fixing
Revision history for this message
Server Team CI bot (server-team-bot) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
2index 9c16d3a..ff84703 100644
3--- a/cloudinit/net/sysconfig.py
4+++ b/cloudinit/net/sysconfig.py
5@@ -242,6 +242,7 @@ class Renderer(renderer.Renderer):
6 ('USERCTL', False),
7 ('NM_CONTROLLED', False),
8 ('BOOTPROTO', 'none'),
9+ ('STARTMODE', 'auto'),
10 ])
11
12 # If these keys exist, then their values will be used to form
13@@ -336,6 +337,7 @@ class Renderer(renderer.Renderer):
14 iface_cfg.name))
15 if subnet.get('control') == 'manual':
16 iface_cfg['ONBOOT'] = False
17+ iface_cfg['STARTMODE'] = 'manual'
18
19 # set IPv4 and IPv6 static addresses
20 ipv4_index = -1
21diff --git a/tests/unittests/test_distros/test_netconfig.py b/tests/unittests/test_distros/test_netconfig.py
22index 6e33935..e986b59 100644
23--- a/tests/unittests/test_distros/test_netconfig.py
24+++ b/tests/unittests/test_distros/test_netconfig.py
25@@ -468,6 +468,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
26 NETMASK=255.255.255.0
27 NM_CONTROLLED=no
28 ONBOOT=yes
29+ STARTMODE=auto
30 TYPE=Ethernet
31 USERCTL=no
32 """),
33@@ -476,6 +477,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
34 DEVICE=eth1
35 NM_CONTROLLED=no
36 ONBOOT=yes
37+ STARTMODE=auto
38 TYPE=Ethernet
39 USERCTL=no
40 """),
41@@ -499,6 +501,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
42 IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
43 NM_CONTROLLED=no
44 ONBOOT=yes
45+ STARTMODE=auto
46 TYPE=Ethernet
47 USERCTL=no
48 """),
49@@ -507,6 +510,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
50 DEVICE=eth1
51 NM_CONTROLLED=no
52 ONBOOT=yes
53+ STARTMODE=auto
54 TYPE=Ethernet
55 USERCTL=no
56 """),
57@@ -559,6 +563,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
58 NETMASK=255.255.255.0
59 NM_CONTROLLED=no
60 ONBOOT=yes
61+ STARTMODE=auto
62 TYPE=Ethernet
63 USERCTL=no
64 """),
65@@ -567,6 +572,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
66 DEVICE=eth1
67 NM_CONTROLLED=no
68 ONBOOT=yes
69+ STARTMODE=auto
70 TYPE=Ethernet
71 USERCTL=no
72 """),
73@@ -587,6 +593,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
74 IPV6_DEFAULTGW=2607:f0d0:1002:0011::1
75 NM_CONTROLLED=no
76 ONBOOT=yes
77+ STARTMODE=auto
78 TYPE=Ethernet
79 USERCTL=no
80 """),
81@@ -595,6 +602,7 @@ class TestNetCfgDistroOpensuse(TestNetCfgDistroBase):
82 DEVICE=eth1
83 NM_CONTROLLED=no
84 ONBOOT=yes
85+ STARTMODE=auto
86 TYPE=Ethernet
87 USERCTL=no
88 """),
89diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
90index 8e38373..d94b943 100644
91--- a/tests/unittests/test_net.py
92+++ b/tests/unittests/test_net.py
93@@ -144,6 +144,7 @@ IPADDR=172.19.1.34
94 NETMASK=255.255.252.0
95 NM_CONTROLLED=no
96 ONBOOT=yes
97+STARTMODE=auto
98 TYPE=Ethernet
99 USERCTL=no
100 """.lstrip()),
101@@ -177,6 +178,7 @@ IPADDR=172.19.1.34
102 NETMASK=255.255.252.0
103 NM_CONTROLLED=no
104 ONBOOT=yes
105+STARTMODE=auto
106 TYPE=Ethernet
107 USERCTL=no
108 """.lstrip()),
109@@ -246,6 +248,7 @@ NETMASK=255.255.252.0
110 NETMASK1=255.255.255.0
111 NM_CONTROLLED=no
112 ONBOOT=yes
113+STARTMODE=auto
114 TYPE=Ethernet
115 USERCTL=no
116 """.lstrip()),
117@@ -281,6 +284,7 @@ NETMASK=255.255.252.0
118 NETMASK1=255.255.255.0
119 NM_CONTROLLED=no
120 ONBOOT=yes
121+STARTMODE=auto
122 TYPE=Ethernet
123 USERCTL=no
124 """.lstrip()),
125@@ -372,6 +376,7 @@ IPV6_DEFAULTGW=2001:DB8::1
126 NETMASK=255.255.252.0
127 NM_CONTROLLED=no
128 ONBOOT=yes
129+STARTMODE=auto
130 TYPE=Ethernet
131 USERCTL=no
132 """.lstrip()),
133@@ -409,6 +414,7 @@ IPV6_DEFAULTGW=2001:DB8::1
134 NETMASK=255.255.252.0
135 NM_CONTROLLED=no
136 ONBOOT=yes
137+STARTMODE=auto
138 TYPE=Ethernet
139 USERCTL=no
140 """.lstrip()),
141@@ -524,6 +530,7 @@ NETWORK_CONFIGS = {
142 HWADDR=cf:d6:af:48:e8:80
143 NM_CONTROLLED=no
144 ONBOOT=yes
145+ STARTMODE=auto
146 TYPE=Ethernet
147 USERCTL=no"""),
148 'ifcfg-eth99': textwrap.dedent("""\
149@@ -539,6 +546,7 @@ NETWORK_CONFIGS = {
150 NETMASK=255.255.255.0
151 NM_CONTROLLED=no
152 ONBOOT=yes
153+ STARTMODE=auto
154 TYPE=Ethernet
155 USERCTL=no"""),
156 },
157@@ -652,6 +660,7 @@ NETWORK_CONFIGS = {
158 NETMASK=255.255.255.0
159 NM_CONTROLLED=no
160 ONBOOT=yes
161+ STARTMODE=auto
162 TYPE=Ethernet
163 USERCTL=no
164 MTU=9000
165@@ -691,6 +700,7 @@ NETWORK_CONFIGS = {
166 DEVICE=iface0
167 NM_CONTROLLED=no
168 ONBOOT=yes
169+ STARTMODE=auto
170 TYPE=Ethernet
171 USERCTL=no
172 """),
173@@ -894,6 +904,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
174 MACADDR=aa:bb:cc:dd:ee:ff
175 NM_CONTROLLED=no
176 ONBOOT=yes
177+ STARTMODE=auto
178 TYPE=Bond
179 USERCTL=no"""),
180 'ifcfg-bond0.200': textwrap.dedent("""\
181@@ -902,6 +913,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
182 NM_CONTROLLED=no
183 ONBOOT=yes
184 PHYSDEV=bond0
185+ STARTMODE=auto
186 TYPE=Ethernet
187 USERCTL=no
188 VLAN=yes"""),
189@@ -919,6 +931,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
190 NM_CONTROLLED=no
191 ONBOOT=yes
192 PRIO=22
193+ STARTMODE=auto
194 STP=no
195 TYPE=Bridge
196 USERCTL=no"""),
197@@ -928,6 +941,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
198 HWADDR=c0:d6:9f:2c:e8:80
199 NM_CONTROLLED=no
200 ONBOOT=yes
201+ STARTMODE=auto
202 TYPE=Ethernet
203 USERCTL=no"""),
204 'ifcfg-eth0.101': textwrap.dedent("""\
205@@ -946,6 +960,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
206 NM_CONTROLLED=no
207 ONBOOT=yes
208 PHYSDEV=eth0
209+ STARTMODE=auto
210 TYPE=Ethernet
211 USERCTL=no
212 VLAN=yes"""),
213@@ -956,6 +971,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
214 MASTER=bond0
215 NM_CONTROLLED=no
216 ONBOOT=yes
217+ STARTMODE=auto
218 SLAVE=yes
219 TYPE=Ethernet
220 USERCTL=no"""),
221@@ -966,6 +982,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
222 MASTER=bond0
223 NM_CONTROLLED=no
224 ONBOOT=yes
225+ STARTMODE=auto
226 SLAVE=yes
227 TYPE=Ethernet
228 USERCTL=no"""),
229@@ -976,6 +993,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
230 HWADDR=66:bb:9f:2c:e8:80
231 NM_CONTROLLED=no
232 ONBOOT=yes
233+ STARTMODE=auto
234 TYPE=Ethernet
235 USERCTL=no"""),
236 'ifcfg-eth4': textwrap.dedent("""\
237@@ -985,6 +1003,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
238 HWADDR=98:bb:9f:2c:e8:80
239 NM_CONTROLLED=no
240 ONBOOT=yes
241+ STARTMODE=auto
242 TYPE=Ethernet
243 USERCTL=no"""),
244 'ifcfg-eth5': textwrap.dedent("""\
245@@ -993,6 +1012,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
246 HWADDR=98:bb:9f:2c:e8:8a
247 NM_CONTROLLED=no
248 ONBOOT=no
249+ STARTMODE=manual
250 TYPE=Ethernet
251 USERCTL=no""")
252 },
253@@ -1282,6 +1302,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
254 NETMASK1=255.255.255.0
255 NM_CONTROLLED=no
256 ONBOOT=yes
257+ STARTMODE=auto
258 TYPE=Bond
259 USERCTL=no
260 """),
261@@ -1293,6 +1314,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
262 NM_CONTROLLED=no
263 ONBOOT=yes
264 SLAVE=yes
265+ STARTMODE=auto
266 TYPE=Ethernet
267 USERCTL=no
268 """),
269@@ -1309,6 +1331,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
270 NM_CONTROLLED=no
271 ONBOOT=yes
272 SLAVE=yes
273+ STARTMODE=auto
274 TYPE=Ethernet
275 USERCTL=no
276 """),
277@@ -1334,6 +1357,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
278 NETMASK1=255.255.255.0
279 NM_CONTROLLED=no
280 ONBOOT=yes
281+ STARTMODE=auto
282 TYPE=Bond
283 USERCTL=no
284 """),
285@@ -1345,6 +1369,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
286 NM_CONTROLLED=no
287 ONBOOT=yes
288 SLAVE=yes
289+ STARTMODE=auto
290 TYPE=Ethernet
291 USERCTL=no
292 """),
293@@ -1363,6 +1388,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
294 NM_CONTROLLED=no
295 ONBOOT=yes
296 SLAVE=yes
297+ STARTMODE=auto
298 TYPE=Ethernet
299 USERCTL=no
300 """),
301@@ -1400,6 +1426,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
302 HWADDR=aa:bb:cc:dd:e8:00
303 NM_CONTROLLED=no
304 ONBOOT=yes
305+ STARTMODE=auto
306 TYPE=Ethernet
307 USERCTL=no"""),
308 'ifcfg-en0.99': textwrap.dedent("""\
309@@ -1418,6 +1445,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
310 NM_CONTROLLED=no
311 ONBOOT=yes
312 PHYSDEV=en0
313+ STARTMODE=auto
314 TYPE=Ethernet
315 USERCTL=no
316 VLAN=yes"""),
317@@ -1459,6 +1487,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
318 NM_CONTROLLED=no
319 ONBOOT=yes
320 PRIO=22
321+ STARTMODE=auto
322 STP=no
323 TYPE=Bridge
324 USERCTL=no
325@@ -1472,6 +1501,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
326 IPV6INIT=yes
327 NM_CONTROLLED=no
328 ONBOOT=yes
329+ STARTMODE=auto
330 TYPE=Ethernet
331 USERCTL=no
332 """),
333@@ -1484,6 +1514,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
334 IPV6INIT=yes
335 NM_CONTROLLED=no
336 ONBOOT=yes
337+ STARTMODE=auto
338 TYPE=Ethernet
339 USERCTL=no
340 """),
341@@ -1558,6 +1589,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
342 NETMASK=255.255.255.0
343 NM_CONTROLLED=no
344 ONBOOT=no
345+ STARTMODE=manual
346 TYPE=Ethernet
347 USERCTL=no
348 """),
349@@ -1568,6 +1600,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
350 MTU=1480
351 NM_CONTROLLED=no
352 ONBOOT=yes
353+ STARTMODE=auto
354 TYPE=Ethernet
355 USERCTL=no
356 """),
357@@ -1577,6 +1610,7 @@ pre-down route del -net 10.0.0.0 netmask 255.0.0.0 gw 11.0.0.1 metric 3 || true
358 HWADDR=52:54:00:12:34:ff
359 NM_CONTROLLED=no
360 ONBOOT=no
361+ STARTMODE=manual
362 TYPE=Ethernet
363 USERCTL=no
364 """),
365@@ -1933,6 +1967,7 @@ DEVICE=eth1000
366 HWADDR=07-1C-C6-75-A4-BE
367 NM_CONTROLLED=no
368 ONBOOT=yes
369+STARTMODE=auto
370 TYPE=Ethernet
371 USERCTL=no
372 """.lstrip()
373@@ -2054,6 +2089,7 @@ IPADDR=10.0.2.15
374 NETMASK=255.255.255.0
375 NM_CONTROLLED=no
376 ONBOOT=yes
377+STARTMODE=auto
378 TYPE=Ethernet
379 USERCTL=no
380 """
381@@ -2075,6 +2111,7 @@ BOOTPROTO=dhcp
382 DEVICE=eth0
383 NM_CONTROLLED=no
384 ONBOOT=yes
385+STARTMODE=auto
386 TYPE=Ethernet
387 USERCTL=no
388 """
389@@ -2222,6 +2259,7 @@ DEVICE=eth1000
390 HWADDR=07-1C-C6-75-A4-BE
391 NM_CONTROLLED=no
392 ONBOOT=yes
393+STARTMODE=auto
394 TYPE=Ethernet
395 USERCTL=no
396 """.lstrip()
397@@ -2343,6 +2381,7 @@ IPADDR=10.0.2.15
398 NETMASK=255.255.255.0
399 NM_CONTROLLED=no
400 ONBOOT=yes
401+STARTMODE=auto
402 TYPE=Ethernet
403 USERCTL=no
404 """
405@@ -2364,6 +2403,7 @@ BOOTPROTO=dhcp
406 DEVICE=eth0
407 NM_CONTROLLED=no
408 ONBOOT=yes
409+STARTMODE=auto
410 TYPE=Ethernet
411 USERCTL=no
412 """

Subscribers

People subscribed via source and target branches