Browse Source

Import upstream version 15

Ed L. Cashin 15 years ago
parent
commit
9b8f30a572
18 changed files with 261 additions and 122 deletions
  1. 3 3
      Makefile
  2. 27 0
      NEWS
  3. 1 0
      README
  4. 19 19
      aoe-discover.8
  5. 8 1
      aoe-discover.in
  6. 43 0
      aoe-flush.8
  7. 21 0
      aoe-flush.in
  8. 26 21
      aoe-interfaces.8
  9. 22 6
      aoe-interfaces.in
  10. 4 0
      aoe-mkdevs
  11. 10 9
      aoe-mkdevs.8
  12. 10 9
      aoe-mkshelf.8
  13. 4 2
      aoe-mkshelf.in
  14. 12 15
      aoe-revalidate.8
  15. 10 3
      aoe-revalidate.in
  16. 2 2
      aoe-stat
  17. 13 12
      aoe-stat.8
  18. 26 20
      aoeping.8

+ 3 - 3
Makefile

@@ -37,7 +37,7 @@ NPERSHELF=16
 
 
 # these scripts are created from the *.in files
-CONF_SCRIPTS = aoe-discover aoe-interfaces aoe-mkshelf aoe-revalidate
+CONF_SCRIPTS = aoe-discover aoe-interfaces aoe-mkshelf aoe-revalidate aoe-flush
 PROGS = aoeping
 COMMANDS := ${CONF_SCRIPTS} aoe-mkdevs aoe-stat ${PROGS}
 CFLAGS = -Wall -O -g
@@ -54,8 +54,8 @@ configure :
 
 # DESTDIR was put in for Rob Holland to make gentoo packaging easier
 install : all
-	mkdir -p ${SBINDIR}
-	mkdir -p ${MANDIR}/man8
+	mkdir -p ${DESTDIR}${SBINDIR}
+	mkdir -p ${DESTDIR}${MANDIR}/man8
 	@for f in ${COMMANDS}; do \
 	  sh -xc "install -m 700 $$f ${DESTDIR}${SBINDIR}/$$f" || break; \
 	  sh -xc "install -m 664 $$f.8 ${DESTDIR}${MANDIR}/man8/$$f.8" || break; \

+ 27 - 0
NEWS

@@ -1,3 +1,30 @@
+2007-03-20 "Ed L. Cashin" <ecashin@coraid.com>
+	add quoting to aoe-flush
+	release 15
+
+2007-02-26 Marcus Rueckert <darix@web.de>
+	create the same directories we install to
+
+2007-02-06 Sam Hopkins <sah@coraid.com>
+	add support for -c flag to aoe-interfaces
+	add support for -a flag to aoe-flush
+	update manpages for aoe-interfaces, aoe-flush
+	release 14
+
+2006-12-21 Sam Hopkins <sah@coraid.com>
+	support aoe devices without "etherd" prefix in name
+	create new character device nodes
+	release 13
+
+2006-10-30 Sam Hopkins <sah@coraid.com>
+	formatting cleanup of man pages
+	cleanup of scripts, adding error checking
+	add aoe-flush command
+	release 12
+
+2006-10-13 David Martinez Moreno <ender@debian.org>
+	aoe-stat: POSIX shell math can't count as high as bash
+
 2006-09-07 Anthony Wright <anthony@communitymesh.com>
 	use POSIX shell math instead of relying on dc or bc
 	release 11

+ 1 - 0
README

@@ -37,6 +37,7 @@ Here is a brief list of the tools.  Please see the man pages for
 further details.
 
   aoe-discover		trigger discovery of ATA over Ethernet devices
+  aoe-flush		ask aoe driver to forget down devices
   aoe-interfaces	restrict network interfaces used for AoE
   aoe-mkdevs		create character and block device files
   aoe-mkshelf		create block device files for one shelf address

+ 19 - 19
aoe-discover.8

@@ -35,26 +35,26 @@ calls
 to ask the aoe driver to look for new AoE devices.
 .IP
 .EX
