summaryrefslogtreecommitdiff
path: root/0003-Setting-autoconnect-priority-setting-for-network-scr.patch
blob: 3a1513b57c97d73731a184d10752fab6ea51038e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
From 8a2fcbbcfdfc1df6f6c18f96588154f40083a239 Mon Sep 17 00:00:00 2001
From: Ani Sinha <anisinha@redhat.com>
Date: Wed, 13 Dec 2023 11:55:16 +0530
Subject: [PATCH] Setting autoconnect priority setting for network-scripts

Squashed the following three downstream only commits from RHEL 9.3:

Commit 1:

Setting highest autoconnect priority for network-scripts

RH-Author: Eduardo Otubo <otubo@redhat.com>
RH-MergeRequest: 22: Setting highest autoconnect priority for network-scripts
RH-Commit: [1/1] 34f1d62f8934a983a124df95b861a1e448681d3b (otubo/cloud-init-src)
RH-Bugzilla: 2036060
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Emanuele Giuseppe Esposito <eesposit@redhat.com>

Set the highest autoconnect priority for network-scripts which is
loaded by NetworkManager ifcfg-rh plugin.  Note that keyfile is the only
and default existing plugin on RHEL9, by setting the highest autoconnect
priority for network-scripts, NetworkManager will activate
network-scripts but keyfile.  Network-scripts path:

Since this is a blocking issue, we decided to have this one-liner
downstream-only patch so we can move forward and have a better
NetworkManager support later on the release.

rhbz: 2036060
x-downstream-only: yes

Commit 2:

net/sysconfig: do not use the highest autoconnect priority

Using the highest priority is a very big hammer that we may not want to use. We
may want users to override the cloud init generated ifcfg files for custom
configuration of interfaces. If cloud init uses the highest priority, nothing
can beat it. Hence lower the priority to 120 allowing values from 121 to 999
to be used by users if they want to use a custom interface nm keyfile.

X-downstream-only: true

Suggested-by: thaller@redhat.com
fixes: c589da20eb92231 ("Setting highest autoconnect priority for network-scripts")

Commit 3:

test fixes: update tests to reflect AUTOCONNECT_PRIORITY setting

X-downstream-only: true
fixes: 0a2c6b6118ff ("net/sysconfig: do not use the highest autoconnect priority")
fixes: c589da20eb92 ("Setting highest autoconnect priority for network-scripts")

Signed-off-by: Ani Sinha <anisinha@redhat.com>
---
 cloudinit/net/sysconfig.py                    |  1 +
 tests/unittests/cmd/devel/test_net_convert.py |  1 +
 tests/unittests/distros/test_netconfig.py     |  8 +++
 tests/unittests/test_net.py                   | 53 +++++++++++++++++++
 4 files changed, 63 insertions(+)

diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index f01c4236..d39f4fe3 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -318,6 +318,7 @@ class Renderer(renderer.Renderer):
             "ONBOOT": True,
             "USERCTL": False,
             "BOOTPROTO": "none",
+            "AUTOCONNECT_PRIORITY": 120,
         },
         "suse": {"BOOTPROTO": "static", "STARTMODE": "auto"},
     }
diff --git a/tests/unittests/cmd/devel/test_net_convert.py b/tests/unittests/cmd/devel/test_net_convert.py
index 7b9121b2..288e3e37 100644
--- a/tests/unittests/cmd/devel/test_net_convert.py
+++ b/tests/unittests/cmd/devel/test_net_convert.py
@@ -60,6 +60,7 @@ DHCP=ipv4
 SAMPLE_SYSCONFIG_CONTENT = """\
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=dhcp
 DEVICE=eth0
 ONBOOT=yes
diff --git a/tests/unittests/distros/test_netconfig.py b/tests/unittests/distros/test_netconfig.py
index 962ff7fb..4c624079 100644
--- a/tests/unittests/distros/test_netconfig.py
+++ b/tests/unittests/distros/test_netconfig.py
@@ -717,6 +717,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
         expected_cfgs = {
             self.ifcfg_path("eth0"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEFROUTE=yes
                 DEVICE=eth0
@@ -730,6 +731,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
             ),
             self.ifcfg_path("eth1"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEVICE=eth1
                 ONBOOT=yes
@@ -754,6 +756,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
         expected_cfgs = {
             self.ifcfg_path("eth0"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEFROUTE=yes
                 DEVICE=eth0
@@ -769,6 +772,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
             ),
             self.ifcfg_path("eth1"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEVICE=eth1
                 ONBOOT=yes
@@ -812,6 +816,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
         expected_cfgs = {
             self.ifcfg_path("eth0"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth0
                 HWADDR=00:16:3e:60:7c:df
@@ -824,6 +829,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
             ),
             self.ifcfg_path("infra0"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=infra0
                 IPADDR=10.0.1.2
@@ -859,6 +865,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
         expected_cfgs = {
             self.ifcfg_path("eth0"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth0
                 IPADDR=192.10.1.2
@@ -870,6 +877,7 @@ class TestNetCfgDistroRedhat(TestNetCfgDistroBase):
             ),
             self.ifcfg_path("eth0.1001"): dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth0.1001
                 IPADDR=10.0.1.2
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
index 052b0674..cef4fa2d 100644
--- a/tests/unittests/test_net.py
+++ b/tests/unittests/test_net.py
@@ -578,6 +578,7 @@ dns = none
                 """
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=none
 DEFROUTE=yes
 DEVICE=eth0
