diff options
author | Zhilong Liu <zlliu@suse.com> | 2018-01-16 10:45:02 +0100 |
---|---|---|
committer | Jes Sorensen <jsorensen@fb.com> | 2018-01-21 22:36:08 +0100 |
commit | ed5e31aa21bf0ec2d2fe541c3b2458262fc8eae0 (patch) | |
tree | 76ae322e2d4e4ccbaf8604f80f0d47e7d7c17d17 /test | |
parent | policy.c: Avoid to take spare without defined domain by imsm (diff) | |
download | mdadm-ed5e31aa21bf0ec2d2fe541c3b2458262fc8eae0.tar.xz mdadm-ed5e31aa21bf0ec2d2fe541c3b2458262fc8eae0.zip |
mdadm/test: correct the logic operation in save_log
1. delete the mdadm -As, keep the original testing scene intact.
2. move some actions into 'array' test, 'mdadm -D $array' would
complain errors if $array is null.
Signed-off-by: Zhilong Liu <zlliu@suse.com>
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
Diffstat (limited to 'test')
-rwxr-xr-x | test | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -59,16 +59,11 @@ save_log() { cp $targetdir/log $logdir/$_basename.log echo "## $HOSTNAME: saving dmesg." >> $logdir/$logfile dmesg -c >> $logdir/$logfile - $mdadm -As 2> /dev/null echo "## $HOSTNAME: saving proc mdstat." >> $logdir/$logfile cat /proc/mdstat >> $logdir/$logfile array=($(mdadm -Ds | cut -d' ' -f2)) - echo "## $HOSTNAME: mdadm -D ${array[@]}" >> $logdir/$logfile - $mdadm -D ${array[@]} >> $logdir/$logfile [ "$1" == "fail" ] && echo "FAILED - see $logdir/$_basename.log and $logdir/$logfile for details" - # ignore saving external(external file, imsm...) bitmap - cat /proc/mdstat | grep -q "linear\|external" && return 0 if [ $DEVTYPE == 'lvm' ] then # not supported lvm type yet @@ -77,6 +72,10 @@ save_log() { then if [ ! -z "$array" -a ${#array[@]} -ge 1 ] then + echo "## $HOSTNAME: mdadm -D ${array[@]}" >> $logdir/$logfile + $mdadm -D ${array[@]} >> $logdir/$logfile + # ignore saving external(external file, imsm...) bitmap + cat /proc/mdstat | grep -q "linear\|external" && return 0 md_disks=($($mdadm -D -Y ${array[@]} | grep "/dev/" | cut -d'=' -f2)) cat /proc/mdstat | grep -q "bitmap" if [ $? -eq 0 ] |