-
Notifications
You must be signed in to change notification settings - Fork 908
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 dhcp6 configuration from generate_fallback_configuration() #4474
Conversation
This will make sure on Azure we can use both dhcp4 and dhcp6 when IMDS is not used. This is useful in situations where only ipv6 network is available and there is no dhcp4 running. Fixes canonicalGH-4439 Signed-off-by: Ani Sinha <anisinha@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@ani-sinha , after looking a little closer, I don't think that this change is safe to ship in 23.4. In particular, on non-netplan based systems, cloud-init will render the following NetworkManager config:
Note that
This means that DHCP must succeed for both ipv4 and ipv6 in order for network configuration to proceed, which isn't what we want. Based on this info, I'm going to revert this commit for now, and we can figure out a safer way to proceed for the following release. Sorry for the additional churn on this. |
…ration() (canonical#4474)" This reverts commit 518047a. This commit could cause issues in bringing up the network, especially because in non-netplan NetworkManager environments, may-fail=false .
If you look above, our QE tested this on a system where there is only ipv4 and seemed it was not an issue. I will draw attention of our QE on your comment. |
I think you are wrong @TheRealFalcon . Please see from the doc
So your comment
seems incorrect. |
@ani-sinha see my comments in IRC. The docs you quote support @TheRealFalcon's reason for reverting the commit. If you want this to be un-reverted, please explain why you think that your implementation is correct. |
OK i think I was misreading the doc. Will check with QE as well. Can we please re-open #4439 so that we can fix this in a different way? |
@ani-sinha Hi Ani, I tested sysconfig renderer and NM renderer, the problem only happens when using NM renderer with ipv4 only network, and the connection file would become inactive in a while when dhcp6 fails as the docs description. and I also found that ipv6.may-fail=false is not totally caused by this patch, the default settings of may-fail in cloudinit/net/network_manager.py is false, is there any reason to set it false? Is it possible to remove that line and make it rendering same configs as other renderers to the same networking subsystem? |
No that would be wrong. may-fail is False only when we are explicitly set the subnet-type and the subnet-type is known. It seems correct. We need to find a different solution to this issue. |
When I disable cloud-init and let NM to configure the network, NM does not configure may-fail to false, and cloud-init sysconfig renderer does not set may-fail, so my question is , why cloud-init NM renderer have to set may-fail to false? |
Lets discuss this offline and if required with our NM folks internally. That said I may have an alternative idea and we can try that internally also. There is no need to discuss this here elaborately. |
OK, no problem |
@holmanb @TheRealFalcon I looked at cloud-init closely. Currently there seems to be no way to set the value for "may-fail" . The closest I came was "dhcp4-override" and "dhcp6-override" https://cloudinit.readthedocs.io/en/latest/reference/network-config-format-v2.html#network-config-v2 . |
@ani-sinha I'm wondering if it's necessary at all. Would the following work the ipv4/ipv6 sections?
|
How would you translate this to a config in |
Sorry, I mean that given a config like this:
it would render NetworkManager like this:
|
How is this different from the patch I proposed? Could you show me the diff on top of the patch that was reverted?
Have you tested this with the NM renderer in cloud-init?
|
@ani-sinha , sorry, your questions make me think that we may be talking past one another or that I haven't explained something well enough. Let me back up and recap just to make sure that we're both on the same page. Before this PR (and also now that it has been reverted), the fallback config looked something like this: network:
version: 2
ethernets:
ens4:
dhcp4: true
match:
macaddress: 42:01:0a:a8:00:2d
set-name: ens4 This PR changed the config to look something like: network:
version: 2
ethernets:
ens4:
dhcp4: true
dhcp6: true
match:
macaddress: 42:01:0a:a8:00:2d
set-name: ens4 However, that caused issues that forced us to revert, because when that fallback config gets rendered to NetworkManger, it becomes:
In particular, we found those What I am suggesting is that we could change the cloud-init code to stop rendering the network:
version: 2
ethernets:
ens4:
dhcp4: true
dhcp6: true
match:
macaddress: 42:01:0a:a8:00:2d
set-name: ens4 I would like to change cloud-init's code to instead output something like this:
If we were to make that change in cloud-init, would such a configuration that doesn't include the |
Right and for this change to happen, the cloud-init/Network Manager renderer needs to be told. Today the may-fail lines get added automatically and is set to False. It is because when we add |
This is what I was asking about. How would this break existing deployments? Is it something where the default could be changed upstream but patched in the currently supported downstreams? |
We like to minimize downstream only changes and hence prefer not to maintain downstream only patches except where its only absolutely necessary (for example certain build specific patches and spec file changes). Besides changing the default downstream does not help because we need the fix for this issue downstream also. If the fix depends on the default being a certain way, that needs to be present downstream also. Lastly a solution to a problem based on default being a certain value is IMHO a terrible idea. |
I'm not sure what you mean by default. The reason I am suggesting these changes as a possible avenue to explore is because we have also defined our Network v2 format to be a subset of netplan, so arbitrarily adding keys or changing the dhcp[4,6]-overrides semantics isn't really viable either. Additionally, we'd like the same v2 config to result in the same (or close to same) configuration across the various distributions, but currently on any netplan enabled system using NetworkManager, given the proposed fallback config, I instead get:
Unfortunately this was overlooked when the NetworkManager renderer was added, but we really shouldn't be rendering different configs to the same networking subsystem. |
By default I mean what happens when we have
I do not understand how NM renderer could be generating this configuration.
Why was this not caught with integration tests and unit tests?
This could be an independent issue and I prefer to look into this separately outside of this issue. |
Ok so then please give us a mechanism to pass "may-fail" option to network renderers. Thats all I ask. I do not care how you do it. dhcp6-overrides was one suggestion that I thought could be possible. If required, I can raise another ticket specifically asking for this feature. |
The NM renderer didn't, netplan did. On netplan enabled systems, v2 is passed through to netplan rather than cloud-init rendering anything.
As I said before, it was overlooked. You can't test something you haven't thought of, and existing tests for NM didn't exist because it was a new renderer.
I agree. I'm not trying to solve that here, but I think any solution proposed here needs to keep that in mind.
A separate ticket linking back here is a good idea. |
Cool. Done #4621 . |
I agree with you that NM renderer is a new renderer and it is not fully tested, so the exists doesn't mean it's reasonable. We found that the NM renderer worked for the basic scenarios but it did not treat all cases well. so let's find a better way to enhance it.
|
@ani-sinha Why do you think this needs to be a separate configuration option? Is it not sufficient to set |
@holmanb yes this is a very good idea and we can cook up a patch quickly. Let me revert once I have something. |
… ipv6 If "may-fail" set set to False in the Network Manager keyfile for both ipv4 and ipv6, it essentially means both ipv4 and ipv6 network initialization must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True when both ipv4 and ipv6 are configured in the Network Manager keyfile for both ipv4 and ipv6. Please see discussions in PR canonical#4474. Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6, it essentially means both ipv4 and ipv6 network initialization must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 options, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True, then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Signed-off-by: Ani Sinha <anisinha@redhat.com>
|
… ipv6 If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6, it essentially means both ipv4 and ipv6 network initialization must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 options, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True, then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6, it essentially means both ipv4 and ipv6 network initialization must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 options, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True, then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 dhcp If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6 for dhcp configuration, it essentially means both ipv4 and ipv6 network initialization using dhcp must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 dhcp, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 dhcp are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured as dhcp in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True,then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 dhcp If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6 for dhcp configuration, it essentially means both ipv4 and ipv6 network initialization using dhcp must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 dhcp, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 dhcp are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured as dhcp in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True,then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 dhcp If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6 for dhcp configuration, it essentially means both ipv4 and ipv6 network initialization using dhcp must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 dhcp, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 dhcp are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured as dhcp in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True,then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Co-authored-by: James Falcon <james.falcon@canonical.com> Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 dhcp If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6 for dhcp configuration, it essentially means both ipv4 and ipv6 network initialization using dhcp must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 dhcp, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 dhcp are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured as dhcp in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True,then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Co-authored-by: James Falcon <james.falcon@canonical.com> Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 dhcp If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6 for dhcp configuration, it essentially means both ipv4 and ipv6 network initialization using dhcp must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 dhcp, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 dhcp are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured as dhcp in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True,then do nothing. All other cases remain same as before. Please see discussions in PR canonical#4474. Co-authored-by: James Falcon <james.falcon@canonical.com> Signed-off-by: Ani Sinha <anisinha@redhat.com>
… ipv6 dhcp If "may-fail" is set to False in the Network Manager keyfile for both ipv4 and ipv6 for dhcp configuration, it essentially means both ipv4 and ipv6 network initialization using dhcp must succeed for the overall network configuration to succeed. This means, for environments where only ipv4 or ipv6 is available but not both and we need to configure both ipv4 and ipv6 dhcp, the overall network configuration will fail. This is not what we want. When both ipv4 and ipv6 dhcp are configured, it is enough for the overall configuration to succeed if any one succeeds. Therefore, set "may-fail" to True for both ipv4 and ipv6 if and only if both ipv4 and ipv6 are configured as dhcp in the Network Manager keyfile and "may-fail" is set to False for both. If both ipv4 and ipv6 are configured in the keyfile and if for any of them "may-fail" is already set to True,then do nothing. All other cases remain same as before. Please see discussions in PR #4474. Co-authored-by: James Falcon <james.falcon@canonical.com> Signed-off-by: Ani Sinha <anisinha@redhat.com>
canonical#4474 landed in Noble, so this block isn't needed.
#4474 landed in Noble, so this block isn't needed.
#4474 landed in Noble, so this block isn't needed.
#4474 landed in Noble, so this block isn't needed.
#4474 landed in Noble, so this block isn't needed.
canonical#4474 landed in Noble, so this block isn't needed.
This will make sure on Azure we can use both dhcp4 and dhcp6 when IMDS is not used. This is useful in situations where only ipv6 network is available and there is no dhcp4 running.
Fixes GH-4439