Add test for multipath and make it work.

Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
This commit is contained in:
Neil Brown 2005-08-16 07:00:22 +00:00
parent fe80f49b6e
commit c13c45e913
3 changed files with 39 additions and 2 deletions

View File

@ -252,7 +252,7 @@ int Create(struct supertype *st, char *mddev, int mdfd,
fprintf(stderr, Name ": no size and no drives given - aborting create.\n");
return 1;
}
if (level > 0) {
if (level > 0 || level == LEVEL_MULTIPATH || level == LEVEL_FAULTY) {
/* size is meaningful */
if (minsize > 0x100000000ULL) {
fprintf(stderr, Name ": devices too large for RAID level %d\n", level);

15
test
View File

@ -42,11 +42,19 @@ devlist=
for d in 0 1 2 3 4 5 6 7
do
[ -f $targetdir/mdtest$d ] || dd if=/dev/zero of=$targetdir/mdtest$d count=$size bs=1K > /dev/null 2>&1
losetup /dev/loop$d $targetdir/mdtest$d
if [ $d -eq 7 ]
then
losetup /dev/loop$d $targetdir/mdtest6 # for multipath use
else
losetup /dev/loop$d $targetdir/mdtest$d
fi
eval dev$d=/dev/loop$d
eval file$d=$targetdir/mdtest$d
eval devlist=\"\$devlist \$dev$d\"
done
path0=$dev6
path1=$dev7
# mdadm always adds --quiet, and we want to see any unexpected messages
mdadm() {
@ -119,6 +127,11 @@ testdev() {
fi
}
rotest() {
dev=$1
fsck -fn $dev >&2
}
for script in tests/$prefix*[^~]

24
tests/00multipath Normal file
View File

@ -0,0 +1,24 @@
#
# create a multipath, and fail and stuff
mdadm -CR $md1 -l multipath -n2 $path0 $path1
testdev $md1 1 $mdsize0 1
mdadm $md1 -f $path0
rotest $md1
testdev $md1 1 $mdsize0 1
mdadm $md1 -r $path0
mdadm $md1 -a $path0
rotest $md1
testdev $md1 1 $mdsize0 1
mdadm $md1 -f $path1
mdadm $md1 -r $path1
rotest $md1
testdev $md1 1 $mdsize0 1
mdadm -S $md1