Merge ~bladernr/plainbox-provider-checkbox:fix-disk_stress_ng into plainbox-provider-checkbox:master

Proposed by Jeff Lane 
Status: Merged
Approved by: Jeff Lane 
Approved revision: 1fe530f05431dc04efe020bafac84e6124d0a9cf
Merged at revision: b32f8969ebc48364c545db94d0eef02e299150e0
Proposed branch: ~bladernr/plainbox-provider-checkbox:fix-disk_stress_ng
Merge into: plainbox-provider-checkbox:master
Diff against target: 22 lines (+2/-2)
1 file modified
bin/disk_stress_ng (+2/-2)
Reviewer Review Type Date Requested Status
Maciej Kisielewski Approve
Review via email: mp+343124@code.launchpad.net

Description of the change

Fixes bug when running disk_stress_ng on /dev/mapper devices where we were looking at the wrong field when looking at partition or volume size.

Also adds bits to check for both lvm and part TYPE when examining lsblk output.

To post a comment you must log in.
Revision history for this message
Maciej Kisielewski (kissiel) wrote :

Good stuff!

I checked the field `cut`ting and can confirm that '-f 2' was wrong.

+1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/disk_stress_ng b/bin/disk_stress_ng
2index df5694e..3668f63 100755
3--- a/bin/disk_stress_ng
4+++ b/bin/disk_stress_ng
5@@ -103,7 +103,7 @@ find_largest_partition() {
6 largest_size=0
7 mapper_string="dm-"
8 if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then
9- partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ")
10+ partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep -E 'part|lvm' | tr -s " ")
11 else
12 partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device)
13 fi
14@@ -113,7 +113,7 @@ find_largest_partition() {
15 part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
16 part_location="/dev/$partition"
17 elif [ -b "/dev/mapper/$partition" ]; then
18- part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 3)
19+ part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
20 part_location="/dev/mapper/$partition"
21 else
22 echo "$partition not found!"

Subscribers

People subscribed via source and target branches