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
diff --git a/bin/disk_stress_ng b/bin/disk_stress_ng
index df5694e..3668f63 100755
--- a/bin/disk_stress_ng
+++ b/bin/disk_stress_ng
@@ -103,7 +103,7 @@ find_largest_partition() {
103 largest_size=0103 largest_size=0
104 mapper_string="dm-"104 mapper_string="dm-"
105 if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then105 if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then
106 partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ")106 partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep -E 'part|lvm' | tr -s " ")
107 else107 else
108 partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device)108 partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device)
109 fi109 fi
@@ -113,7 +113,7 @@ find_largest_partition() {
113 part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)113 part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
114 part_location="/dev/$partition"114 part_location="/dev/$partition"
115 elif [ -b "/dev/mapper/$partition" ]; then115 elif [ -b "/dev/mapper/$partition" ]; then
116 part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 3)116 part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2)
117 part_location="/dev/mapper/$partition"117 part_location="/dev/mapper/$partition"
118 else118 else
119 echo "$partition not found!"119 echo "$partition not found!"

Subscribers

People subscribed via source and target branches