diff options
author | Daniel Watkins <oddbloke@ubuntu.com> | 2021-03-08 12:50:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-08 12:50:57 -0500 |
commit | 121bc04cdf0e6732fe143b7419131dc250c13384 (patch) | |
tree | 42a7cb52cd830f698c961703a0f4109b3934452e /cloudinit/sources/helpers | |
parent | 106c57d511b862177c8356685cf6d49ddd6cb55f (diff) | |
download | vyos-cloud-init-121bc04cdf0e6732fe143b7419131dc250c13384.tar.gz vyos-cloud-init-121bc04cdf0e6732fe143b7419131dc250c13384.zip |
net: exclude OVS internal interfaces in get_interfaces (#829)
`get_interfaces` is used to in two ways, broadly: firstly, to determine
the available interfaces when converting cloud network configuration
formats to cloud-init's network configuration formats; and, secondly, to
ensure that any interfaces which are specified in network configuration
are (a) available, and (b) named correctly. The first of these is
unaffected by this commit, as no clouds support Open vSwitch
configuration in their network configuration formats.
For the second, we check that MAC addresses of physical devices are
unique. In some OVS configurations, there are OVS-created devices which
have duplicate MAC addresses, either with each other or with physical
devices. As these interfaces are created by OVS, we can be confident
that (a) they will be available when appropriate, and (b) that OVS will
name them correctly. As such, this commit excludes any OVS-internal
interfaces from the set of interfaces returned by `get_interfaces`.
LP: #1912844
Diffstat (limited to 'cloudinit/sources/helpers')
-rw-r--r-- | cloudinit/sources/helpers/tests/test_openstack.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cloudinit/sources/helpers/tests/test_openstack.py b/cloudinit/sources/helpers/tests/test_openstack.py index 2bde1e3f..95fb9743 100644 --- a/cloudinit/sources/helpers/tests/test_openstack.py +++ b/cloudinit/sources/helpers/tests/test_openstack.py @@ -1,10 +1,15 @@ # This file is part of cloud-init. See LICENSE file for license information. # ./cloudinit/sources/helpers/tests/test_openstack.py +from unittest import mock from cloudinit.sources.helpers import openstack from cloudinit.tests import helpers as test_helpers +@mock.patch( + "cloudinit.net.is_openvswitch_internal_interface", + mock.Mock(return_value=False) +) class TestConvertNetJson(test_helpers.CiTestCase): def test_phy_types(self): |