tripleo-mount-image: replace most lsblk calls with blkid

The version of lsblk on centos8 is missing parameters which this
script relies on. This change switches some lsblk calls to blkid
equivalent to improve support on hosts older than centos9.

There is a similar change proposed to diskimage-builder[1]. This
change addresses a specific failure on a wallaby cs8 job failure[2],
so this change will be backported.

[1] https://review.opendev.org/c/openstack/diskimage-builder/+/850882
[2] https://review.rdoproject.org/zuul/build/3830a8cf87944db495783e43ac5d41bf/log/job-output.txt#5281

Change-Id: I03342e8107a214341990584f039dd5fdca2fece4
This commit is contained in:
Steve Baker 2022-10-25 10:43:20 +13:00
parent 1a7980777c
commit 704cdb267f
1 changed files with 4 additions and 4 deletions

View File

@ -163,10 +163,10 @@ mount_image() {
for device in ${devices}; do
lsblk --nodeps -P --output-all $device
fstype=$(lsblk --all --nodeps --noheadings --output FSTYPE $device)
label=$(lsblk --all --nodeps --noheadings --output LABEL $device)
fstype=$(blkid -o value -s TYPE -p $device)
label=$(blkid -o value -s LABEL -p $device)
part_type_name=$(lsblk --all --nodeps --noheadings --output PARTTYPENAME $device || echo "")
part_type=$(lsblk --all --nodeps --noheadings --output PARTTYPE $device)
part_type=$(blkid -o value -s PART_ENTRY_TYPE -p $device)
if [ -z "${fstype}" ]; then
# Ignore block device with no filesystem type
@ -324,7 +324,7 @@ else
if [ -z "${NBD_DEVICE}" ]; then
for i in {0..15} ; do
device="/dev/nbd${i}"
part_type=$(lsblk --nodeps --noheadings --output PTTYPE $device)
part_type=$(blkid -o value -s PTTYPE -p $device || echo "")
if [ -z "${part_type}" ]; then
NBD_DEVICE="$device"
break