summaryrefslogtreecommitdiff
path: root/tests/unittests/test_datasource
diff options
context:
space:
mode:
authorJames Falcon <TheRealFalcon@users.noreply.github.com>2020-08-24 22:48:21 -0500
committerGitHub <noreply@github.com>2020-08-24 21:48:21 -0600
commit4068137e3ef048d3e2da56a8190f682eb19d501e (patch)
treef1b49ebace709680338a173c2c258c6ff69b9f84 /tests/unittests/test_datasource
parentc0450c02b25fe037c702e9bb145fbbaa28a165b1 (diff)
downloadvyos-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 'tests/unittests/test_datasource')
-rw-r--r--tests/unittests/test_datasource/test_azure.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/unittests/test_datasource/test_azure.py b/tests/unittests/test_datasource/test_azure.py
index 96bcc7a2..47e03bd1 100644
--- a/tests/unittests/test_datasource/test_azure.py
+++ b/tests/unittests/test_datasource/test_azure.py
@@ -278,6 +278,23 @@ class TestParseNetworkConfig(CiTestCase):
}
self.assertEqual(expected, dsaz.parse_network_config(imds_data))
+ @mock.patch('cloudinit.sources.DataSourceAzure.device_driver',
+ return_value='hv_netvsc')
+ def test_match_driver_for_netvsc(self, m_driver):
+ """parse_network_config emits driver when using netvsc."""
+ expected = {'ethernets': {
+ 'eth0': {
+ 'dhcp4': True,
+ 'dhcp4-overrides': {'route-metric': 100},
+ 'dhcp6': False,
+ 'match': {
+ 'macaddress': '00:0d:3a:04:75:98',
+ 'driver': 'hv_netvsc',
+ },
+ 'set-name': 'eth0'
+ }}, 'version': 2}
+ self.assertEqual(expected, dsaz.parse_network_config(NETWORK_METADATA))
+
class TestGetMetadataFromIMDS(HttprettyTestCase):