From 3c432b32de1bdce2699525201396a8bbc6a41f3e Mon Sep 17 00:00:00 2001 From: Lukas Märdian Date: Thu, 29 Oct 2020 14:38:56 +0100 Subject: 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 --- cloudinit/net/__init__.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'cloudinit/net/__init__.py') 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) -- cgit v1.2.3