Merge ~bjornt/maas:revert-bug-2043970-3.3 into maas:3.3

Proposed by Björn Tillenius
Status: Merged
Approved by: Björn Tillenius
Approved revision: a1392cb2f2c2f9f62126cfb8a15a06c3b919307c
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~bjornt/maas:revert-bug-2043970-3.3
Merge into: maas:3.3
Diff against target: 126 lines (+2/-60)
4 files modified
src/maasserver/forms/settings.py (+0/-14)
src/maasserver/models/config.py (+0/-1)
src/metadataserver/builtin_scripts/network.py (+2/-15)
src/metadataserver/builtin_scripts/tests/test_network.py (+0/-30)
Reviewer Review Type Date Requested Status
Björn Tillenius Approve
Review via email: mp+465491@code.launchpad.net

Commit message

Revert "fix(metadataserver): leave discovered interfaces disconnected"

This reverts commit 41fb68392a2d22da358ed337633c166f70bfbcb0.

To post a comment you must log in.
Revision history for this message
Björn Tillenius (bjornt) wrote :

Self-approve reversal of backport.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/forms/settings.py b/src/maasserver/forms/settings.py
2index 41c33ea..ea3598e 100644
3--- a/src/maasserver/forms/settings.py
4+++ b/src/maasserver/forms/settings.py
5@@ -1054,20 +1054,6 @@ CONFIG_ITEMS = {
6 "max_value": 90,
7 },
8 },
9- "auto_vlan_creation": {
10- "default": True,
11- "form": forms.BooleanField,
12- "form_kwargs": {
13- "label": "Automatically create VLANs and Fabrics for interfaces",
14- "required": False,
15- "help_text": (
16- "Enables the creation of a default VLAN and Fabric for "
17- "discovered network interfaces when MAAS cannot connect it "
18- "to an existing one. When disabled, the interface is left "
19- "disconnected in these cases."
20- ),
21- },
22- },
23 }
24
25
26diff --git a/src/maasserver/models/config.py b/src/maasserver/models/config.py
27index bd9d5a6..55dc312 100644
28--- a/src/maasserver/models/config.py
29+++ b/src/maasserver/models/config.py
30@@ -146,7 +146,6 @@ def get_default_config():
31 "vault_enabled": False,
32 # Windows settings
33 "windows_kms_host": None,
34- "auto_vlan_creation": True,
35 }
36
37
38diff --git a/src/metadataserver/builtin_scripts/network.py b/src/metadataserver/builtin_scripts/network.py
39index ee222cf..b21b36a 100644
40--- a/src/metadataserver/builtin_scripts/network.py
41+++ b/src/metadataserver/builtin_scripts/network.py
42@@ -1,7 +1,7 @@
43 from django.db.models.expressions import RawSQL
44 from netaddr import IPAddress, IPNetwork
45
46-from maasserver.enum import INTERFACE_TYPE, IPADDRESS_TYPE, NODE_STATUS
47+from maasserver.enum import INTERFACE_TYPE, IPADDRESS_TYPE
48 from maasserver.models.config import Config
49 from maasserver.models.fabric import Fabric
50 from maasserver.models.interface import (
51@@ -506,26 +506,13 @@ def update_parent_vlans(node, interface, parent_nics, update_ip_addresses):
52 parent_nic.save()
53
54
55-def auto_vlan_creation(node) -> bool:
56- if node.is_controller:
57- # Always create controller's vlans
58- return True
59-
60- if node.status == NODE_STATUS.DEPLOYED:
61- # don't create empty vlan/fabric for interfaces discovered by HW sync,
62- # they cannot be used.
63- return False
64-
65- return Config.objects.get_config("auto_vlan_creation", True)
66-
67-
68 def guess_vlan_for_interface(node, links):
69 # Make sure that the VLAN on the interface is correct. When
70 # links exists on this interface we place it into the correct
71 # VLAN. If it cannot be determined and its a new interface it
72 # gets placed on its own fabric.
73 new_vlan = get_interface_vlan_from_links(node, links)
74- if new_vlan is None and auto_vlan_creation(node):
75+ if new_vlan is None:
76 # If the default VLAN on the default fabric has no interfaces
77 # associated with it, the first interface will be placed there
78 # (rather than creating a new fabric).
79diff --git a/src/metadataserver/builtin_scripts/tests/test_network.py b/src/metadataserver/builtin_scripts/tests/test_network.py
80index a9ef0f0..832e918 100644
81--- a/src/metadataserver/builtin_scripts/tests/test_network.py
82+++ b/src/metadataserver/builtin_scripts/tests/test_network.py
83@@ -10,7 +10,6 @@ from maasserver.enum import (
84 NODE_TYPE,
85 )
86 from maasserver.models import Event, EventType
87-from maasserver.models.config import Config
88 from maasserver.models.fabric import Fabric
89 from maasserver.models.interface import (
90 BondInterface,
91@@ -87,35 +86,6 @@ class TestUpdateInterfaces(MAASServerTestCase, UpdateInterfacesMixin):
92 eth0 = node.current_config.interface_set.get(name="eth0")
93 self.assertEqual(eth0.numa_node, node.default_numanode)
94
95- def test_dont_create_default_vlan_for_deployed_machines(self):
96- node = factory.make_Machine(status=NODE_STATUS.DEPLOYED)
97- data = FakeCommissioningData()
98- data_eth0 = data.create_physical_network(
99- "eth0",
100- mac_address="11:11:11:11:11:11",
101- )
102- data_eth0.state = "up"
103- self.update_interfaces(node, data)
104- eth0 = PhysicalInterface.objects.get(
105- name="eth0", node_config=node.current_config
106- )
107- self.assertIsNone(eth0.vlan)
108-
109- def test_dont_create_default_vlan_if_disabled(self):
110- Config.objects.set_config(name="auto_vlan_creation", value=False)
111- node = factory.make_Machine(status=NODE_STATUS.NEW)
112- data = FakeCommissioningData()
113- data_eth0 = data.create_physical_network(
114- "eth0",
115- mac_address="11:11:11:11:11:11",
116- )
117- data_eth0.state = "up"
118- self.update_interfaces(node, data)
119- eth0 = PhysicalInterface.objects.get(
120- name="eth0", node_config=node.current_config
121- )
122- self.assertIsNone(eth0.vlan)
123-
124 def test_all_new_physical_interfaces_no_links(self):
125 controller = self.create_empty_controller()
126 data = FakeCommissioningData()

Subscribers

People subscribed via source and target branches