Add checks for uppercase config drive label

There are cases where the label for the config drive is all in
uppercase rather than lowercase (such as when using vfat).  The
default behaviour currently doesn't see those config drives and
fails to use them.

This patch resolves this issue by checking for config drives
with the label `config-2` and `CONFIG-2`.

Change-Id: Ibc51511f488ef41c45497795a99d05ee4e3d2d0d
This commit is contained in:
Mohammed Naser 2017-08-09 22:34:55 -04:00
parent 8724b35c86
commit 66a3762f8c
No known key found for this signature in database
GPG Key ID: 481CBC90384AEC42
1 changed files with 10 additions and 3 deletions

View File

@ -40,14 +40,21 @@ function config_exists() {
return 1
}
# NOTE(mnaser): Depending on the cloud, it may have `vfat` config drive which
# comes with a capitalized label rather than all lowercase.
if blkid -t LABEL="config-2" ; then
CONFIG_DRIVE_LABEL="config-2"
elif blkid -t LABEL="CONFIG-2" ; then
CONFIG_DRIVE_LABEL="CONFIG-2"
fi
# Test to see if config-drive exists. If not, skip and assume DHCP networking
# will work because sanity
if blkid -t LABEL="config-2" ; then
if [ -n "$CONFIG_DRIVE_LABEL" ]; then
# Mount config drive
mkdir -p /mnt/config
BLOCKDEV="$(blkid -L config-2)"
TYPE="$(blkid -t LABEL=config-2 -s TYPE -o value)"
BLOCKDEV="$(blkid -L ${CONFIG_DRIVE_LABEL})"
TYPE="$(blkid -t LABEL=${CONFIG_DRIVE_LABEL} -s TYPE -o value)"
if [[ "${TYPE}" == 'vfat' ]]; then
mount -o umask=0077 "${BLOCKDEV}" /mnt/config || true
else