disk_stress_ng fails on mapper devices

Bug #1763497 reported by Jeff Lane on 2018-04-12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Provider for Plainbox - Checkbox
Jeff Lane

Bug Description

Changes were made to disk_stress_ng to handle dev/mapper devices (mostly for hot-swap RAID)

On running this in situations where LVM is active (even if only on one disk), the script errors out because of some coding issues.

The biggest issue is this:

if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then
        partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ")

Note we explicitly set call the partition size as the second item in the output, which produces lines like this:
sda2 205288112128 part /

But further down, we actually try to get the size from item 3, which is the TYPE, not the SIZE:
if [ -b "/dev/$partition" ]; then
            part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
        elif [ -b "/dev/mapper/$partition" ]; then
            part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 3)
            echo "$partition not found!"
            echo "Aborting test"
            exit 1

That second bit for devices in /dev/mapper should also be looking at field 2, not field 3.

Jeff Lane (bladernr) on 2018-04-16
Changed in plainbox-provider-checkbox:
status: In Progress → Fix Committed
Changed in plainbox-provider-checkbox:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers