util.system_is_snappy needs additional checks
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]
Cloud-init when running in Ubuntu core does not recognize it is
running on a 'snappy. As a result the snappy specific code paths are not
taken.
[Test Case]
There are fairly extensive unit tests added to cover the code path
that has been added to detect when system is snappy. See the upstream
commit link below for that. Those tests run on package build, so
the fact that this is in the archive means those have run.
In addition to that we will:
a.) boot an instance of Ubuntu in lxd with cloud-init from proposed
to verify it is not regressed.
b.) craft an lxd instance with /etc/os-release that appears to be snappy.
and then verify via log inspection that it thinks it is.
The test is admittedly superficial, the real end test is having cloud-init
inside a ubuntu core image and it recognizing that it is snappy there.
That test is much more involved.
## launch an instance
$ release=xenial
$ ref=$release-
$ lxc-proposed-
$ lxc launch $ref $name
$ lxc exec $name
## let it boot
$ sleep 10
## check log for warnings
$ lxc exec $name -- cat /run/cloud-
{
"v1": {
"datasource": "DataSourceNoCloud [seed=/
"errors": []
}
}
$ lxc exec $name -- grep WARN /var/log/
no warnings
## write to /etc/os-release so it thinks it is Ubuntu core.
$ lxc exec $name -- sh -c 'echo ID=ubuntu-core >> /etc/os-release'
$ lxc exec $name -- sh -c 'd=/etc/
## Now clear the instance state so it thinks it is first boot.
$ lxc exec $name -- sh -c 'rm -Rf /var/log/
$ lxc exec $name -- sh -xec 'cd /var/lib/cloud; mv seed .x; rm -Rf *; mv .x seed'
+ cd /var/lib/cloud
+ mv seed .x
+ rm -Rf data handlers instance instances scripts sem
+ mv .x seed
$ lxc restart $name
$ sleep 10
$ lxc exec $name -- grep "running on snappy" /var/log/
2017-06-01 20:53:24,346 - cc_apt_
[Regression Potential]
The regression potential would be
a.) cloud-init falsely identifies it is running on snappy when it is not.
b.) cloud-init does not recognize it is on snappy when it is.
[Other Info]
Upstream commit at
https:/
lxc-proposed-
https:/
It publishes an image to lxd with proposed enabled and cloud-init upgraded.
=== End SRU Template ===
Recent core snap images (edge channel revision 1886) do not contain the previously known files used to detect that a system is ubuntu core.
In this bug, we should collect as many known paths/files/
Ubuntu Core 16
--------------
% cat etc/os-release
NAME="Ubuntu Core"
VERSION="16"
ID=ubuntu-core
PRETTY_NAME="Ubuntu Core 16"
VERSION_ID="16"
HOME_URL="http://
BUG_REPORT_URL="http://
% snap version
snap 2.24+2017042019
snapd 2.24+2017042019
series 16
kernel 4.4.0-59-generic
% lsb_release -rd
bash: lsb_release: command not found
% test -e /writable/
0
Ubuntu 16.04 (Classic)
-------
% cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.2 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.2 LTS"
VERSION_ID="16.04"
HOME_URL="http://
SUPPORT_URL="http://
BUG_REPORT_URL="http://
VERSION_
UBUNTU_
% snap version
snap unknown
snapd 2.24.1
series 16
ubuntu 16.04
kernel 4.4.0-75-generic
% lsb_release -rd
Description: Ubuntu 16.04.2 LTS
Release: 16.04
% test -e /writable/
1
Related branches
- Ryan Harper: Approve
- Server Team CI bot: Approve (continuous-integration)
-
Diff: 232 lines (+110/-34)4 files modifiedcloudinit/net/cmdline.py (+1/-30)
cloudinit/util.py (+37/-0)
tests/unittests/helpers.py (+3/-4)
tests/unittests/test_util.py (+69/-0)
Changed in cloud-init: | |
status: | New → Fix Committed |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu): | |
status: | New → Confirmed |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Xenial): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Yakkety): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Zesty): | |
status: | New → Confirmed |
Changed in cloud-init (Ubuntu Xenial): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Yakkety): | |
importance: | Undecided → Medium |
Changed in cloud-init (Ubuntu Zesty): | |
importance: | Undecided → Medium |
description: | updated |
Also, ubuntu-core image has some required kernel flags in /proc/cmdline
$ cat /proc/cmdline (loop)/ kernel. img root=LABEL=writable snap_core= core_x1. snap snap_kernel= pc-kernel_ x1.snap ro net.ifnames=0 init=/lib/ systemd/ systemd console=tty1 console=ttyS0 panic=-1
BOOT_IMAGE=
Specifically, 'snap_core=' and 'snap_kernel='