From a9eec9e3a7a53bd63d3bf9ced96e224fb752d9f7 Mon Sep 17 00:00:00 2001 From: Redouane Kachach Date: Mon, 11 Apr 2022 13:04:13 +0200 Subject: [PATCH] mgr/cephadm: skip loopback devices when gathering facts Fixes: https://tracker.ceph.com/issues/53528 Signed-off-by: Redouane Kachach --- src/cephadm/cephadm | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/cephadm/cephadm b/src/cephadm/cephadm index 004219bb6a3..8a4e6187f4c 100755 --- a/src/cephadm/cephadm +++ b/src/cephadm/cephadm @@ -7652,6 +7652,17 @@ class HostFacts(): continue for iface in os.listdir(nic_path): + if os.path.exists(os.path.join(nic_path, iface, 'bridge')): + nic_type = 'bridge' + elif os.path.exists(os.path.join(nic_path, iface, 'bonding')): + nic_type = 'bonding' + else: + logger.info(os.path.join(nic_path, iface, 'type')) + nic_type = hw_lookup.get(read_file([os.path.join(nic_path, iface, 'type')]), 'Unknown') + + if nic_type == 'loopback': # skip loopback devices + continue + lower_devs_list = [os.path.basename(link.replace('lower_', '')) for link in glob(os.path.join(nic_path, iface, 'lower_*'))] upper_devs_list = [os.path.basename(link.replace('upper_', '')) for link in glob(os.path.join(nic_path, iface, 'upper_*'))] @@ -7670,13 +7681,6 @@ class HostFacts(): # Either way, we show a -1 when speed isn't available speed = -1 - if os.path.exists(os.path.join(nic_path, iface, 'bridge')): - nic_type = 'bridge' - elif os.path.exists(os.path.join(nic_path, iface, 'bonding')): - nic_type = 'bonding' - else: - nic_type = hw_lookup.get(read_file([os.path.join(nic_path, iface, 'type')]), 'Unknown') - dev_link = os.path.join(nic_path, iface, 'device') if os.path.exists(dev_link): iftype = 'physical' -- 2.39.5