Merge ~jocave/plainbox-provider-checkbox:disk-variable-name into plainbox-provider-checkbox:master

Proposed by Jonathan Cave
Status: Merged
Approved by: Jonathan Cave
Approved revision: 7ac3e1932962c3fb8c8a3819a42004e7003e74e1
Merged at revision: 3f3d3803b15960ad38e22895cebbd203f68f23f0
Proposed branch: ~jocave/plainbox-provider-checkbox:disk-variable-name
Merge into: plainbox-provider-checkbox:master
Diff against target: 31 lines (+5/-4)
1 file modified
bin/storage_test (+5/-4)
Reviewer Review Type Date Requested Status
Maciej Kisielewski Approve
Review via email: mp+362669@code.launchpad.net

Description of the change

The function find_largest_partition appears to have been copied over from the disk_stress_ng script but the variable used to identify the disk was not changed to match that used in new location.

Updated the function and added one extra debug line.

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

Looks good, +0.8.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bin/storage_test b/bin/storage_test
2index da4b717..9649dc1 100755
3--- a/bin/storage_test
4+++ b/bin/storage_test
5@@ -59,7 +59,7 @@ find_largest_lv() {
6 } # find_largest_lv()
7
8
9-# Find the largest partition that holds a supported filesystem on $disk_device.
10+# Find the largest partition that holds a supported filesystem on $disk.
11 # This code is adapted from a similar function in `disk_stress_ng`.
12 # Output:
13 # $largest_part -- Device filename of largest qualifying partition or logical volume
14@@ -67,13 +67,14 @@ find_largest_lv() {
15 # $largest_fs -- Filesystem (ext4, etc.) used on largest qualifying partition or logical volume
16 # $unsupported_fs -- Empty or contains name of unsupported filesystem found on disk
17 find_largest_partition() {
18+ echo "Find largest partition on $disk..."
19 largest_part=""
20 largest_size=0
21 mapper_string="dm-"
22- if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then
23- partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ")
24+ if [ "${disk_device#*$mapper_string}" = "$disk" ]; then
25+ partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk | grep part | tr -s " ")
26 else
27- partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device)
28+ partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk)
29 fi
30 unsupported_fs=""
31 for partition in $(echo "$partitions" | cut -d " " -f 1) ; do

Subscribers

People subscribed via source and target branches