[DRBD-cvs] testing by lars; abstract out drbd specifics; part I
drbd-user@lists.linbit.com
drbd-user@lists.linbit.com
Mon, 7 Jun 2004 12:16:44 +0200 (CEST)
DRBD CVS committal
Author : lars
Project : drbd
Module : testing
Dir : drbd/testing/CTH
Modified Files:
Tag: rel-0_7-branch
CTH_bash.conf CTH_bash.helpers bloodymary.conf
bloodymary.sh.conf chipdale.conf functions.sh generic_test.pl
uml-minna.conf
Log Message:
abstract out drbd specifics; part I
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/CTH_bash.conf,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -3 -r1.1.2.3 -r1.1.2.4
--- CTH_bash.conf 28 May 2004 08:32:52 -0000 1.1.2.3
+++ CTH_bash.conf 7 Jun 2004 10:16:39 -0000 1.1.2.4
@@ -1,5 +1,5 @@
#!/bin/bash -nv
-# $Id: CTH_bash.conf,v 1.1.2.3 2004/05/28 08:32:52 lars Exp $
+# $Id: CTH_bash.conf,v 1.1.2.4 2004/06/07 10:16:39 lars Exp $
# NOTE that there is no plausibility check going on
# in this bash version of the CTH.
@@ -38,12 +38,12 @@
new_drbd r1 1 7789 Node_2 /dev/ubd/c Node_1 /dev/ubd/c Link_1
# define what file systems you want to have
-# better be sure you have at most one fs per drbd :-)
+# better be sure you have at most one fs per bdev :-)
#
# CTH currently knows about ext2, ext3, resierfs, xfs
-# DRBD type mountpoint
-FS_1="DRBD=Drbd_1 TYPE=reiserfs MNT=/mnt/ha0"
-FS_2="DRBD=Drbd_2 TYPE=ext3 MNT=/mnt/ha1"
+# BDEV type mountpoint
+FS_1="BDEV=Drbd_1 TYPE=reiserfs MNT=/mnt/ha0"
+FS_2="BDEV=Drbd_2 TYPE=ext3 MNT=/mnt/ha1"
# test resources
RS_1=wbtest
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/CTH_bash.helpers,v
retrieving revision 1.1.2.7
retrieving revision 1.1.2.8
diff -u -3 -r1.1.2.7 -r1.1.2.8
--- CTH_bash.helpers 1 Jun 2004 09:36:55 -0000 1.1.2.7
+++ CTH_bash.helpers 7 Jun 2004 10:16:39 -0000 1.1.2.8
@@ -1,5 +1,5 @@
#!/bin/bash -nv
-# $Id: CTH_bash.helpers,v 1.1.2.7 2004/06/01 09:36:55 lars Exp $
+# $Id: CTH_bash.helpers,v 1.1.2.8 2004/06/07 10:16:39 lars Exp $
#
# define some implicit magic
# so the definition of the DRBDs will be easier
@@ -9,8 +9,9 @@
{
ID_DISK=0
ID_DRBD=0
+ ID_BDEV=0
DRBD_CONF=""
- unset ${!Node_*} ${!Link_*} ${!Disk_*} ${!Drbd_*}
+ unset ${!Node_*} ${!Link_*} ${!Disk_*} ${!Drbd_*} ${!Bdev_*}
unset ${!FS_*} ${!RS_*} ${!H_*} ${!Fmt_*}
# field name headers for display in _gen_comp()
@@ -61,6 +62,16 @@
name=$1
node=$2
real_dev=$3
+ DEV=$real_dev
+}
+bdev_to_env()
+{
+ local b=$1
+ case $b in
+ Drbd_*) drbd_to_env $b ;;
+ Bdev_*) DEV=/dev/mapper/${!b} ;;
+ *) echo >&2 "sorry, I don't know about bdev '$b'"; return 1 ;;
+ esac
}
drbd_to_env()
{
@@ -72,7 +83,25 @@
shift 4; left=$1 left_ip=$2 left_real_dev=$3 left_disk=$4
shift 4; right=$1 right_ip=$2 right_real_dev=$3 right_disk=$4
conf=$5
+ DEV=/dev/nb$minor
}
+new_bdev()
+{
+ local name node real_dev disk bdev
+ name=$1 ; shift
+
+ bdev="$name"
+ while (( $# )) ; do
+ [[ $1 == *:/* ]] || return 101
+ node=${1%%:*} ; real_dev=${1#*:} ; shift
+ let ID_DISK++
+ disk="Disk_$ID_DISK"
+ eval "$disk=( $name $node $real_dev )"
+ bdev="$bdev $node $real_dev"
+ done
+ let ID_BDEV++
+ eval "Bdev_$ID_BDEV=($bdev)"
+}
new_drbd()
{
local name minor port left left_real_dev right right_real_dev link
@@ -87,8 +116,6 @@
right_real_dev=$7
link=$8
- # unfortunately the ${!xx} operator only gives the [0] array field
- # but since thats the IP by definition, this works.
left_ip=$(ip_of $link $left) || return
right_ip=$(ip_of $link $right) || return
node_to_env $left ; left_hostname=$hostname
@@ -213,6 +240,7 @@
{ (
set -e
initial=true
+ [[ ${!Drbd_*} ]] && have_drbd=true || have_drbd=false # FIXME should be node specific...
for n in ${!Node_*}; do
node_to_env $n
ip=$admin_ip
@@ -243,16 +271,24 @@
# make file systems
for fs in ${!FS_*} ; do
eval ${!fs}
- drbd_to_env $DRBD
- n=$left
- on ${!n}: drbdadm_pri name=$name
+ # fixme add paranoia, should check for availability on the
+ # respective node
+ bdev_to_env $BDEV
+ if [[ $BDEV == Drbd_* ]] ; then
+ n=$left
+ on ${!n}: drbdadm_pri name=$name
+ else
+ n=Node_1
+ fi
cat <<-___
#
- # on $n: mkfs.$TYPE /dev/nb$minor
+ # on $n: mkfs.$TYPE $DEV
#
___
- on ${!n}: mkfs_$TYPE DEV=/dev/nb$minor
- on ${!n}: drbdadm_sec name=$name
+ on ${!n}: mkfs_$TYPE DEV=$DEV
+ if [[ $BDEV == Drbd_* ]] ; then
+ on ${!n}: drbdadm_sec name=$name
+ fi
done
initial=false
@@ -269,10 +305,16 @@
[[ -z $CN && -z $cn ]] || return 101
[[ $nn == Node_* ]] || return 102
- drbd_to_env $DRBD
- on ${!nn}: drbd_wait_peer_not_pri minor=$minor
- on ${!nn}: drbdadm_pri name=$name
- on ${!nn}: do_mount DEV=/dev/nb$minor TYPE=$TYPE MNT=$MNT
+ # fixme add paranoia, should check for availability on the
+ # respective node
+ bdev_to_env $BDEV
+ if [[ $BDEV == Drbd_* ]] ; then
+ on ${!nn}: drbd_wait_peer_not_pri minor=$minor
+ on ${!nn}: drbdadm_pri name=$name
+ else
+ : "do something to make $BDEV available?"
+ fi
+ on ${!nn}: do_mount DEV=$DEV TYPE=$TYPE MNT=$MNT
# START IN BACKGROUND
on ${!nn}: ${which}_start MNT=$MNT </dev/null &
@@ -297,10 +339,14 @@
[[ $CN == $cn ]] || return 102
[[ $cn == Node_* ]] || return 103
- drbd_to_env $DRBD
+ bdev_to_env $BDEV
on ${!cn}: generic_test_stop MNT=$MNT
on ${!cn}: do_umount MNT=$MNT
- on ${!cn}: drbdadm_sec name=$name
+ if [[ $BDEV == Drbd_* ]] ; then
+ on ${!cn}: drbdadm_sec name=$name
+ else
+ : "do something to make $BDEV unavailable?"
+ fi
eval "$fs=\${$fs% CN=*}" # forget current node
eval "$rs=\${$rs% CN=*}" # forget current node
Dump_RS
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/bloodymary.conf,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- bloodymary.conf 27 May 2004 12:44:18 -0000 1.1.2.1
+++ bloodymary.conf 7 Jun 2004 10:16:39 -0000 1.1.2.2
@@ -1,4 +1,4 @@
-# $Id: bloodymary.conf,v 1.1.2.1 2004/05/27 12:44:18 lars Exp $
+# $Id: bloodymary.conf,v 1.1.2.2 2004/06/07 10:16:39 lars Exp $
#
# Note that some of the settings here may be overridden in generic_test.pl
# or at the end of this file
@@ -99,14 +99,14 @@
$fs0 = new LGE_CTH::FileSystem {
type => 'ext3',
mount_point => "/mnt/ha0",
- drbd => $r0,
+ bdev => $r0,
};
$fs1 = new LGE_CTH::FileSystem {
type => 'reiserfs',
mount_point => "/mnt/ha1",
- drbd => $r1,
+ bdev => $r1,
};
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/bloodymary.sh.conf,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- bloodymary.sh.conf 28 May 2004 08:33:23 -0000 1.1.2.1
+++ bloodymary.sh.conf 7 Jun 2004 10:16:39 -0000 1.1.2.2
@@ -1,5 +1,5 @@
#!/bin/bash -nv
-# $Id: bloodymary.sh.conf,v 1.1.2.1 2004/05/28 08:33:23 lars Exp $
+# $Id: bloodymary.sh.conf,v 1.1.2.2 2004/06/07 10:16:39 lars Exp $
# NOTE that there is no plausibility check going on
# in this bash version of the CTH.
@@ -38,12 +38,12 @@
new_drbd r1 1 7789 Node_2 /dev/hdc2 Node_1 /dev/hdc2 Link_1
# define what file systems you want to have
-# better be sure you have at most one fs per drbd :-)
+# better be sure you have at most one fs per bdev :-)
#
# CTH currently knows about ext2, ext3, resierfs, xfs
-# DRBD type mountpoint
-FS_1="DRBD=Drbd_1 TYPE=reiserfs MNT=/mnt/ha0"
-FS_2="DRBD=Drbd_2 TYPE=ext3 MNT=/mnt/ha1"
+# BDEV type mountpoint
+FS_1="BDEV=Drbd_1 TYPE=reiserfs MNT=/mnt/ha0"
+FS_2="BDEV=Drbd_2 TYPE=ext3 MNT=/mnt/ha1"
# test resources
RS_1=tiobench
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/chipdale.conf,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- chipdale.conf 27 May 2004 12:44:18 -0000 1.1.2.1
+++ chipdale.conf 7 Jun 2004 10:16:39 -0000 1.1.2.2
@@ -98,14 +98,14 @@
$fs0 = new LGE_CTH::FileSystem {
type => 'xfs',
mount_point => "/drbd/0", # <<=== ADJUST
- drbd => $r0,
+ bdev => $r0,
};
$fs1 = new LGE_CTH::FileSystem {
type => 'reiserfs',
mount_point => "/drbd/1", # <<=== ADJUST
- drbd => $r1,
+ bdev => $r1,
};
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/functions.sh,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -u -3 -r1.1.2.5 -r1.1.2.6
--- functions.sh 1 Jun 2004 14:27:30 -0000 1.1.2.5
+++ functions.sh 7 Jun 2004 10:16:39 -0000 1.1.2.6
@@ -1,6 +1,6 @@
#!/bin/bash
# vim: set foldmethod=marker nofoldenable :
-# $Id: functions.sh,v 1.1.2.5 2004/06/01 14:27:30 lars Exp $
+# $Id: functions.sh,v 1.1.2.6 2004/06/07 10:16:39 lars Exp $
#DEBUG="-vx"
#DEBUG="-v"
@@ -142,9 +142,13 @@
generic_wait_for_boot()
{
- [[ -z $initial ]] && initial=false || initial=true
: ${ip:?unknown admin ip}
: ${hostname:?unknown hostname}
+
+ : ${initial:=false} ${have_drbd:=true}
+ [[ $initial == true ]] || [[ $initial == false ]] || return 1
+ [[ $have_drbd == true ]] || [[ $have_drbd == false ]] || return 1
+
SECONDS=0 # reset bash magic variable
while true; do
ping -c 1 $ip > /dev/null && break
@@ -162,7 +166,12 @@
retry=4
while (( retry-- )) ; do
if $initial; then
- on $ip: do_initial_sanity_check hostname=$hostname && break
+ if $have_drbd ; then
+ on $ip: do_initial_sanity_check hostname=$hostname && break
+ else
+ # fixme sanity check *no drbd*
+ on $ip: do_sanity_check hostname=$hostname && break
+ fi
else
on $ip: do_sanity_check hostname=$hostname && break
fi
@@ -336,7 +345,7 @@
}
#
-# FileSystem
+# FileSystem {{{2
########################
do_mount()
@@ -383,5 +392,5 @@
# 1}}}
-set -o errexit
-#set -o errexit $DEBUG
+#set -o errexit
+set -o errexit $DEBUG
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/generic_test.pl,v
retrieving revision 1.1.2.2
retrieving revision 1.1.2.3
diff -u -3 -r1.1.2.2 -r1.1.2.3
--- generic_test.pl 3 Jun 2004 10:00:08 -0000 1.1.2.2
+++ generic_test.pl 7 Jun 2004 10:16:39 -0000 1.1.2.3
@@ -1,5 +1,5 @@
#!/usr/bin/perl
-# $Id: generic_test.pl,v 1.1.2.2 2004/06/03 10:00:08 lars Exp $
+# $Id: generic_test.pl,v 1.1.2.3 2004/06/07 10:16:39 lars Exp $
use strict;
use warnings;
@@ -15,7 +15,7 @@
my $sleeptime = 30;
my $move_prob = 50;
my $rand_seed;
-my $help;
+my $help = 0;
GetOptions(
"h" => \$help,
===================================================================
RCS file: /var/lib/cvs/drbd/drbd/testing/CTH/Attic/uml-minna.conf,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -3 -r1.1.2.1 -r1.1.2.2
--- uml-minna.conf 27 May 2004 12:44:18 -0000 1.1.2.1
+++ uml-minna.conf 7 Jun 2004 10:16:39 -0000 1.1.2.2
@@ -1,4 +1,4 @@
-# $Id: uml-minna.conf,v 1.1.2.1 2004/05/27 12:44:18 lars Exp $
+# $Id: uml-minna.conf,v 1.1.2.2 2004/06/07 10:16:39 lars Exp $
#
# Note that some of the settings here may be overridden in generic_test.pl
# or at the end of this file
@@ -99,15 +99,13 @@
$fs0 = new LGE_CTH::FileSystem {
type => 'xfs',
mount_point => "/drbd/0",
- drbd => $r0,
-
+ bdev => $r0,
};
$fs1 = new LGE_CTH::FileSystem {
type => 'reiserfs',
mount_point => "/drbd/1",
- drbd => $r1,
-
+ bdev => $r1,
};
#