- nai:~# modprobe aoe aoe_iflist="eth0"
- nai:~# aoe-stat
-    e10.9            eth0              up
- nai:~# aoe-interfaces eth0 eth3
- nai:~# aoe-discover
- nai:~# aoe-stat
-     e7.0            eth3              up
-     e7.1            eth3              up
-     e7.2            eth3              up
-     e7.3            eth3              up
-     e7.4            eth3              up
-     e7.5            eth3              up
-     e7.6            eth3              up
-     e7.7            eth3              up
-     e7.8            eth3              up
-     e7.9            eth3              up
-    e10.9            eth0              up
- nai:~# 
+.nf
+nai:~# modprobe aoe aoe_iflist="eth0"
+nai:~# aoe-stat
+   e10.9            eth0              up
+nai:~# aoe-interfaces eth0 eth3
+nai:~# aoe-discover
+nai:~# aoe-stat
+    e7.0            eth3              up
+    e7.1            eth3              up
+    e7.2            eth3              up
+    e7.3            eth3              up
+    e7.4            eth3              up
+    e7.5            eth3              up
+    e7.6            eth3              up
+    e7.7            eth3              up
+    e7.8            eth3              up
+    e7.9            eth3              up
+   e10.9            eth0              up
+.fi
 .EE
-.LP
 .SH "SEE ALSO"
 .IR aoe-interfaces (8),
 .IR aoe-mkdevs (8),

+ 8 - 1
aoe-discover.in

@@ -1,4 +1,11 @@
 #! /bin/sh
 # aoe-discover - trigger an AoE device discovery
 
-echo > @devdir@/discover
+zero=`basename $0`
+f=@devdir@/discover
+
+if ! test -w $f; then
+	echo 1>&2 $zero: $f does not exist or is not writeable.
+	exit 1
+fi
+echo > $f

+ 43 - 0
aoe-flush.8

@@ -0,0 +1,43 @@
+.TH aoe-flush 8
+.SH NAME
+aoe-flush \- flush the down devices out of the aoe driver
+.SH SYNOPSIS
+.nf
+.B aoe-flush [-a]
+.fi
+.SH DESCRIPTION
+The
+.I aoe-flush
+command tells the aoe driver to remove devices from the system and
+forget about them.  Normally the aoe driver will remember all devices it has
+seen until the module is unloaded.  By default, 
+.I aoe-flush
+will only flush
+downed devices.  With the \fB-a\fP flag all devices are candidates for removal.
+.PP
+.I aoe-flush
+will not remove devices that are in use.  This includes devices in the
+closewait state or those in the process of being installed.
+.SH OPTIONS
+.TP
+\fB-a\fP
+The \fB-a\fP option tells the aoe driver to forget all unused devices.
+.SH EXAMPLE
+.EX
+.nf
+nai# aoe-stat | grep e12.0
+     e12.0         0.000GB   eth1 down          
+nai# aoe-flush
+nai# aoe-stat | grep e12.0
+.fi
+.EE
+.SH BUGS
+Flushed devices may reappear when they are discovered by the periodic discovery
+beacon.
+.I aoe-discover
+may be used to force this behaviour.
+.SH "SEE ALSO"
+.IR aoe-stat (8),
+.IR aoe-discover (8).
+.SH AUTHOR
+Sam Hopkins (sah@coraid.com)

+ 21 - 0
aoe-flush.in

@@ -0,0 +1,21 @@
+#! /bin/sh
+# aoe-flush
+
+zero="`basename $0`"
+f="@devdir@/flush"
+spec=""
+
+if ! test -w "$f"; then
+	echo 1>&2 "$zero: $f does not exist or is not writeable."
+	exit 1
+fi
+
+if test "$1" = "-a"; then
+	spec=all
+fi
+
+echo $spec > "$f" || {
+	echo 1>&2 "$zero: flush failed"
+	exit 1
+}
+

+ 26 - 21
aoe-interfaces.8

@@ -3,7 +3,7 @@
 aoe-interfaces \- restrict aoe driver to specified network interfaces
 .SH SYNOPSIS
 .nf
-.B aoe-interfaces [dev1] [dev2 ...]
+.B aoe-interfaces [-c] [dev1] [dev2 ...]
 .fi
 .SH DESCRIPTION
 The
@@ -24,6 +24,10 @@ hasn't been set then the output will be blank.
 It's good to run the 
 .I aoe-discover
 command after setting the AoE interfaces list.
+.SH OPTIONS
+.TP
+\fB-c\fP
+The \fB-c\fP flag will clear the interface access list, permitting any interface to be used.
 .SH EXAMPLE
 In this example, the root user on a host named
 .I nai
