Merge lp:~rpodolyaka/cirros/config-drive into lp:cirros

Proposed by Roman Podoliaka
Status: Needs review
Proposed branch: lp:~rpodolyaka/cirros/config-drive
Merge into: lp:cirros
Diff against target: 36 lines (+14/-5)
1 file modified
src/lib/cirros/ds/configdrive (+14/-5)
To merge this branch: bzr merge lp:~rpodolyaka/cirros/config-drive
Reviewer Review Type Date Requested Status
cirros developers Pending
Review via email: mp+299044@code.launchpad.net

Description of the change

To post a comment you must log in.

Unmerged revisions

370. By Roman Podoliaka

config drive: also check uppercase VFAT labels

Some dosfstools versions unconditionally produce uppercase FS label,
which are currently ignored by Cirros init system (but work with
cloud-init), thus, such config drives will not be found on VM boot.

while the config drive spec says that a lowercase label "config-2"
should be used, it does not go into details whether case-sensitive
or case-insesitive string comparison is expected.

We could easily make this work for CentOS / RHEL users, if we simply
checked for both "config-2" and "CONFIG-2" before giving up.

Closes-Bug: #1598783

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/lib/cirros/ds/configdrive'
--- src/lib/cirros/ds/configdrive 2013-05-12 01:37:38 +0000
+++ src/lib/cirros/ds/configdrive 2016-07-04 13:13:30 +0000
@@ -4,6 +4,7 @@
4CONFIG=/etc/cirros-init/configdrive4CONFIG=/etc/cirros-init/configdrive
5NAME="${0##*/}"5NAME="${0##*/}"
6LABEL="config-2"6LABEL="config-2"
7LABEL_ALT="CONFIG-2"
7SEED_PRE_D="/var/lib/cloud/seed/configdrive-pre"8SEED_PRE_D="/var/lib/cloud/seed/configdrive-pre"
8SEED_POST_D="/var/lib/cloud/seed/configdrive"9SEED_POST_D="/var/lib/cloud/seed/configdrive"
910
@@ -22,11 +23,19 @@
22 local out_d="$1"23 local out_d="$1"
23 local devlist="" num="" found="" fstree_d=""24 local devlist="" num="" found="" fstree_d=""
24 local raw_d="" dev="" rdir="" mdjson="" ud="" found=""25 local raw_d="" dev="" rdir="" mdjson="" ud="" found=""
25 find_devs_with "LABEL=$LABEL" ||26
26 { error "failed to find devs"; return 1; }27 # according to the spec the label should be in lower case, but some
2728 # dosfstools versions will produce an upper case value no matter what.
28 devlist=${_RET}29 # Try both to account for that case (e.g. on RHEL 7.x)
29 [ -n "$devlist" ] || { debug 1 "no devices labeled $LABEL"; exit 0; }30 for label in $LABEL $LABEL_ALT; do
31 find_devs_with "LABEL=$label" ||
32 { error "failed to find devs"; return 1; }
33
34 devlist=${_RET}
35 [ -n "$devlist" ] && break || { debug 1 "no devices labeled $label"; continue; }
36 done
37
38 [ -n "$devlist" ] || { debug 1 "config drive device not found"; exit 0; }
3039
31 if [ -d "${SEED_PRE_D}" ]; then40 if [ -d "${SEED_PRE_D}" ]; then
32 devlist="$SEED_PRE_D $devlist"41 devlist="$SEED_PRE_D $devlist"

Subscribers

People subscribed via source and target branches