app-emulation/wa-linux-agent: Disable interface restarting

Flatcar prepares /etc/hostname from the initrd through afterburn. After
switching root, systemd-networkd fetches a dhcp lease with the correct
hostname already. This publishes the hostname to the vnet DNS server as
well. When WALinuxAgent starts, it tries to do the same steps: configure
the hostname, bounce the link to force dhcp lease renewal. This has
caused issues in the past with multi-nic configurations but also with
networked services that are trying to use the network (etcd/flanneld).

The link bouncing by WALinuxAgent is not necessary because of Flatcars
boot design, so return without bouncing the link. Tested that DNS from
other VMs in the same vnet works.

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
This commit is contained in:
Jeremi Piotrowski 2024-04-18 15:28:50 +00:00
parent b36fc18724
commit 39f2139d7a

View File

@ -172,7 +172,7 @@ new file mode 100644
index 00000000..e31b2923
--- /dev/null
+++ b/azurelinuxagent/common/osutil/flatcar.py
@@ -0,0 +1,78 @@
@@ -0,0 +1,80 @@
+#
+# Copyright 2023 Microsoft Corporation
+#
@ -240,6 +240,8 @@ index 00000000..e31b2923
+ Restart an interface by bouncing the link. systemd-networkd observes
+ this event, and forces a renew of DHCP.
+ """
+ logger.info("not restarting interface {}".format(ifname))
+ return
+ retry_limit = retries + 1
+ for attempt in range(1, retry_limit):
+ return_code = shellutil.run("ip link set {0} down && ip link set {0} up".format(ifname))