@@ -37,27 +41,28 @@ calls
 to ask the aoe driver to look for new AoE devices.
 .IP
 .EX
- nai:~# modprobe aoe aoe_iflist="eth0"
- nai:~# aoe-stat
-    e10.9            eth0              up
- nai:~# aoe-interfaces eth0 eth3
- nai:~# aoe-discover
- nai:~# aoe-stat
-     e7.0            eth3              up
-     e7.1            eth3              up
-     e7.2            eth3              up
-     e7.3            eth3              up
-     e7.4            eth3              up
-     e7.5            eth3              up
-     e7.6            eth3              up
-     e7.7            eth3              up
-     e7.8            eth3              up
-     e7.9            eth3              up
-    e10.9            eth0              up
- nai:~# aoe-interfaces
- eth0 eth3
+.nf
+nai:~# modprobe aoe aoe_iflist="eth0"
+nai:~# aoe-stat
+   e10.9            eth0              up
+nai:~# aoe-interfaces eth0 eth3
+nai:~# aoe-discover
+nai:~# aoe-stat
+    e7.0            eth3              up
+    e7.1            eth3              up
+    e7.2            eth3              up
+    e7.3            eth3              up
+    e7.4            eth3              up
+    e7.5            eth3              up
+    e7.6            eth3              up
+    e7.7            eth3              up
+    e7.8            eth3              up
+    e7.9            eth3              up
+   e10.9            eth0              up
+nai:~# aoe-interfaces
+eth0 eth3
+.fi
 .EE
-.LP
 .SH "SEE ALSO"
 .IR aoe-discover (8),
 .IR aoe-mkdevs (8),

+ 22 - 6
aoe-interfaces.in

@@ -1,14 +1,30 @@
 #! /bin/sh
 # aoe-interfaces
 
-listf=/sys/module/aoe/parameters/aoe_iflist
+zero="`basename $0`"
+devf=@devdir@/interfaces
+sysf=/sys/module/aoe/parameters/aoe_iflist
 
 if test -z "$*"; then
-	test -r $listf && cat $listf
-else
-	if test -w $listf; then
-		printf '%s' "$*" > $listf
+	if test -r "$sysf"; then
+		cat "$sysf"
 	else
-		printf '%s' "$*" > @devdir@/interfaces
+		# can't read from interfaces device
+		false
+	fi
+	exit
+fi
+
+if test $1 = "-c"; then
+	shift
+fi
+
+if test -w "$sysf"; then
+	printf '%s\0' "$*" > "$sysf"
+else
+	if test ! -w "$devf"; then
+		echo 1>&2 "$zero: $devf does not exist or is not writeable."
+		exit 1
 	fi
+	printf '%s\0' "$*" > "$devf"
 fi

+ 4 - 0
aoe-mkdevs

@@ -25,6 +25,10 @@ rm -f $dir/discover
 mknod -m 0200 $dir/discover c $MAJOR 3
 rm -f $dir/interfaces
 mknod -m 0200 $dir/interfaces c $MAJOR 4
+rm -f $dir/revalidate
+mknod -m 0200 $dir/revalidate c $MAJOR 5
+rm -f $dir/flush
+mknod -m 0200 $dir/flush c $MAJOR 6
 
 # pass along the env var to aoe-mkshelf
 export n_partitions

+ 10 - 9
aoe-mkdevs.8

@@ -37,16 +37,17 @@ sysadmin gets rid of the mismatching device nodes and calls
 \fIaoe-mkdevs\fP again with \fIn_partitions\fP set to 1.
 .IP
 .EX
-  nai:~# rm -rf /dev/etherd 
-  nai:~# aoe-mkdevs /dev/etherd
-  nai:~# ls /dev/etherd | wc -l
-  1603
-  nai:~# rm -rf /dev/etherd
-  nai:~# n_partitions=1 aoe-mkdevs /dev/etherd
-  nai:~# ls /dev/etherd | wc -l
-  103
+.nf
+nai:~# rm -rf /dev/etherd 
+nai:~# aoe-mkdevs /dev/etherd
+nai:~# ls /dev/etherd | wc -l
+1603
+nai:~# rm -rf /dev/etherd
+nai:~# n_partitions=1 aoe-mkdevs /dev/etherd
+nai:~# ls /dev/etherd | wc -l
+103
+.fi
 .EE
