Merge ~ack/maas:drop-interface-autoconf-param into maas:master

Proposed by Alberto Donato
Status: Merged
Approved by: Alberto Donato
Approved revision: 370ee5bcd78286e7aa56f54ac4f78e2de5b8d4a4
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~ack/maas:drop-interface-autoconf-param
Merge into: maas:master
Prerequisite: ~ack/maas:interface-params-cleanups
Diff against target: 234 lines (+30/-34)
6 files modified
src/maasserver/api/interfaces.py (+0/-15)
src/maasserver/forms/interface.py (+0/-2)
src/maasserver/forms/tests/test_interface.py (+3/-14)
src/maasserver/migrations/maasserver/0304_interface_params_no_autoconf.py (+27/-0)
src/maasserver/models/tests/test_node.py (+0/-1)
src/maasserver/tests/test_preseed_network.py (+0/-2)
Reviewer Review Type Date Requested Status
Björn Tillenius Approve
MAAS Lander Approve
Alexsander de Souza Approve
Review via email: mp+442590@code.launchpad.net

Commit message

drop the "autoconf" parameter for interfaces, as it's not supported by cloud-init/netplan.

This also updates existing accept_ra parameters to accept-ra in the db.

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b drop-interface-autoconf-param lp:~ack/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 4b1828296cb00f9b6963cb285d68ec2d903cbe02

review: Approve
Revision history for this message
Alexsander de Souza (alexsander-souza) wrote :

+1

review: Approve
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b drop-interface-autoconf-param lp:~ack/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: 370ee5bcd78286e7aa56f54ac4f78e2de5b8d4a4

review: Approve
Revision history for this message
Björn Tillenius (bjornt) wrote :

