Harald Jensås has proposed merging ~harald-jensas/cloud-init:bug/1847517 into 
cloud-init:master.

Requested reviews:
  cloud-init Commiters (cloud-init-dev)
Related bugs:
  Bug #1847517 in cloud-init: "cloudinit/net/sysconfig.py write incorrect 
config for dhcp-stateless openstack subnets"
  https://bugs.launchpad.net/cloud-init/+bug/1847517

For more details, see:
https://code.launchpad.net/~harald-jensas/cloud-init/+git/cloud-init/+merge/373932
-- 
Your team cloud-init Commiters is requested to review the proposed merge of 
~harald-jensas/cloud-init:bug/1847517 into cloud-init:master.
diff --git a/cloudinit/net/sysconfig.py b/cloudinit/net/sysconfig.py
index 87b548e..9a1a270 100644
--- a/cloudinit/net/sysconfig.py
+++ b/cloudinit/net/sysconfig.py
@@ -343,10 +343,15 @@ class Renderer(renderer.Renderer):
         for i, subnet in enumerate(subnets, start=len(iface_cfg.children)):
             mtu_key = 'MTU'
             subnet_type = subnet.get('type')
-            if subnet_type == 'dhcp6':
+            if 'dhcp6' in subnet_type:
                 # TODO need to set BOOTPROTO to dhcp6 on SUSE
                 iface_cfg['IPV6INIT'] = True
-                iface_cfg['DHCPV6C'] = True
+                if 'stateless' in subnet_type:
+                    # Configure network settings using SLAAC from RAs
+                    iface_cfg['IPV6_AUTOCONF'] = True
+                else:
+                    # Configure network settings using DHCPv6
+                    iface_cfg['DHCPV6C'] = True
             elif subnet_type in ['dhcp4', 'dhcp']:
                 iface_cfg['BOOTPROTO'] = 'dhcp'
             elif subnet_type == 'static':
diff --git a/cloudinit/sources/helpers/openstack.py b/cloudinit/sources/helpers/openstack.py
index 8f06911..d1c4601 100644
--- a/cloudinit/sources/helpers/openstack.py
+++ b/cloudinit/sources/helpers/openstack.py
@@ -585,7 +585,8 @@ def convert_net_json(network_json=None, known_macs=None):
             subnet = dict((k, v) for k, v in network.items()
                           if k in valid_keys['subnet'])
             if 'dhcp' in network['type']:
-                t = 'dhcp6' if network['type'].startswith('ipv6') else 'dhcp4'
+                t = (network['type'] if network['type'].startswith('ipv6')
+                     else 'dhcp4')
                 subnet.update({
                     'type': t,
                 })
_______________________________________________
Mailing list: https://launchpad.net/~cloud-init-dev
Post to     : cloud-init-dev@lists.launchpad.net
Unsubscribe : https://launchpad.net/~cloud-init-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to