-
Notifications
You must be signed in to change notification settings - Fork 881
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
net: allow for NetworkManager configuration for NetworkManager net renderer #4450
Conversation
3cb7409
to
d640061
Compare
Our QE is testing this internally. So please feel free to review but do not push it yet. |
…nderer This is the equivalent of the change made in the following commit for sysconfig renderer but this time it is for network_manager renderer: 67bab5b ("net: Allow for NetworkManager configuration") The reasons for making the change has already been outlined in the above commit. When cloud-init configures DNS and produces /etc/resolv.conf, NetworkManager, if enabled, can clobber the above file and could also render it empty. Hence, this change makes cloud-init add a NetworkManager configuration so that it disables management and handling of /etc/resolv.conf by NetworkManager. Some code refactoring has been performed so as to avoid code duplication. Unit tests have been adjusted accordingly. LP: #1693251 Signed-off-by: Ani Sinha <[email protected]>
d640061
to
a530200
Compare
After looking at the sysconfig and NM renderer code deeper and discussing this internally with QE, we found that sysconfig renderer writes DNS information to /etc/resolv.conf but NM renderer does not. When NM renderer is used, the DNS information is directly written into the NM keyfile and NetworkManager is responsible for managing DNS from that point onwards and writing /etc/resolv.conf. There is no need to keep NM out of the loop. Hence, there is no need to write /etc/NetworkManager/conf.d/99-cloud-init.conf from NM renderer. For sysconfig it is necessary to keep NM from touching /etc/resolv.conf separately and overwriting cloud-init generated file. Thus, this PR can be closed. |
…r renderer It is not necessary for NetworkManager renderer to keep NM out of the loop from handling DNS. This is unlike sysconfig renderer where we explicitly add `dns=none` in `/etc/NetworkManager/conf.d/99-cloud-init.conf` NetworkManager configuration file in order to prevent NetworkManager from handling DNS and writing /etc/resolv.conf. This is because NetworkManager renderer writes DNS information in the interface keyfile and does not manipulate /etc/resolv.conf directly. NetworkManager reads this information from the keyfile and handles DNS, including managing /etc/resolv.conf. Sysconfig renderer on the other hand directly writes /etc/resolv.conf directly and hence we need to make sure NetworkManager is not overwriting the DNS data in /etc/resolv.conf. Add a comment explaining the difference between the two renderers with regards to DNS handling. See also GH PR canonical#4450. Signed-off-by: Ani Sinha <[email protected]>
It is not necessary for NetworkManager renderer to keep NM out of the loop from handling DNS. This is unlike sysconfig renderer where we explicitly add `dns=none` in `/etc/NetworkManager/conf.d/99-cloud-init.conf` NetworkManager configuration file in order to prevent NetworkManager from handling DNS and writing /etc/resolv.conf. This is because NetworkManager renderer writes DNS information in the interface keyfile and does not manipulate /etc/resolv.conf directly. NetworkManager reads this information from the keyfile and handles DNS, including managing /etc/resolv.conf. Sysconfig renderer on the other hand directly writes /etc/resolv.conf directly and hence we need to make sure NetworkManager is not overwriting the DNS data in /etc/resolv.conf. Add a comment explaining the difference between the two renderers with regards to DNS handling. See also GH PR #4450. Signed-off-by: Ani Sinha <[email protected]>
This is the equivalent of the change made in the following commit for sysconfig renderer but this time it is for network_manager renderer:
67bab5bb804e2346673 ("net: Allow for NetworkManager configuration")
The reasons for making the change has already been outlined in the above commit. When cloud-init configures DNS and produces
/etc/resolv.conf
, NetworkManager, if enabled, can clobber the above file and could also render it empty. Hence, this change makes cloud-init add a NetworkManager configuration so that it disables management and handling of/etc/resolv.conf
by NetworkManager.Some code refactoring has been performed so as to avoid code duplication. Unit tests have been adjusted accordingly.
LP: #1693251