summaryrefslogtreecommitdiff
path: root/cloudinit/net
diff options
context:
space:
mode:
authorJames Falcon <james.falcon@canonical.com>2023-02-02 10:13:08 -0600
committerGitHub <noreply@github.com>2023-02-02 09:13:08 -0700
commit4610833d1e9a0839321f84bbc3c8d27ff19a17f2 (patch)
treee9072206c14c6034d6a03d370d98c211368a8a48 /cloudinit/net
parent80931b531aa992b5bde355f26321c2b402c68c6f (diff)
downloadcloud-init-git-4610833d1e9a0839321f84bbc3c8d27ff19a17f2.tar.gz
Ignore duplicate macs from mscc_felix and fsl_enetc
mscc_felix and fsl_enetc are drivers representing a switch that is expected to have duplicate macs. If we encounter either of these drivers, we should not raise the duplicate mac exception. LP: #1997922
Diffstat (limited to 'cloudinit/net')
-rw-r--r--cloudinit/net/__init__.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/cloudinit/net/__init__.py b/cloudinit/net/__init__.py
index 0a41a2d4..50e445ec 100644
--- a/cloudinit/net/__init__.py
+++ b/cloudinit/net/__init__.py
@@ -1034,6 +1034,22 @@ def get_interfaces_by_mac_on_linux(blacklist_drivers=None) -> dict:
% (ret[mac], driver_map[mac], name)
)
+ # This is intended to be a short-term fix of LP: #1997922
+ # Long term, we should better handle configuration of virtual
+ # devices where duplicate MACs are expected early in boot if
+ # cloud-init happens to enumerate network interfaces before drivers
+ # have fully initialized the leader/subordinate relationships for
+ # those devices or switches.
+ if driver == "mscc_felix" or driver == "fsl_enetc":
+ LOG.debug(
+ "Ignoring duplicate macs from '%s' and '%s' due to "
+ "driver '%s'.",
+ name,
+ ret[mac],
+ driver,
+ )
+ continue
+
if raise_duplicate_mac_error:
raise RuntimeError(msg)