cloud-init-dev team mailing list archive
-
cloud-init-dev team
-
Mailing list archive
-
Message #04161
[Merge] ~smoser/cloud-init:bug/1747070-snapubuntu-core-seed into cloud-init:master
Scott Moser has proposed merging ~smoser/cloud-init:bug/1747070-snapubuntu-core-seed into cloud-init:master.
Commit message:
ds-identify: check /writable/system-data/ for nocloud seed.
Ubuntu core seeds information to nocloud via a bind-mount of
/writable/system-data/var/lib/cloud over /var/lib/cloud.
When ds-identify runs as a systemd generator that mount is not
guaranteed to have been done. It is guaranteed at
cloud-init-local.service time, but not generator time.
Images built with 'ubuntu-image --cloud-init=user-data-file'
would have cloud-init disabled.
The fix here is just to consider the seed dir under /writable/system-data.
LP: #1747070
Requested reviews:
cloud-init commiters (cloud-init-dev)
Related bugs:
Bug #1747070 in cloud-init: "ds-identify does not see nocloud seed in core snap"
https://bugs.launchpad.net/cloud-init/+bug/1747070
For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/337100
see commit message
--
Your team cloud-init commiters is requested to review the proposed merge of ~smoser/cloud-init:bug/1747070-snapubuntu-core-seed into cloud-init:master.
diff --git a/tests/unittests/test_ds_identify.py b/tests/unittests/test_ds_identify.py
index 31cc622..03942de 100644
--- a/tests/unittests/test_ds_identify.py
+++ b/tests/unittests/test_ds_identify.py
@@ -359,6 +359,14 @@ class TestDsIdentify(CiTestCase):
"""NoCloud is found with iso9660 filesystem on non-cdrom disk."""
self._test_ds_found('NoCloud')
+ def test_nocloud_seed(self):
+ """Nocloud seed directory."""
+ self._test_ds_found('NoCloud-seed')
+
+ def test_nocloud_seed_ubuntu_core_writable(self):
+ """Nocloud seed directory ubuntu core writable"""
+ self._test_ds_found('NoCloud-seed-ubuntu-core')
+
def blkid_out(disks=None):
"""Convert a list of disk dictionaries into blkid content."""
@@ -454,6 +462,22 @@ VALID_CFG = {
'dev/vdb': 'pretend iso content for cidata\n',
}
},
+ 'NoCloud-seed': {
+ 'ds': 'NoCloud',
+ 'files': {
+ os.path.join(P_SEED_DIR, 'nocloud', 'user-data'): 'ud\n',
+ os.path.join(P_SEED_DIR, 'nocloud', 'meta-data'): 'md\n',
+ }
+ },
+ 'NoCloud-seed-ubuntu-core': {
+ 'ds': 'NoCloud',
+ 'files': {
+ os.path.join('writable/system-data', P_SEED_DIR,
+ 'nocloud-net', 'user-data'): 'ud\n',
+ os.path.join('writable/system-data', P_SEED_DIR,
+ 'nocloud-net', 'meta-data'): 'md\n',
+ }
+ },
'OpenStack': {
'ds': 'OpenStack',
'files': {P_PRODUCT_NAME: 'OpenStack Nova\n'},
diff --git a/tools/ds-identify b/tools/ds-identify
index cd26824..5f76243 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -470,6 +470,16 @@ check_seed_dir() {
return 0
}
+check_writable_seed_dir() {
+ # ubuntu core bind-mounts /writable/system-data/var/lib/cloud
+ # over the top of /var/lib/cloud, but the mount might not be done yet.
+ local wdir="/writable/system-data"
+ [ -d "${PATH_ROOT}$wdir" ] || return 1
+ local sdir="${PATH_ROOT}$wdir${PATH_VAR_LIB_CLOUD#${PATH_ROOT}}"
+ local PATH_VAR_LIB_CLOUD="$sdir"
+ check_seed_dir "$@"
+}
+
probe_floppy() {
cached "${STATE_FLOPPY_PROBED}" && return "${STATE_FLOPPY_PROBED}"
local fpath=/dev/floppy
@@ -569,6 +579,7 @@ dscheck_NoCloud() {
esac
for d in nocloud nocloud-net; do
check_seed_dir "$d" meta-data user-data && return ${DS_FOUND}
+ check_writable_seed_dir "$d" meta-data user-data && return ${DS_FOUND}
done
if has_fs_with_label "${fslabel}"; then
return ${DS_FOUND}
Follow ups