I think this is OK. Looking closer at the history, the autoconf parameter was added before netplan existed and was most likely valid for ENI configuration. But up to this date, it seems like netplan doesn't have support for autoconf, so it hasn't have had any effect in many years.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/src/maasserver/api/interfaces.py b/src/maasserver/api/interfaces.py
index 7510242..c985c92 100644
--- a/src/maasserver/api/interfaces.py
+++ b/src/maasserver/api/interfaces.py
@@ -192,9 +192,6 @@ class InterfacesHandler(OperationsHandler):
192 @param (boolean) "accept_ra" [required=false] Accept router192 @param (boolean) "accept_ra" [required=false] Accept router
193 advertisements. (IPv6 only)193 advertisements. (IPv6 only)
194194
195 @param (boolean) "autoconf" [required=false] Perform stateless
196 autoconfiguration. (IPv6 only)
197
198 @success (http-status-code) "server-success" 200195 @success (http-status-code) "server-success" 200
199 @success (json) "success-json" A JSON object containing the new196 @success (json) "success-json" A JSON object containing the new
200 interface object.197 interface object.
@@ -325,9 +322,6 @@ class InterfacesHandler(OperationsHandler):
325 @param (boolean) "accept_ra" [required=false] Accept router322 @param (boolean) "accept_ra" [required=false] Accept router
326 advertisements. (IPv6 only)323 advertisements. (IPv6 only)
327324
328 @param (boolean) "autoconf" [required=false] Perform stateless
329 autoconfiguration. (IPv6 only)
330
331 @success (http-status-code) "server-success" 200325 @success (http-status-code) "server-success" 200
332 @success (json) "success-json" A JSON object containing the new326 @success (json) "success-json" A JSON object containing the new
333 bond interface object.327 bond interface object.
@@ -371,9 +365,6 @@ class InterfacesHandler(OperationsHandler):
371 @param (boolean) "accept_ra" [required=false] Accept router365 @param (boolean) "accept_ra" [required=false] Accept router
372 advertisements. (IPv6 only)366 advertisements. (IPv6 only)
373367
374 @param (boolean) "autoconf" [required=false] Perform stateless
375 autoconfiguration. (IPv6 only)
376
377 @success (http-status-code) "server-success" 200368 @success (http-status-code) "server-success" 200
378 @success (json) "success-json" A JSON object containing the new369 @success (json) "success-json" A JSON object containing the new
379 VLAN interface object.370 VLAN interface object.
@@ -439,9 +430,6 @@ class InterfacesHandler(OperationsHandler):
439 @param (boolean) "accept_ra" [required=false] Accept router430 @param (boolean) "accept_ra" [required=false] Accept router
440 advertisements. (IPv6 only)431 advertisements. (IPv6 only)
441432
442 @param (boolean) "autoconf" [required=false] Perform stateless
443 autoconfiguration. (IPv6 only)
444
445 @success (http-status-code) "server-success" 200433 @success (http-status-code) "server-success" 200
446 @success (json) "success-json" A JSON object containing the new434 @success (json) "success-json" A JSON object containing the new
447 bridge interface object.435 bridge interface object.
@@ -697,9 +685,6 @@ class InterfaceHandler(OperationsHandler):
697 @param (string) "accept_ra" [required=false] Accept router685 @param (string) "accept_ra" [required=false] Accept router
698 advertisements. (IPv6 only)686 advertisements. (IPv6 only)
699687
700 @param (string) "autoconf" [required=false] Perform stateless
701 autoconfiguration. (IPv6 only)
702
703 @param (boolean) "link_connected" [required=false]688 @param (boolean) "link_connected" [required=false]
704 (Physical interfaces) Whether or not the interface is physically689 (Physical interfaces) Whether or not the interface is physically
705 conntected to an uplink. (Default: True).690 conntected to an uplink. (Default: True).
diff --git a/src/maasserver/forms/interface.py b/src/maasserver/forms/interface.py
index 46b6229..58c1d0b 100644
--- a/src/maasserver/forms/interface.py
+++ b/src/maasserver/forms/interface.py
@@ -53,7 +53,6 @@ class InterfaceForm(MAASModelForm):
5353
54 # IPv6 parameters.54 # IPv6 parameters.
55 accept_ra = forms.NullBooleanField(required=False)55 accept_ra = forms.NullBooleanField(required=False)
56 autoconf = forms.NullBooleanField(required=False)
5756
58 # Device parameters57 # Device parameters
59 ip_assignment = forms.MultipleChoiceField(58 ip_assignment = forms.MultipleChoiceField(
@@ -224,7 +223,6 @@ class InterfaceForm(MAASModelForm):
224 interface.params = {}223 interface.params = {}
225 self._set_param(interface, "mtu")224 self._set_param(interface, "mtu")
226 self._set_param(interface, "accept_ra", netplan_key="accept-ra")225 self._set_param(interface, "accept_ra", netplan_key="accept-ra")
227 self._set_param(interface, "autoconf")
228226
229227
230class ControllerInterfaceForm(MAASModelForm):228class ControllerInterfaceForm(MAASModelForm):
diff --git a/src/maasserver/forms/tests/test_interface.py b/src/maasserver/forms/tests/test_interface.py
index 0ce7041..0abd7e1 100644
--- a/src/maasserver/forms/tests/test_interface.py
+++ b/src/maasserver/forms/tests/test_interface.py
@@ -533,7 +533,6 @@ class TestPhysicalInterfaceForm(MAASServerTestCase):
533 tags = [factory.make_name("tag") for _ in range(3)]533 tags = [factory.make_name("tag") for _ in range(3)]
534 mtu = random.randint(1000, 2000)534 mtu = random.randint(1000, 2000)
535 accept_ra = factory.pick_bool()535 accept_ra = factory.pick_bool()
536 autoconf = factory.pick_bool()
537 form = PhysicalInterfaceForm(536 form = PhysicalInterfaceForm(
538 node=node,537 node=node,
539 data={538 data={
@@ -543,13 +542,12 @@ class TestPhysicalInterfaceForm(MAASServerTestCase):
543 "tags": ",".join(tags),542 "tags": ",".join(tags),
544 "mtu": mtu,543 "mtu": mtu,
545 "accept_ra": accept_ra,544 "accept_ra": accept_ra,
546 "autoconf": autoconf,
547 },545 },
548 )546 )
549 self.assertTrue(form.is_valid(), dict(form.errors))547 self.assertTrue(form.is_valid(), dict(form.errors))
550 interface = form.save()548 interface = form.save()
551 self.assertEqual(549 self.assertEqual(
552 {"mtu": mtu, "accept-ra": accept_ra, "autoconf": autoconf},550 {"mtu": mtu, "accept-ra": accept_ra},
553 interface.params,551 interface.params,
554 )552 )
555553
@@ -559,11 +557,9 @@ class TestPhysicalInterfaceForm(MAASServerTestCase):
559 )557 )
560 mtu = random.randint(1000, 2000)558 mtu = random.randint(1000, 2000)
561 accept_ra = factory.pick_bool()559 accept_ra = factory.pick_bool()
562 autoconf = factory.pick_bool()
563 interface.params = {560 interface.params = {
564 "mtu": mtu,561 "mtu": mtu,
565 "accept-ra": accept_ra,562 "accept-ra": accept_ra,
566 "autoconf": autoconf,
567 }563 }
568 new_name = "eth1"564 new_name = "eth1"
569 new_vlan = factory.make_VLAN(vid=33)565 new_vlan = factory.make_VLAN(vid=33)
@@ -579,7 +575,7 @@ class TestPhysicalInterfaceForm(MAASServerTestCase):
579 self.assertTrue(form.is_valid(), dict(form.errors))575 self.assertTrue(form.is_valid(), dict(form.errors))
580 interface = form.save()576 interface = form.save()
581 self.assertEqual(577 self.assertEqual(
582 {"mtu": mtu, "accept-ra": accept_ra, "autoconf": autoconf},578 {"mtu": mtu, "accept-ra": accept_ra},
583 interface.params,579 interface.params,
584 )580 )
585581
@@ -589,21 +585,17 @@ class TestPhysicalInterfaceForm(MAASServerTestCase):
589 )585 )
590 mtu = random.randint(1000, 2000)586 mtu = random.randint(1000, 2000)
591 accept_ra = factory.pick_bool()587 accept_ra = factory.pick_bool()
592 autoconf = factory.pick_bool()
593 interface.params = {588 interface.params = {
594 "mtu": mtu,589 "mtu": mtu,
595 "accept-ra": accept_ra,590 "accept-ra": accept_ra,
596 "autoconf": autoconf,
597 }591 }
598 new_mtu = random.randint(1000, 2000)592 new_mtu = random.randint(1000, 2000)
599 new_accept_ra = not accept_ra593 new_accept_ra = not accept_ra
600 new_autoconf = not autoconf
601 form = PhysicalInterfaceForm(594 form = PhysicalInterfaceForm(
602 instance=interface,595 instance=interface,
603 data={596 data={
604 "mtu": new_mtu,597 "mtu": new_mtu,
605 "accept_ra": new_accept_ra,598 "accept_ra": new_accept_ra,
606 "autoconf": new_autoconf,
607 },599 },
608 )600 )
609 self.assertTrue(form.is_valid(), dict(form.errors))601 self.assertTrue(form.is_valid(), dict(form.errors))
@@ -612,7 +604,6 @@ class TestPhysicalInterfaceForm(MAASServerTestCase):
612 {604 {
613 "mtu": new_mtu,605 "mtu": new_mtu,
614 "accept-ra": new_accept_ra,606 "accept-ra": new_accept_ra,
615 "autoconf": new_autoconf,
616 },607 },
617 interface.params,608 interface.params,
618 )609 )
@@ -623,15 +614,13 @@ class TestPhysicalInterfaceForm(MAASServerTestCase):
623 )614 )
624 mtu = random.randint(1000, 2000)615 mtu = random.randint(1000, 2000)
625 accept_ra = factory.pick_bool()616 accept_ra = factory.pick_bool()
626 autoconf = factory.pick_bool()
627 interface.params = {617 interface.params = {
628 "mtu": mtu,618 "mtu": mtu,
629 "accept-ra": accept_ra,619 "accept-ra": accept_ra,
630 "autoconf": autoconf,
631 }620 }
632 form = PhysicalInterfaceForm(621 form = PhysicalInterfaceForm(
633 instance=interface,622 instance=interface,
634 data={"mtu": "", "accept_ra": "", "autoconf": ""},623 data={"mtu": "", "accept_ra": ""},
635 )624 )
636 self.assertTrue(form.is_valid(), dict(form.errors))625 self.assertTrue(form.is_valid(), dict(form.errors))
637 interface = form.save()626 interface = form.save()
diff --git a/src/maasserver/migrations/maasserver/0304_interface_params_no_autoconf.py b/src/maasserver/migrations/maasserver/0304_interface_params_no_autoconf.py
638new file mode 100644627new file mode 100644
index 0000000..c827cbc
--- /dev/null
+++ b/src/maasserver/migrations/maasserver/0304_interface_params_no_autoconf.py
@@ -0,0 +1,27 @@
1# Generated by Django 3.2.12 on 2023-05-10 08:08
2
3from django.db import migrations
4
5
6class Migration(migrations.Migration):
7 dependencies = [
8 ("maasserver", "0303_interface_params_cleanups"),
9 ]
10
11 operations = [
12 # drop 'autoconf' parameter
13 migrations.RunSQL(
14 "UPDATE maasserver_interface SET params = params - 'autoconf'"
15 ),
16 # convert 'accept_ra' to 'accept-ra'
17 migrations.RunSQL(
18 """
19 UPDATE maasserver_interface
20 SET params = (
21 params - 'accept_ra' ||
22 jsonb_build_object('accept-ra', (params->>'accept_ra')::bool)
23 )
24 WHERE params->>'accept_ra' IS NOT NULL
25 """
26 ),
27 ]
diff --git a/src/maasserver/models/tests/test_node.py b/src/maasserver/models/tests/test_node.py
index 4eb10d4..694844d 100644
--- a/src/maasserver/models/tests/test_node.py
+++ b/src/maasserver/models/tests/test_node.py
@@ -12575,7 +12575,6 @@ class TestNodeInterfaceClone_SimpleNetworkLayout(
12575 iface.params = {12575 iface.params = {
12576 "mtu": random.randint(600, 1400),12576 "mtu": random.randint(600, 1400),
12577 "accept_ra": factory.pick_bool(),12577 "accept_ra": factory.pick_bool(),
12578 "autoconf": factory.pick_bool(),
12579 }12578 }
12580 iface.save()12579 iface.save()
12581 extra_interface = node.current_config.interface_set.all()[1]12580 extra_interface = node.current_config.interface_set.all()[1]
diff --git a/src/maasserver/tests/test_preseed_network.py b/src/maasserver/tests/test_preseed_network.py
index 2737d7b..c8e3044 100644
--- a/src/maasserver/tests/test_preseed_network.py
+++ b/src/maasserver/tests/test_preseed_network.py
@@ -342,7 +342,6 @@ class TestSingleAddrFamilyLayout(MAASServerTestCase, AssertNetworkConfigMixin):
342 iface.params = {342 iface.params = {
343 "mtu": random.randint(600, 1400),343 "mtu": random.randint(600, 1400),
344 "accept_ra": factory.pick_bool(),344 "accept_ra": factory.pick_bool(),
345 "autoconf": factory.pick_bool(),
346 }345 }
347 iface.save()346 iface.save()
348 extra_interface = node.current_config.interface_set.all()[1]347 extra_interface = node.current_config.interface_set.all()[1]
@@ -380,7 +379,6 @@ class TestSimpleNetworkLayout(MAASServerTestCase, AssertNetworkConfigMixin):
380 iface.params = {379 iface.params = {
381 "mtu": random.randint(600, 1400),380 "mtu": random.randint(600, 1400),
382 "accept_ra": factory.pick_bool(),381 "accept_ra": factory.pick_bool(),
383 "autoconf": factory.pick_bool(),
384 }382 }
385 iface.save()383 iface.save()
386 extra_interface = node.current_config.interface_set.all()[1]384 extra_interface = node.current_config.interface_set.all()[1]

Subscribers

People subscribed via source and target branches