cloud-init based images not working on LXC instances
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OpenStack Compute (nova) |
Fix Released
|
Low
|
Stephen Finucane |
Bug Description
Description
===========
Apparently cloud-init based images are unable to correctly initialize in a OpenStack compute using LXC.
Steps to reproduce:
==================
Install a OpenStack using Libvirt + LXC (nova-compute-lxc package in Ubuntu) and launch a cloud-init based instance.
This has been tested with an Ubuntu cloud image (after setting a default root password to allow console login, see [2]):
```
wget http://
tar zxfv ubuntu-
virt-customize -a bionic-
openstack image create "ubuntu_
```
NOTE: since cloud-init usually check the DMI product name (see [1]), in case that the host is an OpenStack compute host or instance itself, the DMI product name may be passed to the LXC instance, so cloud-init would use OpenStack datasource as expected, but for wrong reasons. To avoid that posibility, it may be better to reproduce in a non OpenStack based host.
Environment info:
Host: AWS instance (t2.large)
OS: Ubuntu 18.04.2 LTS
Kernel: Linux 4.15.0-1041-aws #43-Ubuntu SMP x86_64
Openstack: queens
Related packages versions:
nova-api: Installed: 2:17.0.9-0ubuntu3
python-nova: Installed: 2:17.0.9-0ubuntu3
nova-compute: Installed: 2:17.0.9-0ubuntu3
nova-compute-lxc: Installed: 2:17.0.9-0ubuntu3
Expected result
===============
The instance should have a working network configuration and be accesible, etc.
Actual result
=============
The instance is created and is running, but is not accessible by network (neither using the router network namespace nor by assigning an floating IP).
It can be accessed with 'virsh -c lxc:/// console instance-<number>' using root/gocubsgo previously setted:
```
Ubuntu 18.04.2 LTS ubuntu console
ubuntu login: root
Password:
run-parts: /etc/update-
The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/
Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.
root@ubuntu:~# ip addr
1: lo: <LOOPBACK,
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
19: eth0@if20: <BROADCAST,
link/ether fa:16:3e:b3:25:0c brd ff:ff:ff:ff:ff:ff link-netnsid 0
root@ubuntu:~#
```
It can be seen that the network is not configured.
The logs of cloud-init show that no datasource was found so it disabled cloud-init start.
Logs & Configs
==============
```
root@ubuntu:~# cat /run/cloud-
1
```
```
root@ubuntu:~# cat /run/cloud-
[up 22612.42s] ds-identify
policy loaded: mode=search report=false found=all maybe=all notfound=disabled
/etc/cloud/
DMI_PRODUCT_
DMI_SYS_VENDOR=Xen
DMI_PRODUCT_
DMI_PRODUCT_
PID_1_PRODUCT_
DMI_CHASSIS_
FS_LABELS=
ISO9660_
KERNEL_
VIRT=lxc-libvirt
UNAME_KERNEL_
UNAME_KERNEL_
UNAME_KERNEL_
UNAME_MACHINE=
UNAME_NODENAME=
UNAME_OPERATING
DSNAME=
DSLIST=NoCloud ConfigDrive OpenNebula DigitalOcean Azure AltCloud OVF MAAS GCE OpenStack CloudSigma SmartOS Bigstep Scaleway AliYun Ec2 CloudStack Hetzner IBMCloud None
MODE=search
ON_FOUND=all
ON_MAYBE=all
ON_NOTFOUND=
pid=24 ppid=5
is_container=true
is_ds_enabled(
is_ds_enabled(
No ds found [mode=search, notfound=disabled]. Disabled cloud-init [1]
[up 22612.47s] returning 1
root@ubuntu:~# cat /run/cloud-init/
.ds-identify.result cloud.cfg
cloud-init-
```
```
root@ubuntu:~# cat /run/cloud-
di_report:
datasource_list: [ ]
# reporting not found result. notfound=disabled.
```
```
root@ubuntu:~# cat /run/cloud-
/lib/systemd/
kernel command line (container[
kernel_cmdline found unset
etc_file found unset
default found enabled
checking for datasource
ds-identify rc=1
ds-identify _RET=notfound
cloud-init is enabled but no datasource found, disabling
already disabled: no change needed [no /run/systemd/
```
Related bugs:
=============
https:/
References
==========
[1] https:/
[2] https:/
Changed in nova: | |
assignee: | nobody → Miguel Ángel Herranz Trillo (maherranzt) |
status: | New → In Progress |
Changed in nova: | |
assignee: | Miguel Ángel Herranz Trillo (maherranzt) → sean mooney (sean-k-mooney) |
Changed in nova: | |
assignee: | sean mooney (sean-k-mooney) → Stephen Finucane (stephenfinucane) |
Changed in nova: | |
importance: | Undecided → Low |
I proposed a fix, but it seems Gerrit did not post the relation here (unlike other bug/review I filed recently), so I am posting here manually:
Fix proposed on branch: master /review. opendev. org/#/c/ 667976/
Review: https:/