Commit 31f8ea31 authored by Mike Hibler's avatar Mike Hibler

Integrate zapdisk into the frisbee MFS.

parent e2a18de5
...@@ -25,6 +25,7 @@ TESTBED_SRCDIR = @top_srcdir@ ...@@ -25,6 +25,7 @@ TESTBED_SRCDIR = @top_srcdir@
OBJDIR = @top_builddir@ OBJDIR = @top_builddir@
SUBDIR = $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR)) SUBDIR = $(subst $(TESTBED_SRCDIR)/,,$(SRCDIR))
SYSTEM := $(shell uname -s) SYSTEM := $(shell uname -s)
CBINDIR = $(DESTDIR)$(CLIENT_BINDIR)
LBINDIR = $(DESTDIR)/usr/local/bin LBINDIR = $(DESTDIR)/usr/local/bin
LSBINDIR = $(DESTDIR)/usr/local/sbin LSBINDIR = $(DESTDIR)/usr/local/sbin
SYSTEM := $(shell uname -s) SYSTEM := $(shell uname -s)
...@@ -86,7 +87,6 @@ endif ...@@ -86,7 +87,6 @@ endif
mfs: mfs:
$(MAKE) -C growdisk client $(MAKE) -C growdisk client
$(MAKE) -C zapdisk mfs $(MAKE) -C zapdisk mfs
$(MAKE) -C growdisk client
$(MAKE) -C imagezip client $(MAKE) -C imagezip client
$(MAKE) -C frisbee.redux client $(MAKE) -C frisbee.redux client
...@@ -110,25 +110,31 @@ distclean: subdir-distclean ...@@ -110,25 +110,31 @@ distclean: subdir-distclean
frisbee-mfs: frisbee-mfs:
$(MAKE) -C growdisk client $(MAKE) -C growdisk client
$(MAKE) -C zapdisk mfs
$(MAKE) -C frisbee.redux client $(MAKE) -C frisbee.redux client
frisbee-mfs-install: frisbee-mfs-install:
ifeq ($(SYSTEM),FreeBSD) ifeq ($(SYSTEM),FreeBSD)
CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C growdisk client-install
CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C frisbee.redux client-install CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C frisbee.redux client-install
CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C growdisk client-install
CLIENT_BINDIR=/etc/testbed $(MAKE) -e -C zapdisk frisbee-mfs-install
else else
CLIENT_BINDIR=/usr/local/bin $(MAKE) -e -C growdisk client-install
CLIENT_BINDIR=/usr/local/bin $(MAKE) -e -C frisbee.redux client-install CLIENT_BINDIR=/usr/local/bin $(MAKE) -e -C frisbee.redux client-install
$(MAKE) -C growdisk client-install
$(MAKE) -C zapdisk frisbee-mfs-install
rm -f $(CBINDIR)/frisbee $(CBINDIR)/frisupload
endif endif
mfs-install: mfs-install:
$(MAKE) -C zapdisk mfs-install
$(MAKE) -C imagezip client-install $(MAKE) -C imagezip client-install
CLIENT_BINDIR=/usr/local/bin $(MAKE) -e -C growdisk client-install $(MAKE) -C frisbee.redux client-install
CLIENT_BINDIR=/usr/local/bin $(MAKE) -e -C frisbee.redux client-install $(MAKE) -C growdisk client-install
$(MAKE) -C zapdisk mfs-install
$(INSTALL_PROGRAM) $(SRCDIR)/create-image $(LBINDIR)/ $(INSTALL_PROGRAM) $(SRCDIR)/create-image $(LBINDIR)/
$(INSTALL_PROGRAM) $(SRCDIR)/create-versioned-image $(LBINDIR)/ $(INSTALL_PROGRAM) $(SRCDIR)/create-versioned-image $(LBINDIR)/
$(INSTALL_PROGRAM) $(SRCDIR)/create-swapimage $(LBINDIR)/ $(INSTALL_PROGRAM) $(SRCDIR)/create-swapimage $(LBINDIR)/
rm -f $(CBINDIR)/frisbee $(CBINDIR)/frisupload
rm -f $(CBINDIR)/imagezip $(CBINDIR)/imageunzip $(CBINDIR)/imagedump
newnode-mfs: mfs newnode-mfs: mfs
newnode-mfs-install: mfs-install newnode-mfs-install: mfs-install
......
...@@ -67,11 +67,14 @@ $(PARTLIBS): ...@@ -67,11 +67,14 @@ $(PARTLIBS):
install: install:
mfs: zapdisk mfs frisbee-mfs: zapdisk
mfs-install: mfs mfs-install: mfs
$(INSTALL_PROGRAM) -m 700 -s zapdisk$(EXE) $(CBINDIR)/zapdisk$(EXE) $(INSTALL_PROGRAM) -m 700 -s zapdisk$(EXE) $(CBINDIR)/zapdisk$(EXE)
$(INSTALL_PROGRAM) -m 700 $(SRCDIR)/diskzap $(LBINDIR)/diskzap $(INSTALL_PROGRAM) -m 700 $(SRCDIR)/diskzap $(LBINDIR)/diskzap
frisbee-mfs-install: frisbee-mfs
$(INSTALL_PROGRAM) -m 700 -s zapdisk$(EXE) $(CBINDIR)/zapdisk$(EXE)
clean: clean:
rm -f *.o zapdisk zapdisk.debug rm -f *.o zapdisk zapdisk.debug
...@@ -162,6 +162,14 @@ find_disks() { ...@@ -162,6 +162,14 @@ find_disks() {
zapsuperblocks() { zapsuperblocks() {
_DSK=$1 _DSK=$1
echo "Invalidating old potential superblocks on $_DSK"
if [ -x "$BINDIR/zapdisk" ]; then
$BINDIR/zapdisk -v -SZ /dev/$_DSK
return
fi
# XXX fall back to the old way
# #
# Note we are not overly concerned about the consequences of misparsing # Note we are not overly concerned about the consequences of misparsing
# the fdisk output. If we whack random blocks, it doesn't hurt anything. # the fdisk output. If we whack random blocks, it doesn't hurt anything.
...@@ -558,12 +566,13 @@ case $STATUS in ...@@ -558,12 +566,13 @@ case $STATUS in
disks=`find_disks` disks=`find_disks`
for d in $disks; do for d in $disks; do
#[ $d = $DISK ] && continue #[ $d = $DISK ] && continue
mount | grep "^/dev/$d" > /dev/null && continue mount | grep "^/dev/$d" >/dev/null && continue
zapsuperblocks $d if [ -x "$BINDIR/zapdisk" ]; then
echo "Invalidating MBR/GPT on $d" echo "Invalidating superblocks and MBR/GPT on $d"
if [ -x /sbin/gpart ]; then $BINDIR/zapdisk -v -SBZ /dev/$d
gpart destroy -F $d
else else
zapsuperblocks $d
echo "Invalidating MBR/GPT on $d"
dd if=/dev/zero of=/dev/$d bs=512 count=16 dd if=/dev/zero of=/dev/$d bs=512 count=16
fi fi
done done
......
...@@ -207,9 +207,15 @@ zapsuperblocks() ...@@ -207,9 +207,15 @@ zapsuperblocks()
local disk=${1##*/} local disk=${1##*/}
echo "Invalidating old potential superblocks on $disk" echo "Invalidating old potential superblocks on $disk"
if [ -x "$BINDIR/zapdisk" ]; then
$BINDIR/zapdisk -v -SZ /dev/$disk
return
fi
# XXX fall back to the old way
partitions=`echo /sys/block/$disk/$disk* 2>/dev/null` partitions=`echo /sys/block/$disk/$disk* 2>/dev/null`
for part in $partitions; do for part in $partitions; do
dd if=/dev/zero of=/dev/${part##*/} bs=512 count=16 > /dev/null 2>&1 dd if=/dev/zero of=/dev/${part##*/} bs=512 count=16 >/dev/null 2>&1
done done
return 0 return 0
...@@ -567,10 +573,15 @@ case $STATUS in ...@@ -567,10 +573,15 @@ case $STATUS in
for d in $disks; do for d in $disks; do
#[ $d = $DISK ] && continue #[ $d = $DISK ] && continue
mount | grep "^/dev/$d" >/dev/null && continue mount | grep "^/dev/$d" >/dev/null && continue
zapsuperblocks $d if [ -x "$BINDIR/zapdisk" ]; then
echo "Invalidating MBR on $d" echo "Invalidating superblocks and MBR/GPT on $d"
sgdisk -Z /dev/$d >/dev/null 2>&1 $BINDIR/zapdisk -v -SBZ /dev/$d
dd if=/dev/zero of=/dev/$d bs=512 count=16 else
zapsuperblocks $d
echo "Invalidating MBR/GPT on $d"
sgdisk -Z /dev/$d >/dev/null 2>&1
dd if=/dev/zero of=/dev/$d bs=512 count=16
fi
done done
# #
......
#!/bin/sh #!/bin/sh
# #
# Copyright (c) 2000-2014 University of Utah and the Flux Group. # Copyright (c) 2000-2015 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -189,9 +189,15 @@ zapsuperblocks() ...@@ -189,9 +189,15 @@ zapsuperblocks()
local disk=${1##*/} local disk=${1##*/}
echo "Invalidating old potential superblocks on $disk" echo "Invalidating old potential superblocks on $disk"
if [ -x "$BINDIR/zapdisk" ]; then
$BINDIR/zapdisk -v -SZ /dev/$disk
return
fi
# XXX fall back to the old way
partitions=`echo /sys/block/$disk/$disk* 2>/dev/null` partitions=`echo /sys/block/$disk/$disk* 2>/dev/null`
for part in $partitions; do for part in $partitions; do
dd if=/dev/zero of=/dev/${part##*/} bs=512 count=16 > /dev/null 2>&1 dd if=/dev/zero of=/dev/${part##*/} bs=512 count=16 >/dev/null 2>&1
done done
return 0 return 0
...@@ -575,21 +581,32 @@ FRISBEE_OPTS="$FRISBEE_OPTS -k $MAXSOCKBUF" ...@@ -575,21 +581,32 @@ FRISBEE_OPTS="$FRISBEE_OPTS -k $MAXSOCKBUF"
# Wipe the MBR and partition boot blocks on all disks if reloading # Wipe the MBR and partition boot blocks on all disks if reloading
case $STATUS in case $STATUS in
*ALLOCATED=emulab-ops/reloading*) *ALLOCATED=emulab-ops/reloading*)
disks=`find_disks` disks=`find_disks`
for d in $disks; do for d in $disks; do
#[ $d = $DISK ] && continue #[ $d = $DISK ] && continue
mount | grep "^/dev/$d" > /dev/null && continue mount | grep "^/dev/$d" >/dev/null && continue
zapsuperblocks /dev/$d if [ -x "$BINDIR/zapdisk" ]; then
echo "Invalidating MBR on /dev/$d" echo "Invalidating superblocks and MBR/GPT on $d"
dd if=/dev/zero of=/dev/$d bs=512 count=16 $BINDIR/zapdisk -v -SBZ /dev/$d
done else
zapsuperblocks /dev/$d
# XXX tmp, gather HW info (including disk speed tests) echo "Invalidating MBR/GPT on /dev/$d"
if [ -x $BINDIR/rc.nodecheck ]; then # XXX not in the Linux MFS yet
$BINDIR/rc.nodecheck boot #sgdisk -Z /dev/$d >/dev/null 2>&1
fi dd if=/dev/zero of=/dev/$d bs=512 count=16
;; fi
done
#
# If we have nodecheck, run it. This allows us to both collect HW info
# (if nodecheck "collect" is enabled in the DB) and to run a destructive
# disk write speed test (as part of a nodecheck "check" operation).
#
if [ -x $BINDIR/rc.nodecheck ]; then
$BINDIR/rc.nodecheck boot
fi
;;
esac esac
# #
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment