diff options
author | James Falcon <TheRealFalcon@users.noreply.github.com> | 2020-08-24 22:48:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-24 21:48:21 -0600 |
commit | 4068137e3ef048d3e2da56a8190f682eb19d501e (patch) | |
tree | f1b49ebace709680338a173c2c258c6ff69b9f84 /cloudinit/sources | |
parent | c0450c02b25fe037c702e9bb145fbbaa28a165b1 (diff) | |
download | vyos-cloud-init-4068137e3ef048d3e2da56a8190f682eb19d501e.tar.gz vyos-cloud-init-4068137e3ef048d3e2da56a8190f682eb19d501e.zip |
Azure: Add netplan driver filter when using hv_netvsc driver (#539)
This fixes a long delay during boot of some instances. For Azure instance types using SR-IOV via the Hyper-V netvsc network driver, two network interfaces are created that share the same MAC, but only the virtual device should be configured and used. Updating the netplan configuration to filter on the hv_netvsc driver prevents netplan from trying to figure both devices.
LP: #1830740
Diffstat (limited to 'cloudinit/sources')
-rwxr-xr-x | cloudinit/sources/DataSourceAzure.py | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py index f572a4ef..86cc7c28 100755 --- a/cloudinit/sources/DataSourceAzure.py +++ b/cloudinit/sources/DataSourceAzure.py @@ -18,6 +18,7 @@ import xml.etree.ElementTree as ET from cloudinit import log as logging from cloudinit import net from cloudinit.event import EventType +from cloudinit.net import device_driver from cloudinit.net.dhcp import EphemeralDHCPv4 from cloudinit import sources from cloudinit.sources.helpers import netlink @@ -1387,9 +1388,16 @@ def parse_network_config(imds_metadata): ip=privateIp, prefix=netPrefix)) if dev_config: mac = ':'.join(re.findall(r'..', intf['macAddress'])) - dev_config.update( - {'match': {'macaddress': mac.lower()}, - 'set-name': nicname}) + dev_config.update({ + 'match': {'macaddress': mac.lower()}, + 'set-name': nicname + }) + # With netvsc, we can get two interfaces that + # share the same MAC, so we need to make sure + # our match condition also contains the driver + driver = device_driver(nicname) + if driver and driver == 'hv_netvsc': + dev_config['match']['driver'] = driver netconfig['ethernets'][nicname] = dev_config evt.description = "network config from imds" else: |