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

Subscribers

People subscribed via source and target branches