Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

app-emulation/wa-linux-agent: Use networkctl to propagate hostname #1978

Merged
merged 2 commits into from
May 3, 2024

Conversation

pothos
Copy link
Member

@pothos pothos commented May 3, 2024

The if-up-down to trigger the DHCP request causes problems. It's better
to directly ask systemd-networkd to issue the request. It seems that
one needs to use "reconfigure" instead of "forcerenew", so I went with
only that instead of somehow trying to see if "forcerenew" has an
effect.

How to use

For this comment #1950 (comment)

Testing done

Used flatcar-update -P … -E … to switch to the built image, and checked that waagent triggers the DHCP renewal:

May 03 14:06:56 newname systemd-hostnamed[2482]: Hostname set to <newname> (static)
May 03 14:06:56 newname systemd-resolved[1538]: System hostname changed to 'newname'.
May 03 14:06:56 newname sudo[2479]: pam_unix(sudo:session): session closed for user root
May 03 14:07:06 newname waagent[2401]: 2024-05-03T14:07:06.006518Z INFO EnvHandler ExtHandler EnvMonitor: Detected hostname change: hello2 -> newname
May 03 14:07:06 newname waagent[2401]: 2024-05-03T14:07:06.007770Z INFO EnvHandler ExtHandler Examine /proc/net/route for primary interface
May 03 14:07:06 newname waagent[2401]: 2024-05-03T14:07:06.007969Z INFO EnvHandler ExtHandler Primary interface is [eth0]
May 03 14:07:06 newname systemd-networkd[1736]: eth0: found matching network '/usr/lib/systemd/network/zz-default.network', based on potentially unpredictable interface name.
May 03 14:07:06 newname systemd-networkd[1736]: eth0: Configuring with /usr/lib/systemd/network/zz-default.network.
May 03 14:07:06 newname systemd-networkd[1736]: eth0: DHCP lease lost
May 03 14:07:06 newname systemd-networkd[1736]: eth0: DHCPv6 lease lost
May 03 14:07:06 newname systemd-networkd[1736]: eth0: DHCPv4 address 10.0.0.4/24, gateway 10.0.0.1 acquired from 168.63.129.16

There is no Link DOWN, Lost carrier anymore for eth0 and enP52305s1.

pothos added 2 commits May 3, 2024 20:37
This reverts commit 9556c7f
because waagent looks for internal hostname changes and wants to
propagate them to the Azure VM properties by issuing a new DHCP request.
The if-up-down to trigger the DHCP request causes problems. It's better
to directly ask systemd-networkd to issue the request. It seems that
one needs to use "reconfigure" instead of "forcerenew", so I went with
only that instead of somehow trying to see if "forcerenew" has an
effect.
@pothos pothos mentioned this pull request May 3, 2024
2 tasks
Copy link
Member

@jepio jepio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

love the approach

@pothos pothos merged commit f06ebd3 into main May 3, 2024
1 check failed
@pothos pothos deleted the kai/azure-hostname branch May 3, 2024 14:12
jepio added a commit that referenced this pull request Jun 21, 2024
app-emulation/wa-linux-agent: Use networkctl to propagate hostname

Signed-off-by: Jeremi Piotrowski <jpiotrowski@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants