summaryrefslogtreecommitdiffstats
path: root/tests/10ddf-assemble-missing
blob: 4bf21b256560b752f19202f9d7c77a745dbcc6fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# An array is assembled incompletely.
# Re missing disks get marked as missing and are not allowed back in

. tests/env-ddf-template
tmp=$(mktemp /tmp/mdtest-XXXXXX)
rm -f $tmp /var/tmp/mdmon.log
ret=0

mdadm -CR $container -e ddf -n 4 $dev8 $dev9 $dev10 $dev11
ddf_check container 4

mdadm -CR $member1 -n 4 -l 10 $dev8 $dev10 $dev9 $dev11 -z 10000
mdadm -CR $member0 -n 2 -l 1 $dev8 $dev9 -z 10000

mdadm --wait $member0 || true
mdadm --wait $member1 || true

mdadm -Ss
sleep 1

# Add all devices except those for $member0
mdadm -I $dev10
mdadm -I $dev11

# Start runnable members
mdadm -IRs || true
mdadm -Ss

#[ -f /var/tmp/mdmon.log ] && cat /var/tmp/mdmon.log

# Now reassemble
# This should work because BVDs weren't written to
for d in $dev8 $dev9 $dev10 $dev11; do
    mdadm -I $d
done
mdadm -Ss

# Expect consistent state
for d in $dev10 $dev11; do
    mdadm -E $d>$tmp
    egrep 'state\[0\] : Degraded, Consistent' $tmp || {
        ret=1
        echo ERROR: $member0 has unexpected state on $d
    }
    egrep 'state\[1\] : Optimal, Consistent' $tmp || {
        ret=1
        echo ERROR: $member1 has unexpected state on $d
    }

    if [ x$(egrep -c 'active/Online$' $tmp) != x2 ]; then
	ret=1
	echo ERROR: unexpected number of online disks on $d
    fi
done

if [ $ret -ne 0 ]; then
    mdadm -E $dev10
    mdadm -E $dev8
fi
rm -f $tmp /var/tmp/mdmon.log
[ $ret -eq 0 ]