Skip to content
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

cloud-init mishandles dhcp6 subnets in network_data.json #3066

Closed
ubuntu-server-builder opened this issue May 11, 2023 · 2 comments
Closed
Labels
launchpad Migrated from Launchpad

Comments

@ubuntu-server-builder
Copy link
Collaborator

This bug was originally filed in Launchpad as LP: #1734739

Launchpad details
affected_projects = []
assignee = None
assignee_name = None
date_closed = 2017-11-28T14:20:56.503205+00:00
date_created = 2017-11-27T18:16:52.960486+00:00
date_fix_committed = None
date_fix_released = None
id = 1734739
importance = undecided
is_complete = True
lp_url = https://bugs.launchpad.net/cloud-init/+bug/1734739
milestone = None
owner = rmccabe
owner_name = Ryan McCabe
private = False
status = invalid
submitter = rmccabe
submitter_name = Ryan McCabe
tags = []
duplicates = []

Launchpad user Ryan McCabe(rmccabe) wrote on 2017-11-27T18:16:52.960486+00:00

It looks like there's a typo in the helpers/openstack.py network_data.json parser.

With a config like:

{
"links" : [ {
"name" : "test",
"id" : "test",
"type" : "vif"
} ],
"networks" : [ {
"netmask" : "255.255.255.0",
"link" : "test",
"id" : "test",
"ip_address" : "192.168.122.201",
"type" : "ipv4",
"gateway" : "192.168.122.1"
}, {
"link" : "test",
"id" : "test",
"type" : "dhcp6"
} ]
}

the resulting network state object is

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
dns:
nameservers: []
search: []
interfaces:
!!python/unicode 'test':
address: null
gateway: null
inet: inet
mac_address: null
mode: manual
mtu: null
name: !!python/unicode 'test'
subnets:
- address: !!python/unicode '192.168.122.201'
!!python/unicode 'gateway': !!python/unicode '192.168.122.1'
ipv4: true
!!python/unicode 'netmask': !!python/unicode '255.255.255.0'
!!python/unicode 'type': static
- !!python/unicode 'type': dhcp4
type: physical
routes: []
_version: 1

When it should be

Internal State
!!python/object:cloudinit.net.network_state.NetworkState
_network_state:
dns:
nameservers: []
search: []
interfaces:
!!python/unicode 'test':
address: null
gateway: null
inet: inet
mac_address: null
mode: manual
mtu: null
name: !!python/unicode 'test'
subnets:
- address: !!python/unicode '192.168.122.201'
!!python/unicode 'gateway': !!python/unicode '192.168.122.1'
ipv4: true
!!python/unicode 'netmask': !!python/unicode '255.255.255.0'
!!python/unicode 'type': static
- !!python/unicode 'type': dhcp6
type: physical
routes: []
_version: 1

It looks like this is caused by an error on line 570 of helpers/openstack.py where the test used is:

t = 'dhcp6' if network['type'].startswith('ipv6') else 'dhcp4'

which will always result in 'dhcp4' since the network type is 'dhcp6'

it looks like changing the test to

t = 'dhcp6' if network['type'].endswith('6') else 'dhcp4'

fixes things.

@ubuntu-server-builder ubuntu-server-builder added the launchpad Migrated from Launchpad label May 11, 2023
@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Ryan McCabe(rmccabe) wrote on 2017-11-28T14:20:35.857245+00:00

ovirt will change to match openstack, so that no changes are needed.

@ubuntu-server-builder
Copy link
Collaborator Author

Launchpad user Scott Moser(smoser) wrote on 2017-11-28T14:52:43.150796+00:00

Just for historic purposes,
Ryan's response here was due to my comment on his merge proposal that sayd:

I'm somewhat disappointed that this passed unit tests.

There are real-ish world examples at bug 1514082
of things like:
{
"id": "network0",
"link": "tap54d10236-5d",
"network_id": "a5d1181f-bedd-40a5-8b4a-5574b74dba61",
"type": "ipv4_dhcp"
},

Did openstack change the 'type' value for dhcp from
ipv4_dhcp or ipv6_dhcp
to
dhcp4 or dhcp6 ?

like you show in your bug?

@ubuntu-server-builder ubuntu-server-builder closed this as not planned Won't fix, can't repro, duplicate, stale May 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
launchpad Migrated from Launchpad
Projects
None yet
Development

No branches or pull requests

1 participant