-.LP
 .SH "SEE ALSO"
 .IR aoe-discover (8),
 .IR aoe-interfaces (8),

+ 10 - 9
aoe-mkshelf.8

@@ -39,16 +39,17 @@ remembers that the driver doesn't have partition support, so the
 command is called again with \fIn_partitions\fP set to 1.
 .IP
 .EX
-  nai:~# aoe-mkshelf /dev/etherd 7
-  nai:~# ls /dev/etherd/e7.* | wc -l
-  160
-  nai:~# rm /dev/etherd/e7.*        
-  nai:~# n_partitions=1 aoe-mkshelf /dev/etherd 7
-  nai:~# ls /dev/etherd/e7.* | wc -l
-  10
-  nai:~# 
+.nf
+nai:~# aoe-mkshelf /dev/etherd 7
+nai:~# ls /dev/etherd/e7.* | wc -l
+160
+nai:~# rm /dev/etherd/e7.*        
+nai:~# n_partitions=1 aoe-mkshelf /dev/etherd 7
+nai:~# ls /dev/etherd/e7.* | wc -l
+10
+nai:~# 
+.fi
 .EE
-.LP
 .SH "SEE ALSO"
 .IR aoe-discover (8),
 .IR aoe-interfaces (8),

+ 4 - 2
aoe-mkshelf.in

@@ -1,8 +1,10 @@
 #! /bin/sh
 
+zero=`basename $0`
+
 if test "$#" != "2"; then
-	echo "Usage: `basename $0` {dir} {shelfaddress}" 1>&2
-	echo "       n_partitions=16 `basename $0` {dir} {shelfaddress}" 1>&2
+	echo "Usage: $zero {dir} {shelfaddress}" 1>&2
+	echo "       n_partitions=16 $zero {dir} {shelfaddress}" 1>&2
 	exit 1
 fi
 n_partitions=${n_partitions:-16}

+ 12 - 15
aoe-revalidate.8

@@ -1,4 +1,4 @@
-.TH aoe-interfaces 8
+.TH aoe-revalidate 8
 .SH NAME
 aoe-revalidate \- revalidate the disk size of an aoe device 
 .SH SYNOPSIS
@@ -10,25 +10,22 @@ The
 .I aoe-revalidate
 command tells the aoe driver to revalidate the disk size of an open aoe device.
 Normally the aoe driver will only acknowledge changes in an aoe device's
-disk size when the aoe device is not open.  Aoe-revalidate will cause the
-driver to pause any I/O for the aoe device while revalidating the disk size.
-After revalidation I/O is resumed.
+disk size when the aoe device is not open.
 .PP
 It should be noted that if an aoe device's disk size shrinks in revalidation
 any users may become hopelessly confused when their resumed I/O starts to fail.
-.PP
-.IP
+.SH EXAMPLE
 .EX
- nai:~# 
- nai# aoe-stat | grep e1.9
-      e1.9        82.348GB   eth0 up            
- nai# < /dev/etherd/e1.9 sleep 600 &
- [1] 13006
- nai# aoe-revalidate e1.9
- nai# aoe-stat | grep e1.9
-       e1.9       164.696GB   eth0 up            
+.nf
+nai# aoe-stat | grep e1.9
+     e1.9        82.348GB   eth0 up            
+nai# < /dev/etherd/e1.9 sleep 600 &
+[1] 13006
+nai# aoe-revalidate e1.9
+nai# aoe-stat | grep e1.9
+     e1.9       164.696GB   eth0 up            
+.fi
 .EE
-.LP
 .SH "SEE ALSO"
 .IR aoe-stat (8).
 .SH AUTHOR

+ 10 - 3
aoe-revalidate.in

@@ -1,12 +1,19 @@
 #! /bin/sh
 # aoe-revalidate
 
+zero=`basename $0`
+f=@devdir@/revalidate
+
 if test -z "$*"; then
-	echo 1>&2 Usage: $0 'e{major}.{minor}'
+	echo 1>&2 Usage: $zero 'e{major}.{minor}'
+	exit 1
+fi
+if ! test -w $f; then
+	echo 1>&2 $zero: $f does not exist or is not writeable
 	exit 1
 fi
