From: adilger Date: Wed, 22 Dec 1999 20:07:27 +0000 (+0000) Subject: demos/basesetup.sh: verify /dev/obd* devices are created X-Git-Tag: v1_7_100~6157 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=d83f55e3e8978c467bc143558ccd5cbc4d82a998 demos/basesetup.sh: verify /dev/obd* devices are created demos/baseclean.sh: don't remove temp file when exiting demos/config.sh: added OBDMAJ major device number demos/snaprest.sh: need to rework restore and snap indexes --- diff --git a/lustre/demos/baseclean.sh b/lustre/demos/baseclean.sh index baadee3..846dfd8 100755 --- a/lustre/demos/baseclean.sh +++ b/lustre/demos/baseclean.sh @@ -5,5 +5,5 @@ OBDDIR="`dirname $0`/.." . $OBDDIR/demos/config.sh [ "$LOOPDEV" ] && losetup -d $LOOPDEV -[ "$TMPFILE" ] && rm $TMPFILE +#[ "$TMPFILE" ] && rm $TMPFILE diff --git a/lustre/demos/basesetup.sh b/lustre/demos/basesetup.sh index a356c3d..8874372 100755 --- a/lustre/demos/basesetup.sh +++ b/lustre/demos/basesetup.sh @@ -20,6 +20,11 @@ if [ "$LOOPDEV" -a "`losetup $LOOPDEV 2> /dev/null`" ]; then exit 2 fi +# Ensure that we have the correct devices for OBD to work +[ ! -c /dev/obd0 ] && mknod /dev/obd0 c $OBDMAJ 0 +[ ! -c /dev/obd1 ] && mknod /dev/obd1 c $OBDMAJ 1 +[ ! -c /dev/obd2 ] && mknod /dev/obd2 c $OBDMAJ 2 + [ "$TMPFILE" ] && dd if=/dev/zero of=$TMPFILE bs=1k count=10k [ "$LOOPDEV" ] && losetup $LOOPDEV $TMPFILE diff --git a/lustre/demos/config.sh b/lustre/demos/config.sh index ece6bea..825c1d6 100644 --- a/lustre/demos/config.sh +++ b/lustre/demos/config.sh @@ -4,6 +4,9 @@ # destructive). #set -vx +# Major number for OBD devices +OBDMAJ=186 + # If LOOPDEV is empty (""), then no loopback device will be configured. # If TMPFILE is empty (""), then no temporary file will be created for loop. TMPFILE="/tmp/obdfs.tmpfile" @@ -25,17 +28,16 @@ SNAPTABLE="/tmp/obdfs.snaptable" # kernel code has a lot of debugging statements, so this helps us keep # track of what is going on in user-land to generate the kernel messages. plog () { - LOGMETH="kern.debug" if [ "$1" = "log" ]; then - logger -p $LOGMETH "******** $* **********" shift + echo "******** $* **********" >> /var/log/messages echo "$*" else - logger -p $LOGMETH "****start**** $* *****" + echo "****start**** $* *****" >> /var/log/messages echo "$*" $* - sleep 3 - logger -p $LOGMETH "*****end***** $* *****" + sleep 3 # to allow messages to be flushed + echo "*****end***** $* *****" >> /var/log/messages fi } diff --git a/lustre/demos/snapdel.sh b/lustre/demos/snapdel.sh index ed39a8e..6c141b0 100755 --- a/lustre/demos/snapdel.sh +++ b/lustre/demos/snapdel.sh @@ -6,6 +6,8 @@ OBDDIR="`dirname $0`/.." . $OBDDIR/demos/config.sh [ ! -d $MNTSNAP/lost+found ] && echo "need to run obdsetup.sh first" && exit 1 +[ ! -f $MNTOBD/hosts ] && $OBDDIR/demos/snaptest.sh + plog umount $MNTSNAP plog umount $MNTOBD diff --git a/lustre/demos/snaprest.sh b/lustre/demos/snaprest.sh index f48ecd3..6de52ae 100755 --- a/lustre/demos/snaprest.sh +++ b/lustre/demos/snaprest.sh @@ -12,24 +12,29 @@ plog umount $MNTOBD sync sleep 1 -rm $SNAPTABLE plog log "STARTING snaprestore" +# To do a snapshot restore at this time, we need to do several steps. In +# the future, this should all be wrapped into the snaprestore function. +# - we reverse the current and restored entries in the snapshot table +# - we proceed to delete the previous current snapshot +# - we unconfigure the previous current snapshot +# - we delete the previous current snapshot from the table and load it $OBDDIR/class/obdcontrol -f << EOF +XXX need to reverse current/restored entries here!!! +snapset 0 $SNAPTABLE +device /dev/obd2 +connect +snaprestore 1 +device /dev/obd1 +cleanup +detach snaptable $SNAPTABLE -a +d 1 -now -a -2 -current q y snapset 0 $SNAPTABLE -device /dev/obd2 -connect -snaprestore 1 -disconnect EOF plog log "COMPLETE snaprestore" diff --git a/lustre/demos/snaptest.sh b/lustre/demos/snaptest.sh index 8e2e762..b01fdfc 100755 --- a/lustre/demos/snaptest.sh +++ b/lustre/demos/snaptest.sh @@ -7,6 +7,7 @@ OBDDIR="`dirname $0`/.." plog chmod 777 $MNTOBD # change attributes on an existing file plog rm $MNTOBD/a # delete an existing file -plog echo "today" >> $MNTOBD/hello # modify an existing file +echo "echo today >> $MNTOBD/hello" # modify an existing file +echo today >> $MNTOBD/hello plog cp /etc/group $MNTOBD # create a new file plog ln -s goodbye $MNTOBD/newlink # create a new symlink