disk_stress_ng fails on mapper devices

Bug #1763497 reported by Jeff Lane 
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Checkbox Provider - Base
Fix Released
High
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)
            part_location="/dev/$partition"
        elif [ -b "/dev/mapper/$partition" ]; then
            part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 3)
            part_location="/dev/mapper/$partition"
        else
            echo "$partition not found!"
            echo "Aborting test"
            exit 1
        fi

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

Jeff Lane  (bladernr)
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  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.