summaryrefslogtreecommitdiff
path: root/cloudinit/net/__init__.py
diff options
context:
space:
mode:
authorLukas Märdian <luk@slyon.de>2020-10-29 14:38:56 +0100
committerGitHub <noreply@github.com>2020-10-29 09:38:56 -0400
commit3c432b32de1bdce2699525201396a8bbc6a41f3e (patch)
treeafe8fcd51982887a85f98e2a318875e025b353a0 /cloudinit/net/__init__.py
parentf99d4f96b00a9cfec1c721d364cbfd728674e5dc (diff)
downloadvyos-cloud-init-3c432b32de1bdce2699525201396a8bbc6a41f3e.tar.gz
vyos-cloud-init-3c432b32de1bdce2699525201396a8bbc6a41f3e.zip
get_interfaces: don't exclude Open vSwitch bridge/bond members (#608)
If an OVS bridge was used as the only/primary interface, the 'init' stage failed with a "Not all expected physical devices present" error, leaving the system with a broken SSH setup. LP: #1898997
Diffstat (limited to 'cloudinit/net/__init__.py')
-rw-r--r--cloudinit/net/__init__.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index 75e79ca8..de65e7af 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -124,6 +124,15 @@ def master_is_bridge_or_bond(devname):
return (os.path.exists(bonding_path) or os.path.exists(bridge_path))
+def master_is_openvswitch(devname):
+ """Return a bool indicating if devname's master is openvswitch"""
+ master_path = get_master(devname)
+ if master_path is None:
+ return False
+ ovs_path = sys_dev_path(devname, path="upper_ovs-system")
+ return os.path.exists(ovs_path)
+
+
def is_netfailover(devname, driver=None):
""" netfailover driver uses 3 nics, master, primary and standby.
this returns True if the device is either the primary or standby
@@ -862,8 +871,10 @@ def get_interfaces(blacklist_drivers=None) -> list:
continue
if is_bond(name):
continue
- if get_master(name) is not None and not master_is_bridge_or_bond(name):
- continue
+ if get_master(name) is not None:
+ if (not master_is_bridge_or_bond(name) and
+ not master_is_openvswitch(name)):
+ continue
if is_netfailover(name):
continue
mac = get_interface_mac(name)