@@ -740,6 +741,7 @@ dns = none
                 """
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=none
 DEFROUTE=yes
 DEVICE=eth0
@@ -897,6 +899,7 @@ dns = none
                 """
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=none
 DEFROUTE=yes
 DEVICE=eth0
@@ -1137,6 +1140,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-eth1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth1
                 HWADDR=cf:d6:af:48:e8:80
@@ -1146,6 +1150,7 @@ NETWORK_CONFIGS = {
             ),
             "ifcfg-eth99": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEFROUTE=yes
                 DEVICE=eth99
@@ -1311,6 +1316,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-eth1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth1
                 HWADDR=cf:d6:af:48:e8:80
@@ -1320,6 +1326,7 @@ NETWORK_CONFIGS = {
             ),
             "ifcfg-eth99": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEFROUTE=yes
                 DEVICE=eth99
@@ -1566,6 +1573,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=iface0
                 IPADDR=192.168.14.2
@@ -1712,6 +1720,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=iface0
                 DHCPV6C=yes
@@ -1801,6 +1810,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=iface0
                 DHCPV6C=yes
@@ -1876,6 +1886,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=iface0
                 DHCPV6C=yes
@@ -1940,6 +1951,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=iface0
                 IPV6_AUTOCONF=yes
@@ -1995,6 +2007,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+            AUTOCONNECT_PRIORITY=120
             BOOTPROTO=none
             DEVICE=iface0
             IPV6ADDR=2001:1::1/64
@@ -2051,6 +2064,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+            AUTOCONNECT_PRIORITY=120
             BOOTPROTO=none
             DEVICE=iface0
             DHCPV6C=yes
@@ -2135,6 +2149,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+            AUTOCONNECT_PRIORITY=120
             BOOTPROTO=none
             DEVICE=iface0
             DHCPV6C=yes
@@ -2181,6 +2196,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEVICE=iface0
                 ONBOOT=yes
