Whamcloud - gitweb
demos/basesetup.sh: verify /dev/obd* devices are created
authoradilger <adilger>
Wed, 22 Dec 1999 20:07:27 +0000 (20:07 +0000)
committeradilger <adilger>
Wed, 22 Dec 1999 20:07:27 +0000 (20:07 +0000)
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

lustre/demos/baseclean.sh
lustre/demos/basesetup.sh
lustre/demos/config.sh
lustre/demos/snapdel.sh
lustre/demos/snaprest.sh
lustre/demos/snaptest.sh

index baadee3..846dfd8 100755 (executable)
@@ -5,5 +5,5 @@ OBDDIR="`dirname $0`/.."
 . $OBDDIR/demos/config.sh
 
 [ "$LOOPDEV" ] && losetup -d $LOOPDEV
-[ "$TMPFILE" ] && rm $TMPFILE
+#[ "$TMPFILE" ] && rm $TMPFILE
 
index a356c3d..8874372 100755 (executable)
@@ -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
index ece6bea..825c1d6 100644 (file)
@@ -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
 }
 
index ed39a8e..6c141b0 100755 (executable)
@@ -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
 
index f48ecd3..6de52ae 100755 (executable)
@@ -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"
 
index 8e2e762..b01fdfc 100755 (executable)
@@ -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