f72280
From 8a7d21fa739901bad847294004266dba76c027af Mon Sep 17 00:00:00 2001
f72280
From: Eduardo Otubo <otubo@redhat.com>
f72280
Date: Tue, 1 Dec 2020 15:51:47 +0100
f72280
Subject: [PATCH 2/4] Adding BOOTPROTO = dhcp to render sysconfig dhcp6
f72280
 stateful on RHEL (#685)
f72280
f72280
RH-Author: Eduardo Terrell Ferrari Otubo (eterrell)
f72280
RH-MergeRequest: 25: Adding BOOTPROTO = dhcp to render sysconfig dhcp6 stateful on RHEL (#685)
f72280
RH-Commit: [1/1] b7304323096b1e40287950e44cf7aa3cdb4ba99e (eterrell/cloud-init)
f72280
RH-Bugzilla: 1859695
f72280
f72280
BOOTPROTO needs to be set to 'dhcp' on RHEL so NetworkManager can
f72280
properly acquire ipv6 address.
f72280
f72280
rhbz: #1859695
f72280
f72280
Signed-off-by: Eduardo Otubo <otubo@redhat.com>
f72280
f72280
Co-authored-by: Daniel Watkins <oddbloke@ubuntu.com>
f72280
Co-authored-by: Scott Moser <smoser@brickies.net>
f72280
---
f72280
 cloudinit/net/sysconfig.py  | 6 ++++++
f72280
 tests/unittests/test_net.py | 2 +-
f72280
 2 files changed, 7 insertions(+), 1 deletion(-)
f72280
f72280
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
f72280
index 078636a4..94801a93 100644
f72280
--- a/cloudinit/net/sysconfig.py
f72280
+++ b/cloudinit/net/sysconfig.py
f72280
@@ -391,6 +391,12 @@ class Renderer(renderer.Renderer):
f72280
                         # Only IPv6 is DHCP, IPv4 may be static
f72280
                         iface_cfg['BOOTPROTO'] = 'dhcp6'
f72280
                     iface_cfg['DHCLIENT6_MODE'] = 'managed'
f72280
+                # only if rhel AND dhcpv6 stateful
f72280
+                elif (flavor == 'rhel' and
f72280
+                        subnet_type == 'ipv6_dhcpv6-stateful'):
f72280
+                    iface_cfg['BOOTPROTO'] = 'dhcp'
f72280
+                    iface_cfg['DHCPV6C'] = True
f72280
+                    iface_cfg['IPV6INIT'] = True
f72280
                 else:
f72280
                     iface_cfg['IPV6INIT'] = True
f72280
                     # Configure network settings using DHCPv6
f72280
diff --git a/tests/unittests/test_net.py b/tests/unittests/test_net.py
f72280
index c0337459..bcd261db 100644
f72280
--- a/tests/unittests/test_net.py
f72280
+++ b/tests/unittests/test_net.py
f72280
@@ -1359,7 +1359,7 @@ NETWORK_CONFIGS = {
f72280
         },
f72280
         'expected_sysconfig_rhel': {
f72280
             'ifcfg-iface0': textwrap.dedent("""\
f72280
-            BOOTPROTO=none
f72280
+            BOOTPROTO=dhcp
f72280
             DEVICE=iface0
f72280
             DHCPV6C=yes
f72280
             IPV6INIT=yes
f72280
-- 
f72280
2.18.4
f72280