cloudinit/net/sysconfig.py write incorrect config for dhcp-stateless openstack subnets
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Harald Jensås |
Bug Description
$ openstack subnet show 48c8407b-
+------
| Field | Value |
+------
| ipv6_address_mode | dhcpv6-stateless |
| ipv6_ra_mode | dhcpv6-stateless |
+------
File: openstack/
-------
{
"services": [
{
"type": "dns",
}
],
"networks": [
{
"type": "ipv6_dhcpv6-
{
}
],
"link": "tap5910c6cc-2d",
{
}
],
"id": "network0"
}
],
"links": [
{
"type": "phy",
"id": "tap5910c6cc-2d",
"mtu": 1450
}
]
}
Actual result
-------------
The network config forces the client to try dhcpv6, not stateless e.g slaac. This fails when there is no DHCPv6 configured, or DHCPv6 is only configured to provide advanced options such a bootfile-url etc.
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
DHCPV6C=yes
HWADDR=
IPV6INIT=yes
IPV6_DEFAULTGW=
MTU=1450
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
Expected result
---------------
The configuration written should differentiate between dhcp6-stateful and dhcp6-stateless.
For dhcp6-stateless "DHCPV6C=yes" should be replaced by IPV6_AUTOCONF=yes as shown in the example below.
# Created by cloud-init on instance boot automatically, do not edit.
#
BOOTPROTO=none
DEFROUTE=yes
DEVICE=eth0
IPV6_AUTOCONF=yes
HWADDR=
IPV6INIT=yes
IPV6_DEFAULTGW=
MTU=1450
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
The issue starts is in the following code[1]:
if 'dhcp' in network['type']:
t = 'dhcp6' if network[
'type': t,
})
This makes the assumption that 'ipv6_dhcpv6-
Then in the code[2] the subnet type is checked and DHCPV6C is always used.
if subnet_type == 'dhcp6':
# TODO need to set BOOTPROTO to dhcp6 on SUSE
Grepping the source code it looks like this is only affecting cloudinit/
[1] https:/
[2] https:/
Related branches
- Ryan Harper: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 210 lines (+141/-3)5 files modifiedcloudinit/net/eni.py (+6/-1)
cloudinit/net/sysconfig.py (+6/-1)
cloudinit/sources/helpers/openstack.py (+2/-1)
tests/unittests/test_datasource/test_configdrive.py (+39/-0)
tests/unittests/test_net.py (+88/-0)
summary: |
- cloudinit/net/sysconfig.py writed incorrect config for dhcp-stateless + cloudinit/net/sysconfig.py write incorrect config for dhcp-stateless openstack subnets |
Changed in cloud-init: | |
status: | New → In Progress |
assignee: | nobody → Harald Jensås (harald-jensas) |
Changed in cloud-init: | |
importance: | Undecided → Medium |
This bug is fixed with commit fac98983 to cloud-init on branch master. /git.launchpad. net/cloud- init/commit/ ?id=fac98983
To view that commit see the following URL:
https:/