代码拉取完成,页面将自动刷新
同步操作将从 src-openEuler/cloud-init 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
From 42930d8459b59b22cab3f76d85d170871174b479 Mon Sep 17 00:00:00 2001
From: Alberto Contreras <alberto.contreras@canonical.com>
Date: Wed, 29 May 2024 09:10:53 +0200
Subject: [PATCH] fix(azure): disable use-dns for secondary nics (#5314)
DNS resolution through secondary NICs is not supported on Azure. Disable
it.
Without this, we see seconds of delay resolving urls in cloud-init logs
from Jammy+, see SF ticket.
Per cjp256's comment, the first NIC under metadata.imds.network is
ensured
to be the primary one. We use this to determine primary NICs instead of
relying on fragile driver and/or NIC names.
Fixes: SF: #00380708
Co-authored-by: Calvin Mwadime <calvin.mwadime@canonical.com>
---
cloudinit/sources/DataSourceAzure.py | 3 +++
tests/unittests/sources/test_azure.py | 20 +++++++++++++-------
2 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/cloudinit/sources/DataSourceAzure.py b/cloudinit/sources/DataSourceAzure.py
index 11c14e2..e384b32 100644
--- a/cloudinit/sources/DataSourceAzure.py
+++ b/cloudinit/sources/DataSourceAzure.py
@@ -1965,6 +1965,9 @@ def generate_network_config_from_instance_network_metadata(
# addresses.
nicname = "eth{idx}".format(idx=idx)
dhcp_override = {"route-metric": (idx + 1) * 100}
+ # DNS resolution through secondary NICs is not supported, disable it.
+ if idx > 0:
+ dhcp_override["use-dns"] = False
dev_config: Dict[str, Any] = {
"dhcp4": True,
"dhcp4-overrides": dhcp_override,
diff --git a/tests/unittests/sources/test_azure.py b/tests/unittests/sources/test_azure.py
index 2a477f8..3a36418 100644
--- a/tests/unittests/sources/test_azure.py
+++ b/tests/unittests/sources/test_azure.py
@@ -718,14 +718,20 @@ class TestGenerateNetworkConfig:
"match": {"macaddress": "00:0d:3a:04:75:98"},
"dhcp6": False,
"dhcp4": True,
- "dhcp4-overrides": {"route-metric": 200},
+ "dhcp4-overrides": {
+ "route-metric": 200,
+ "use-dns": False,
+ },
},
"eth2": {
"set-name": "eth2",
"match": {"macaddress": "00:0d:3a:04:75:98"},
"dhcp6": False,
"dhcp4": True,
- "dhcp4-overrides": {"route-metric": 300},
+ "dhcp4-overrides": {
+ "route-metric": 300,
+ "use-dns": False,
+ },
},
},
"version": 2,
@@ -952,7 +958,7 @@ class TestNetworkConfig:
"dhcp6": False,
"match": {"macaddress": "00:0d:3a:04:75:98"},
"set-name": "eth0",
- }
+ },
},
"version": 2,
}
@@ -1534,7 +1540,7 @@ scbus-1 on xpt0 bus 0
"dhcp6": False,
"dhcp4": True,
"dhcp4-overrides": {"route-metric": 100},
- }
+ },
},
"version": 2,
}
@@ -1563,14 +1569,14 @@ scbus-1 on xpt0 bus 0
"match": {"macaddress": "22:0d:3a:04:75:98"},
"dhcp6": False,
"dhcp4": True,
- "dhcp4-overrides": {"route-metric": 200},
+ "dhcp4-overrides": {"route-metric": 200, "use-dns": False},
},
"eth2": {
"set-name": "eth2",
"match": {"macaddress": "33:0d:3a:04:75:98"},
"dhcp6": False,
"dhcp4": True,
- "dhcp4-overrides": {"route-metric": 300},
+ "dhcp4-overrides": {"route-metric": 300, "use-dns": False},
},
},
"version": 2,
@@ -1603,7 +1609,7 @@ scbus-1 on xpt0 bus 0
"dhcp6": False,
"dhcp4": True,
"dhcp4-overrides": {"route-metric": 100},
- }
+ },
},
"version": 2,
}
--
2.27.0
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。