Skip to content

net: allow dhcp6 configuration from generate_fallback_configuration()

Ani Sinha requested to merge anisinha/cloud-init:fix-21629 into c9s

Jira: https://issues.redhat.com/browse/RHEL-21629

This change is composed of the following two commits:

Commit #1

net/network_manager: do not set "may-fail" to False for both ipv4 and 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>
(cherry picked from commit 29dd5ace73ad60c7452c39b840045fb47fe0711f)

Commit #2:

net: allow dhcp6 configuration from generate_fallback_configuration()
   
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.
    
This change is mostly a reversal of commit 29ed5f5b646ee and therefore,
re-application of the commit 518047aea9 with some small changes.
    
The issue that caused the reversal of 518047aea9 is fixed by the earlier commit:
cab0eaf290af7 ("net/network_manager: do not set "may-fail" to False for both ipv4 and ipv6 dhcp")
    
Fixes GH-4439
    
Signed-off-by: Ani Sinha <anisinha@redhat.com>
(cherry picked from commit 0264e969166846b2f5cf87ccdb051a3a795eca15)

Commit #1 must be committed before commit #2 since it closes a bug that would have been exposed if commit #2 came without commit #1. Please see discussions in upstream PR https://github.com/canonical/cloud-init/pull/4622 .

Merge request reports