summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZhilong Liu <zlliu@suse.com>2018-01-16 17:45:02 +0800
committerJes Sorensen <jsorensen@fb.com>2018-01-21 16:36:08 -0500
commited5e31aa21bf0ec2d2fe541c3b2458262fc8eae0 (patch)
tree76ae322e2d4e4ccbaf8604f80f0d47e7d7c17d17
parent3bf9495270d7cd00da942e183dc5f7c7eb68ff69 (diff)
downloadmdadm-ed5e31aa21bf0ec2d2fe541c3b2458262fc8eae0.tar.gz
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>
-rwxr-xr-xtest9
1 files changed, 4 insertions, 5 deletions
diff --git a/test b/test
index e74bbe5..eb67ef5 100755
--- a/test
+++ b/test
@@ -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 ]