← Back to team overview

cloud-init-dev team mailing list archive

[Merge] ~smoser/cloud-init:bug/1673411-nova-lxd-config-drive into cloud-init:master

 

Scott Moser has proposed merging ~smoser/cloud-init:bug/1673411-nova-lxd-config-drive into cloud-init:master.

Commit message:
ConfigDrive: support reading config drive data from /config-drive.

This is thie cloud-init part of a fix to allow nova-lxd to provide
config drive data. The other part will be done in nova-lxd.

The agreement here is that nova-lxd will copy the contents of the
config drive to /config-drive in the container.

LP: #1673411

Requested reviews:
  cloud init development team (cloud-init-dev)
Related bugs:
  Bug #1673411 in cloud-init: "config-drive support is broken"
  https://bugs.launchpad.net/cloud-init/+bug/1673411

For more details, see:
https://code.launchpad.net/~smoser/cloud-init/+git/cloud-init/+merge/320069
-- 
Your team cloud init development team is requested to review the proposed merge of ~smoser/cloud-init:bug/1673411-nova-lxd-config-drive into cloud-init:master.
diff --git a/cloudinit/sources/DataSourceConfigDrive.py b/cloudinit/sources/DataSourceConfigDrive.py
index 8a448dc..f247b9c 100644
--- a/cloudinit/sources/DataSourceConfigDrive.py
+++ b/cloudinit/sources/DataSourceConfigDrive.py
@@ -54,13 +54,15 @@ class DataSourceConfigDrive(openstack.SourceMixin, sources.DataSource):
         found = None
         md = {}
         results = {}
-        if os.path.isdir(self.seed_dir):
-            try:
-                results = read_config_drive(self.seed_dir)
-                found = self.seed_dir
-            except openstack.NonReadable:
-                util.logexc(LOG, "Failed reading config drive from %s",
-                            self.seed_dir)
+        for sdir in (self.seed_dir, "/config-drive"):
+            if os.path.isdir(self.seed_dir):
+                try:
+                    results = read_config_drive(self.seed_dir)
+                    found = self.seed_dir
+                    break
+                except openstack.NonReadable:
+                    util.logexc(LOG, "Failed reading config drive from %s",
+                                self.seed_dir)
         if not found:
             for dev in find_candidate_devs():
                 try:
diff --git a/tools/ds-identify b/tools/ds-identify
index e138d78..233e38b 100755
--- a/tools/ds-identify
+++ b/tools/ds-identify
@@ -473,7 +473,7 @@ check_config() {
         files="$*"
     fi
     shift
-    set +f; set -- $files; set +f;
+    set +f; set -- $files; set -f;
     if [ "$1" = "$files" -a ! -f "$1" ]; then
         return 1
     fi
@@ -538,6 +538,14 @@ check_configdrive_v2() {
     if has_fs_with_label "config-2"; then
         return ${DS_FOUND}
     fi
+    # look in /config-drive <vlc>/seed/config_drive for a directory
+    # in YYYY-MM-DD format with a file meta_data.json
+    # expec
+    local d=""
+    for d in /config-drive "${PATH_VAR_LIB_CLOUD}/seed/config_drive"; do
+        set +f; set -- "$d/"2???-??-??/meta_data.json; set -f;
+        [ -f "$1" ] && return ${DS_FOUND}
+    done
     return ${DS_NOT_FOUND}
 }
 

References