Bug report
A couple of years ago, we synced the downstream centos-stream customizations into our upstream service files. This included a networkmanager restart implemented in the service files, which is quite peculiar and shouldn't be required.
I don't have the downstream history of that code, but I suspect that this is was added because the ifupdown activator implementation of "bring up each interface" is not sufficient.
The high level concept of activators and renderers in cloud-init is as follows:
- renderer - if config is received before network service starts, just render the configuration to the filesystem and let the system network daemon bring up the system pre-configured whenever it starts
- activator - if config is received after network service starts, render the configuration and then "activate the network"
Both codepaths are necessary because sometimes the configuration is received before the network daemon is running - sometimes the configuration is received after the daemon is running.
The old activator concept for "activate the network" under ifupdown would literally just iterate over interfaces and bring them up. Today with the systemd and netplan renderers, we just run a command to restart or reload the appropriate service[1][2].
I think that the existence of the NetworkManager.service restart in cloud-final.service is evidence that cloud-init's network activation is broken - unfortunately without the history of the downstream patch, I'm unsure whether the restart was initially required when used with the ifconfig activator, or with the network-manager activator. Either way, I strongly suspect that what we want to happen with NetworkManager is something like a systemctl reload-or-try-restart NetworkManager.service rather than the manual ifconfig or nmcli commands per-interface like we currently do.
Bug report
A couple of years ago, we synced the downstream centos-stream customizations into our upstream service files. This included a networkmanager restart implemented in the service files, which is quite peculiar and shouldn't be required.
I don't have the downstream history of that code, but I suspect that this is was added because the ifupdown activator implementation of "bring up each interface" is not sufficient.
The high level concept of activators and renderers in cloud-init is as follows:
Both codepaths are necessary because sometimes the configuration is received before the network daemon is running - sometimes the configuration is received after the daemon is running.
The old activator concept for "activate the network" under ifupdown would literally just iterate over interfaces and bring them up. Today with the systemd and netplan renderers, we just run a command to restart or reload the appropriate service[1][2].
I think that the existence of the NetworkManager.service restart in
cloud-final.serviceis evidence that cloud-init's network activation is broken - unfortunately without the history of the downstream patch, I'm unsure whether the restart was initially required when used with the ifconfig activator, or with the network-manager activator. Either way, I strongly suspect that what we want to happen with NetworkManager is something like asystemctl reload-or-try-restart NetworkManager.servicerather than the manualifconfigornmclicommands per-interface like we currently do.