← Back to team overview

curtin-dev team mailing list archive

[Merge] ~raharper/curtin:fix/netplan-ovs-package-install into curtin:master

 

Ryan Harper has proposed merging ~raharper/curtin:fix/netplan-ovs-package-install into curtin:master.

Commit message:
netplan openvswitch yaml changed

netplan's openvswitch yaml format has changed and now openvswitch
is not a top-level type but a subkey under various top-level keys.
This change will allow for top-level or subkey matching and retains
the check on renderer type (whether netplan supports that for
openvswitch or not; it's used for NetworkManager, networkd).

LP: #1891608

Requested reviews:
  curtin developers (curtin-dev)
Related bugs:
  Bug #1891608 in curtin: "openvswitch-switch isn't installed if netplan schema defines an ovs bridge"
  https://bugs.launchpad.net/curtin/+bug/1891608

For more details, see:
https://code.launchpad.net/~raharper/curtin/+git/curtin/+merge/389346
-- 
Your team curtin developers is requested to review the proposed merge of ~raharper/curtin:fix/netplan-ovs-package-install into curtin:master.
diff --git a/curtin/net/deps.py b/curtin/net/deps.py
index f912d1d..b78654d 100644
--- a/curtin/net/deps.py
+++ b/curtin/net/deps.py
@@ -34,10 +34,13 @@ def network_config_required_packages(network_config, mapping=None):
             if cfgtype == 'version':
                 continue
             dev_configs.add(cfgtype)
-            # the renderer type may trigger package adds
+            # subkeys under the type may trigger package adds
             for entry, entry_cfg in cfg.items():
                 if entry_cfg.get('renderer'):
                     dev_configs.add(entry_cfg.get('renderer'))
+                else:
+                    for sub_entry, sub_cfg in entry_cfg.items():
+                        dev_configs.add(sub_entry)
 
     needed_packages = []
     for dev_type in dev_configs:
diff --git a/examples/tests/network_v2_ovs.yaml b/examples/tests/network_v2_ovs.yaml
index 6d1dc3d..0d063ce 100644
--- a/examples/tests/network_v2_ovs.yaml
+++ b/examples/tests/network_v2_ovs.yaml
@@ -8,35 +8,6 @@ network:
             match:
                 macaddress: '52:54:00:12:34:00'
             set-name: eth0
-        eth1:
-            match:
-                macaddress: '52:54:00:12:34:02'
-            set-name: eth1
-        eth2:
-            match:
-                macaddress: '52:54:00:12:34:04'
-            set-name: eth2
-    openvswitch:
-      bridges:
-        br-int:
-          fail-mode: secure
-          datapath_type: system
-          stp: false
-          rstp: false
-          mcast-snooping: false
-          controller:
-            addresses:
-              - tcp:127.0.0.1:6653
-          protocols:
-            - OpenFlow10
-            - OpenFlow12
-            - OpenFlow13
-          ports:
-            patch-tun:
-              type: patch
-              options:
-                peer: patch-int
-            eth1:
-              tag: 2
-            eth2:
-              tag: 2
+    bridges:
+      br-empty:
+        openvswitch: {}
diff --git a/tests/unittests/test_curthooks.py b/tests/unittests/test_curthooks.py
index 2349456..e45362c 100644
--- a/tests/unittests/test_curthooks.py
+++ b/tests/unittests/test_curthooks.py
@@ -1110,9 +1110,8 @@ class TestDetectRequiredPackages(CiTestCase):
                         {'type': 'static', 'address': '2001:1::1/64'}]}},
             2: {
                 'openvswitch': {
-                    'openvswitch': {
-                        'bridges': {
-                            'br-int': {'ports': {'eth15': {'tag': 2}}}}}},
+                    'bridges': {
+                        'br-int': {'openvswitch': {}}}},
                 'vlans': {
                     'vlans': {
                         'en-intra': {'id': 1, 'link': 'eno1', 'dhcp4': 'yes'},
@@ -1245,7 +1244,7 @@ class TestDetectRequiredPackages(CiTestCase):
             ({'network': {
                 'version': 2,
                 'items': ('openvswitch',)}},
-             ('openvswitch-switch', )),
+             ('bridge-utils', 'openvswitch-switch', )),
         ))
 
     def test_network_v2_detect_renderers(self):

Follow ups