← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~jgrimm/cloud-init:vif-type-null into cloud-init:master


Jon Grimm has proposed merging ~jgrimm/cloud-init:vif-type-null into cloud-init:master.

Requested reviews:
  cloud init development team (cloud-init-dev)

For more details, see:

Allow vif type of null in network_data.json processing.

The current checking is apparently too stict, treat 'null' as
valid physical type. Update unit testcase.

LP: #1621968

Your team cloud init development team is requested to review the proposed merge of ~jgrimm/cloud-init:vif-type-null into cloud-init:master.
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
index a5a2a1d..8d8a852 100644
--- a/cloudinit/sources/helpers/openstack.py
+++ b/cloudinit/sources/helpers/openstack.py
@@ -582,7 +582,8 @@ def convert_net_json(network_json=None, known_macs=None):
                 subnet['ipv6'] = True
         cfg.update({'subnets': subnets})
-        if link['type'] in ['ethernet', 'vif', 'ovs', 'phy', 'bridge', 'tap']:
+        if link['type'] in [None, 'ethernet', 'vif', 'ovs', 'phy',
+                            'bridge', 'tap']:
                 'type': 'physical',
                 'mac_address': link['ethernet_mac_address']})
diff --git a/tests/unittests/test_datasource/test_configdrive.py b/tests/unittests/test_datasource/test_configdrive.py
index 98ff97a..3d9d83f 100644
--- a/tests/unittests/test_datasource/test_configdrive.py
+++ b/tests/unittests/test_datasource/test_configdrive.py
@@ -101,7 +101,7 @@ NETWORK_DATA_2 = {
          "type": "vif", "id": "eth1", "vif_id": "vif-foo2"}]
-# This network data ha 'tap' type for a link.
+# This network data ha 'tap' or null type for a link.
     "services": [{"type": "dns", "address": ""},
                  {"type": "dns", "address": ""}],
@@ -132,7 +132,7 @@ NETWORK_DATA_3 = {
          "type": "tap", "id": "tap77a0dc5b-72",
          "vif_id": "77a0dc5b-720e-41b7-bfa7-1b2ff62e0d48"},
         {"ethernet_mac_address": "fa:16:3e:a8:14:69", "mtu": None,
-         "type": "tap", "id": "tap7d6b7bec-93",
+         "type": None, "id": "tap7d6b7bec-93",
          "vif_id": "7d6b7bec-93e6-4c03-869a-ddc5014892d5"}