@@ -2256,6 +2272,7 @@ NETWORK_CONFIGS = {
         "expected_sysconfig_rhel": {
             "ifcfg-iface0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEVICE=iface0
                 ETHTOOL_OPTS="wol g"
@@ -2591,6 +2608,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
         "expected_sysconfig_rhel": {
             "ifcfg-bond0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BONDING_MASTER=yes
                 BONDING_OPTS="mode=active-backup """
                 """xmit_hash_policy=layer3+4 """
@@ -2608,6 +2626,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-bond0.200": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEVICE=bond0.200
                 DHCLIENT_SET_DEFAULT_ROUTE=no
@@ -2619,6 +2638,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             "ifcfg-br0": textwrap.dedent(
                 """\
                 AGEING=250
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEFROUTE=yes
                 DEVICE=br0
@@ -2638,6 +2658,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-eth0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth0
                 HWADDR=c0:d6:9f:2c:e8:80
@@ -2647,6 +2668,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-eth0.101": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEFROUTE=yes
                 DEVICE=eth0.101
@@ -2666,6 +2688,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-eth1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth1
                 HWADDR=aa:d6:9f:2c:e8:80
@@ -2677,6 +2700,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-eth2": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth2
                 HWADDR=c0:bb:9f:2c:e8:80
@@ -2688,6 +2712,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-eth3": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 BRIDGE=br0
                 DEVICE=eth3
@@ -2698,6 +2723,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-eth4": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 BRIDGE=br0
                 DEVICE=eth4
@@ -2708,6 +2734,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-eth5": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEVICE=eth5
                 DHCLIENT_SET_DEFAULT_ROUTE=no
@@ -2718,6 +2745,7 @@ pre-down route del -net 10.0.0.0/8 gw 11.0.0.1 metric 3 || true
             ),
             "ifcfg-ib0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=ib0
                 HWADDR=a0:00:02:20:fe:80:00:00:00:00:00:00:ec:0d:9a:03:00:15:e2:c1
@@ -3422,6 +3450,7 @@ iface bond0 inet6 static
         "expected_sysconfig_rhel": {
             "ifcfg-bond0": textwrap.dedent(
                 """\
+        AUTOCONNECT_PRIORITY=120
         BONDING_MASTER=yes
         BONDING_OPTS="mode=active-backup xmit_hash_policy=layer3+4 """
                 """miimon=100 num_grat_arp=5 """
@@ -3452,6 +3481,7 @@ iface bond0 inet6 static
             ),
             "ifcfg-bond0s0": textwrap.dedent(
                 """\
+        AUTOCONNECT_PRIORITY=120
         BOOTPROTO=none
         DEVICE=bond0s0
         HWADDR=aa:bb:cc:dd:e8:00
@@ -3479,6 +3509,7 @@ iface bond0 inet6 static
             ),
             "ifcfg-bond0s1": textwrap.dedent(
                 """\
+        AUTOCONNECT_PRIORITY=120
         BOOTPROTO=none
         DEVICE=bond0s1
         HWADDR=aa:bb:cc:dd:e8:01
@@ -3628,6 +3659,7 @@ iface bond0 inet6 static
         "expected_sysconfig_rhel": {
             "ifcfg-en0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=en0
                 HWADDR=aa:bb:cc:dd:e8:00
@@ -3637,6 +3669,7 @@ iface bond0 inet6 static
             ),
             "ifcfg-en0.99": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEFROUTE=yes
                 DEVICE=en0.99
@@ -3774,6 +3807,7 @@ iface bond0 inet6 static
         "expected_sysconfig_rhel": {
             "ifcfg-br0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=br0
                 IPADDR=192.168.2.2
@@ -3787,6 +3821,7 @@ iface bond0 inet6 static
             ),
             "ifcfg-eth0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 BRIDGE=br0
                 DEVICE=eth0
@@ -3802,6 +3837,7 @@ iface bond0 inet6 static
             ),
             "ifcfg-eth1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 BRIDGE=br0
                 DEVICE=eth1
@@ -3989,6 +4025,7 @@ iface bond0 inet6 static
         "expected_sysconfig_rhel": {
             "ifcfg-eth0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth0
                 HWADDR=52:54:00:12:34:00
@@ -4001,6 +4038,7 @@ iface bond0 inet6 static
             ),
             "ifcfg-eth1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth1
                 HWADDR=52:54:00:12:34:aa
@@ -4012,6 +4050,7 @@ iface bond0 inet6 static
             ),
             "ifcfg-eth2": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth2
                 HWADDR=52:54:00:12:34:ff
@@ -4096,6 +4135,7 @@ iface bond0 inet6 static
         "expected_sysconfig_rhel": {
             "ifcfg-eth0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eth0
                 HWADDR=cf:d6:af:48:e8:80
@@ -4693,6 +4733,7 @@ class TestRhelSysConfigRendering(CiTestCase):
             expected_content = """
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=dhcp
 DEVICE=eth1000
 HWADDR=07-1c-c6-75-a4-be
@@ -4900,6 +4941,7 @@ USERCTL=no
         expected = """\
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=none
 DEFROUTE=yes
 DEVICE=interface0
@@ -4929,6 +4971,7 @@ USERCTL=no
         expected_i1 = """\
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=none
 DEFROUTE=yes
 DEVICE=eth0
@@ -4945,6 +4988,7 @@ USERCTL=no
         expected_i2 = """\
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=dhcp
 DEVICE=eth1
 DHCLIENT_SET_DEFAULT_ROUTE=no
@@ -4972,6 +5016,7 @@ USERCTL=no
         expected = """\
 # Created by cloud-init automatically, do not edit.
 #
+AUTOCONNECT_PRIORITY=120
 BOOTPROTO=dhcp
 DEVICE=eth0
 ONBOOT=yes
@@ -5191,6 +5236,7 @@ USERCTL=no
             "expected_sysconfig": {
                 "ifcfg-ens3": textwrap.dedent(
                     """\
+                   AUTOCONNECT_PRIORITY=120
                    BOOTPROTO=none
                    DEFROUTE=yes
                    DEVICE=ens3
@@ -5235,6 +5281,7 @@ USERCTL=no
         expected = {
             "ifcfg-eno1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eno1
                 ONBOOT=yes
@@ -5244,6 +5291,7 @@ USERCTL=no
             ),
             "ifcfg-eno1.1000": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEVICE=eno1.1000
                 IPADDR=192.6.1.9
@@ -5276,6 +5324,7 @@ USERCTL=no
         expected = {
             "ifcfg-bond0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BONDING_MASTER=yes
                 BONDING_SLAVE0=enp0s0
                 BONDING_SLAVE1=enp0s1
@@ -5291,6 +5340,7 @@ USERCTL=no
             ),
             "ifcfg-enp0s0": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BONDING_MASTER=yes
                 BOOTPROTO=none
                 DEVICE=enp0s0
@@ -5303,6 +5353,7 @@ USERCTL=no
             ),
             "ifcfg-enp0s1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BONDING_MASTER=yes
                 BOOTPROTO=none
                 DEVICE=enp0s1
@@ -5333,6 +5384,7 @@ USERCTL=no
         expected = {
             "ifcfg-eno1": textwrap.dedent(
                 """\
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=dhcp
                 DEVICE=eno1
                 HWADDR=07-1c-c6-75-a4-be
@@ -5411,6 +5463,7 @@ USERCTL=no
                 """\
                 # Created by cloud-init automatically, do not edit.
                 #
+                AUTOCONNECT_PRIORITY=120
                 BOOTPROTO=none
                 DEFROUTE=yes
                 DEVICE=eth0