summaryrefslogtreecommitdiff
path: root/cloudinit/sources
diff options
context:
space:
mode:
authorAnh Vo <anhvo@microsoft.com>2020-10-13 15:42:54 -0400
committerGitHub <noreply@github.com>2020-10-13 15:42:54 -0400
commit8ec8c3fc63a59b85888a0b52356b784314a1d4cc (patch)
tree51006af28392ee2f1cad61e2887e1d6851d8f8d5 /cloudinit/sources
parent5bf287f430b97860bf746e61b83ff53b834592d0 (diff)
downloadvyos-cloud-init-8ec8c3fc63a59b85888a0b52356b784314a1d4cc.tar.gz
vyos-cloud-init-8ec8c3fc63a59b85888a0b52356b784314a1d4cc.zip
net: add the ability to blacklist network interfaces based on driver during enumeration of physical network devices (#591)
Diffstat (limited to 'cloudinit/sources')
-rwxr-xr-xcloudinit/sources/DataSourceAzure.py36
1 files changed, 23 insertions, 13 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 773c60d7..fc32f8b1 100755
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -83,6 +83,25 @@ UBUNTU_EXTENDED_NETWORK_SCRIPTS = [
'/run/network/interfaces.ephemeral.d',
]
+# This list is used to blacklist devices that will be considered
+# for renaming or fallback interfaces.
+#
+# On Azure network devices using these drivers are automatically
+# configured by the platform and should not be configured by
+# cloud-init's network configuration.
+#
+# Note:
+# Azure Dv4 and Ev4 series VMs always have mlx5 hardware.
+# https://docs.microsoft.com/en-us/azure/virtual-machines/dv4-dsv4-series
+# https://docs.microsoft.com/en-us/azure/virtual-machines/ev4-esv4-series
+# Earlier D and E series VMs (such as Dv2, Dv3, and Ev3 series VMs)
+# can have either mlx4 or mlx5 hardware, with the older series VMs
+# having a higher chance of coming with mlx4 hardware.
+# https://docs.microsoft.com/en-us/azure/virtual-machines/dv2-dsv2-series
+# https://docs.microsoft.com/en-us/azure/virtual-machines/dv3-dsv3-series
+# https://docs.microsoft.com/en-us/azure/virtual-machines/ev3-esv3-series
+BLACKLIST_DRIVERS = ['mlx4_core', 'mlx5_core']
+
def find_storvscid_from_sysctl_pnpinfo(sysctl_out, deviceid):
# extract the 'X' from dev.storvsc.X. if deviceid matches
@@ -529,6 +548,8 @@ class DataSourceAzure(sources.DataSource):
except Exception as e:
LOG.warning("Failed to get system information: %s", e)
+ self.distro.networking.blacklist_drivers = BLACKLIST_DRIVERS
+
try:
crawled_data = util.log_time(
logfunc=LOG.debug, msg='Crawl of metadata service',
@@ -1468,23 +1489,12 @@ def _generate_network_config_from_imds_metadata(imds_metadata) -> dict:
@azure_ds_telemetry_reporter
def _generate_network_config_from_fallback_config() -> dict:
- """Generate fallback network config excluding mlx4_core & mlx5_core devices.
+ """Generate fallback network config excluding blacklisted devices.
@return: Dictionary containing network version 2 standard configuration.
"""
- # Azure Dv4 and Ev4 series VMs always have mlx5 hardware.
- # https://docs.microsoft.com/en-us/azure/virtual-machines/dv4-dsv4-series
- # https://docs.microsoft.com/en-us/azure/virtual-machines/ev4-esv4-series
- # Earlier D and E series VMs (such as Dv2, Dv3, and Ev3 series VMs)
- # can have either mlx4 or mlx5 hardware, with the older series VMs
- # having a higher chance of coming with mlx4 hardware.
- # https://docs.microsoft.com/en-us/azure/virtual-machines/dv2-dsv2-series
- # https://docs.microsoft.com/en-us/azure/virtual-machines/dv3-dsv3-series
- # https://docs.microsoft.com/en-us/azure/virtual-machines/ev3-esv3-series
- blacklist = ['mlx4_core', 'mlx5_core']
- # generate a network config, blacklist picking mlx4_core and mlx5_core devs
return net.generate_fallback_config(
- blacklist_drivers=blacklist, config_driver=True)
+ blacklist_drivers=BLACKLIST_DRIVERS, config_driver=True)
@azure_ds_telemetry_reporter