-echo "$*" > @devdir@/revalidate || {
-	echo "`basename $0` Error: revalidate failed" 1>&2
+echo "$*" > $f || {
+	echo "$zero: revalidate failed" 1>&2
 	exit 1
 }
 

+ 2 - 2
aoe-stat

@@ -1,4 +1,4 @@
-#! /bin/sh
+#! /bin/bash
 # collate and present sysfs information about AoE storage
 
 set -e
@@ -15,7 +15,7 @@ test ! -d "$sysd/block" && {
 	exit 1
 }
 
-for d in `ls -d $sysd/block/etherd* 2>/dev/null | grep -v p` end; do
+for d in `ls -d $sysd/block/*e[0-9]*\.[0-9]* 2>/dev/null | grep -v p` end; do
 	# maybe ls comes up empty, so we use "end"
 	test $d = end && continue
 

+ 13 - 12
aoe-stat.8

@@ -56,19 +56,20 @@ network interfaces, does an AoE discovery, and prints the list again.
 This time the list shows all the devices in shelf seven.
 .IP
 .EX
- nai:~# modprobe aoe
- nai:~# aoe-stat
- nai:~# ifconfig eth3 up
- nai:~# aoe-discover 
- nai:~# aoe-stat
-       e0.0     10995.116GB   eth0 up            
-       e0.1     10995.116GB   eth0 up            
-       e0.2     10995.116GB   eth0 up            
-       e1.0      1152.874GB   eth0 up            
-       e7.0       370.566GB   eth0 up            
- nai:~# 
+.nf
+nai:~# modprobe aoe
+nai:~# aoe-stat
+nai:~# ifconfig eth3 up
+nai:~# aoe-discover 
+nai:~# aoe-stat
+      e0.0     10995.116GB   eth0 up            
+      e0.1     10995.116GB   eth0 up            
+      e0.2     10995.116GB   eth0 up            
+      e1.0      1152.874GB   eth0 up            
+      e7.0       370.566GB   eth0 up            
+nai:~# 
+.fi
 .EE
-.LP
 .SH "SEE ALSO"
 .IR aoe-discover (8),
 .IR aoe-interfaces (8),

+ 26 - 20
aoeping.8

@@ -93,17 +93,19 @@ uses \fBaoeping\fP to check for the presence of aoe device e10.9 on
 network interface eth0.
 .IP
 .EX
-  bash# aoeping -v 10 9 eth0 | head
-  tag: 80000000
-  eth: eth0
-  shelf: 10
-  slot: 9
-  config query response:
-  00 0d 87 aa c9 00 00 10 04 00 11 1f 88 a2 18 00 
-  00 0a 09 01 00 00 00 00 00 03 30 08 00 10 00 04 
-  66 6f 6f 0a 00 ff ff ff ff ff ff ff ff ff ff ff 
-  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
-  ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
+.nf
+bash# aoeping -v 10 9 eth0 | head
+tag: 80000000
+eth: eth0
+shelf: 10
+slot: 9
+config query response:
+00 0d 87 aa c9 00 00 10 04 00 11 1f 88 a2 18 00 
+00 0a 09 01 00 00 00 00 00 03 30 08 00 10 00 04 
+66 6f 6f 0a 00 ff ff ff ff ff ff ff ff ff ff ff 
+ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
+ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff 
+.fi
 .EE
 .LP
 The next example shows root making sure the disk on the e10.9 is still
@@ -111,10 +113,12 @@ responsive by issuing an ATA device identify command with a 20-second
 timeout. 
 .IP
 .EX
-  bash# aoeping -i -s 20 \\
-    10 9 eth0 > /dev/null \\
-    && echo ok
-  ok
+.nf
+bash# aoeping -i -s 20 \\
+  10 9 eth0 > /dev/null \\
+  && echo ok
+ok
+.fi
 .EE
 .LP
 The next example uses SMART to determine whether the disk on e10.9
@@ -124,11 +128,13 @@ register will be 0x4f when the disk has not exceeded its error
 threshold.
 .IP
 .EX
-  bash# aoeping -S return_status \\
-    10 9 eth0 | grep 'LBA Mid: 0x4f' \\
-    > /dev/null \\
-    && echo ok
-  ok
+.nf
+bash# aoeping -S return_status \\
+  10 9 eth0 | grep 'LBA Mid: 0x4f' \\
+  > /dev/null \\
+  && echo ok
+ok
+.fi
 .EE
 .LP
 Note that in a script, it would be prudent to specify and handle a