address field not set when reading cmdline/initramfs configured network
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init |
Fix Released
|
Medium
|
Unassigned | ||
cloud-init (Ubuntu) |
Fix Released
|
Medium
|
Unassigned | ||
Xenial |
Fix Released
|
Medium
|
Unassigned | ||
Yakkety |
Fix Released
|
Medium
|
Unassigned | ||
Zesty |
Fix Released
|
Medium
|
Unassigned |
Bug Description
=== Begin SRU Template ===
[Impact]
When cloud-init sees 'ip=' on the kernel command line, it will take
the networking configuration that is written by the ipconfig tool,
and convert it into the proper network config for the system
(/etc/network/
This works well for the 'ip=dhcp' and 'ip=dhcp6' cases, but did not
work correctly for the "statick" path with a command line like:
ip=<
Cloud-init would stack trace when trying to bring up this networking
resulting in a system that did not boot properly.
[Test Case]
The basic idea below is:
a.) launch an instance with proposed version of cloud-init.
b.) inside instance, use cloud-init's net library to convert
'net-eth1.cfg' into a different format, and the render that format
using cloud-init's trunk tool 'net-convert.py'
## launch an instance.
$ release=xenial
$ ref=$release-
$ lxc-proposed-
$ lxc launch $ref $name
$ lxc exec $ref $name /bin/bash
## get render tool
% wget https:/
% sh ./bug-1691135.sh
## if that runs to completion, then it will show the /etc/network/
## file and the netplan etc/netplan/
## if it fails it will stack trace.
As seen in the upstream commit, the change is in a very focused path,
only changing something when the protocol was 'static'.
[Regression Potential]
Potential for regression would be limited to the 'ip=' command line path.
[Other Info]
Upstream commit at
https:/
=== End SRU Template ===
As reported by user niluje, if the initramfs tools write a config that has static networking, then cloud-init would not populate the address field in its rendered network config (_klibc_
The result would be incomplete or invalid configuration, and attempt to render that configuration would result in stacktrace due to KeyError.
This can be seen in trunk with the net-convert tool as below. Editing the yaml and uncommenting the 'address' line will work.
$ cat /tmp/foo.yaml
network:
version: 1
config:
- name: eth1
type: physical
subnets:
- 'type': 'static'
'control': 'manual'
'gateway': '10.0.0.1'
'netmask': '255.255.255.0'
# 'address': '10.0.0.2'
EOF
$ PYTHONPATH=$PWD ./tools/
Input YAML
config:
- name: eth1
subnets:
- broadcast: 10.0.0.255
control: manual
- 10.0.1.1
dns_search:
- foo.com
gateway: 10.0.0.1
netmask: 255.255.255.0
type: static
type: physical
version: 1
Traceback (most recent call last):
File "./tools/
main()
File "./tools/
ns = network_
File "/home/
nsi.
File "/home/
self.
File "/home/
handler(self, command)
File "/home/
return func(self, command, *args, **kwargs)
File "/home/
if ':' in subnet['address']:
KeyError: 'address'
Related branches
- Server Team CI bot: Approve (continuous-integration)
- cloud-init Commiters: Pending requested
-
Diff: 30 lines (+7/-1)2 files modifiedcloudinit/net/cmdline.py (+5/-0)
tests/unittests/test_net.py (+2/-1)
Changed in cloud-init: | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init: | |
status: | Confirmed → Fix Committed |
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
status: | Confirmed → Fix Released |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → Fix Committed |
Changed in cloud-init (Ubuntu Yakkety): | |
status: | New → Fix Committed |
Changed in cloud-init (Ubuntu Zesty): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Yakkety): | |
status: | Fix Committed → Confirmed |
Changed in cloud-init (Ubuntu Xenial): | |
status: | Fix Committed → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Yakkety): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Zesty): | |
importance: | Undecided → Medium |
description: | updated |
description: | updated |
I'm attaching 'bug-show.sh' which actually shows this bug.
The net-eth1.cfg that is written is as 'ipconfig' from klibc would write for static config.
Then, we use the net-convert.py tool in cloud-init source to show the failure.