diff options
| author | Jeff Lane <jeffrey.lane@canonical.com> | 2017-05-01 18:33:35 -0400 |
|---|---|---|
| committer | Jeff Lane <jeffrey.lane@canonical.com> | 2017-05-01 18:33:35 -0400 |
| commit | 3f5eaf35e8d78d2b01d75bb2f9c03872df45f82e (patch) | |
| tree | d9eed1220e66ec8f54cd974fcb0267d638276bf4 /bin | |
| parent | 110f67e464351a8d6ea6da9c3bb0fd5170f158ea (diff) | |
bin/disk_stress_ng: fixed minor bug and review issues. bin/storage_test: fixed review issues
Diffstat (limited to 'bin')
| -rwxr-xr-x | bin/disk_stress_ng | 9 | ||||
| -rwxr-xr-x | bin/storage_test | 9 |
2 files changed, 9 insertions, 9 deletions
diff --git a/bin/disk_stress_ng b/bin/disk_stress_ng index ca0b3b3..0b5de83 100755 --- a/bin/disk_stress_ng +++ b/bin/disk_stress_ng @@ -102,17 +102,18 @@ find_largest_partition() { largest_part="" largest_size=0 mapper_string="dm-" - if [ "${disk_device#*$mapper_string}" != "$disk_device" ]; then - partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device) - else + if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ") + else + partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device) fi unsupported_fs="" for partition in $(echo "$partitions" | cut -d " " -f 1) ; do - part_size=$(echo "$partitions" | grep "$partition " | cut -d " " -f 2) 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!" diff --git a/bin/storage_test b/bin/storage_test index 28c2a92..5f7516b 100755 --- a/bin/storage_test +++ b/bin/storage_test @@ -70,10 +70,10 @@ find_largest_partition() { largest_part="" largest_size=0 mapper_string="dm-" - if [ "${disk_device#*$mapper_string}" != "$disk_device" ]; then - partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device) - else + if [ "${disk_device#*$mapper_string}" = "$disk_device" ]; then partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device | grep part | tr -s " ") + else + partitions=$(lsblk -b -l -n -o NAME,SIZE,TYPE,MOUNTPOINT $disk_device) fi unsupported_fs="" for partition in $(echo "$partitions" | cut -d " " -f 1) ; do @@ -109,12 +109,11 @@ find_largest_partition() { if [[ "$1}" =~ dm-.* ]]; then # assume lvm or multipath and look for the dev/mapper device disk=/dev/mapper/`ls -l /dev/mapper/ | grep $1 | awk '{print $9}'` - echo 'first choice' else # if the disk doesn't look like dm-0 disk=/dev/$1 fi -echo "set disk to $disk" +echo "Set disk to $disk" scripted_mount=0 if [ -b $disk ] |
