Browse Source

Import upstream version 26

Ed L. Cashin 16 years ago
parent
commit
d46a842c33
26 changed files with 316 additions and 58 deletions
  1. 0 1
      .gitignore
  2. 2 2
      Makefile
  3. 32 0
      NEWS
  4. 0 5
      TODO
  5. 1 1
      aoe-discover.in
  6. 6 0
      aoe-flush.8
  7. 35 8
      aoe-flush.in
  8. 5 1
      aoe-interfaces.8
  9. 1 1
      aoe-interfaces.in
  10. 1 1
      aoe-mkdevs
  11. 1 1
      aoe-mkshelf.in
  12. 1 1
      aoe-revalidate.in
  13. 4 0
      aoe-stat.8
  14. 32 8
      aoe-stat.in
  15. 2 2
      aoe-version
  16. 1 1
      aoecfg.8
  17. 5 3
      aoecfg.c
  18. 6 18
      aoeping.c
  19. 8 0
      aoetools.8
  20. 82 0
      coraid-update
  21. 32 0
      coraid-update.8
  22. 2 2
      dat.h
  23. 1 1
      fns.h
  24. 1 1
      linux.c
  25. 33 0
      sos-linux
  26. 22 0
      sos-linux.8

+ 0 - 1
.gitignore

@@ -1 +0,0 @@
-*~

+ 2 - 2
Makefile

@@ -39,7 +39,7 @@ NPERSHELF=16
 # these scripts are created from the *.in files
 CONF_SCRIPTS = aoe-discover aoe-interfaces aoe-mkshelf aoe-revalidate aoe-flush aoe-stat
 PROGS = aoeping aoecfg
-COMMANDS := ${CONF_SCRIPTS} aoe-mkdevs aoe-version ${PROGS}
+COMMANDS := ${CONF_SCRIPTS} aoe-mkdevs aoe-version coraid-update ${PROGS}
 CFLAGS = -Wall -O -g
 
 AOE_PING_OBJ = aoeping.o linux.o
@@ -63,7 +63,7 @@ install : all
 	done
 
 clean :
-	rm -f ${CONF_SCRIPTS} ${AOE_PING_OBJ} ${PROGS}
+	rm -f ${CONF_SCRIPTS} ${AOE_PING_OBJ} ${AOE_CFG_OBJ} ${PROGS}
 
 aoeping : ${AOE_PING_OBJ}
 	${CC} ${CFLAGS} -o $@ ${AOE_PING_OBJ}

+ 32 - 0
NEWS

@@ -1,3 +1,35 @@
+2008-05-14 "Ed L. Cashin" <ecashin@coraid.com>
+	add sos-linux tool for collecting localhost information
+	release 26
+
+2008-04-11 "Ed L. Cashin" <ecashin@coraid.com>
+	create coraid-update for uploading update file to an update target
+	create coraid-update manpage
+	release 25
+
+2008-03-25 "Ed L. Cashin" <ecashin@coraid.com>
+	clean up aoecfg object files in "clean" target
+
+2008-02-22 "Ed L. Cashin" <ecashin@coraid.com>
+	make aoeping and aoecfg more conforming to AoE protocol
+	release 24
+
+2008-01-09 "Ed L. Cashin" <ecashin@coraid.com>
+	release 23
+
+2008-01-09 Sam Hopkins <sah@coraid.com>
+	support new payload size information from aoe driver
+
+2008-01-08 "Ed L. Cashin" <ecashin@coraid.com>
+	handle aoe-flush without arguments correctly
+
+2007-12-19 "Ed L. Cashin" <ecashin@coraid.com>
+	fix aoecfg manpage typo (-s for string)
+
+2007-12-10 "Ed L. Cashin" <ecashin@coraid.com>
+	aoe-flush: support flushing specific devices
+	release 22
+
 2007-10-29 "Ed L. Cashin" <ecashin@coraid.com>
 	aoe-interfaces should complain about non network interfaces
 	aoe-interfaces should accept quoted list of interfaces

+ 0 - 5
TODO

@@ -1,5 +0,0 @@
-The SMART support provided by aoeping is quite basic and low level.
-There should be some higher-level way to use SMART on AoE disks,
-either by getting smartmontools to use the aoetools (perhaps through
-an aoelib), or by supporting the most frequently-used features in an
-aoesmart program here in the aoetools.

+ 1 - 1
aoe-discover.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-discover - trigger an AoE device discovery
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
 zero=`basename $0`
 f=@devdir@/discover

+ 6 - 0
aoe-flush.8

@@ -4,6 +4,7 @@ aoe-flush \- flush the down devices out of the aoe driver
 .SH SYNOPSIS
 .nf
 .B aoe-flush [-a]
+.B aoe-flush dev1 [dev2 ...]
 .fi
 .SH DESCRIPTION
 The
@@ -18,6 +19,11 @@ downed devices.  With the \fB-a\fP flag all devices are candidates for removal.
 .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.
+.PP
+By specifying a series of specific aoe devices, e.g., \fBe7.0 e3.2\fP,
+it is possible to ask the aoe driver to forget these devices.  This
+feature may be convenient after a temporary AoE target is no longer
+being used.
 .SH OPTIONS
 .TP
 \fB-a\fP

+ 35 - 8
aoe-flush.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-flush - ask aoe driver to forget about devices
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
 zero="`basename $0`"
 f="@devdir@/flush"
@@ -17,12 +17,39 @@ if ! test -c $f; then
 	exit 1
 fi
 
-if test "$1" = "-a"; then
-	spec=all
-fi
-
-echo $spec > "$f" || {
-	echo 1>&2 "$zero: flush failed"
-	exit 1
+# make sure that each device in the whitespace-separated
+# list exists
+function verify_devs () {
+	err=""
+	for d; do
+		aoe-stat |
+			awk -vd="$d" '$1==d{print $1}' |
+			test "`cat`" || {
+			exec 2>&1
+			echo "$zero Error: \"$d\" is not an aoe device"
+			err="$err $d"
+		}
+	done
+	test ! "$err"
 }
 
+err=""
+if test "$1"; then
+	if test "$1" = "-a"; then
+		spec=all
+	else
+		spec="$*"
+		verify_devs $spec || exit 1
+	fi
+	for i in $spec; do
+		printf "$i" > "$f" || {
+			echo 1>&2 "$zero: flush failed"
+			err="$err $i"
+		}
+	done
+else
+	echo > "$f" || err=no_args
+fi
+if test "$err"; then
+	exit 1
+fi

+ 5 - 1
aoe-interfaces.8

@@ -15,7 +15,11 @@ on all but the specified network interfaces.  It is analogous to the
 .PP
 If neither the \fIaoe_iflist\fP module load option nor the
 \fIaoe-interfaces\fP command are used, the aoe driver will use any
-network interface for AoE traffic.
+network interface for AoE traffic.  Using \fIaoe-interfaces\fP to
+limit AoE to only trusted networks prevents the case where a rogue AoE
+target appears on a public network, diverting data from the legitimate
+AoE target.  Such an imposter target effectively corrupts the data on
+the legitimate target.
 .PP
 If the aoe driver is a module, then calling 
 .I aoe-interfaces

+ 1 - 1
aoe-interfaces.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-interfaces - set or list the allowed AoE network interfaces
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
 zero="`basename $0`"
 devf=@devdir@/interfaces

+ 1 - 1
aoe-mkdevs

@@ -1,6 +1,6 @@
 #!/bin/sh
 # aoe-mkdevs - make static device nodes on systems without udev
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
 n_shelves=${n_shelves:-10}
 n_partitions=${n_partitions:-16}

+ 1 - 1
aoe-mkshelf.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-mkshelf - device nodes for one shelf without udev
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
 zero=`basename $0`
 

+ 1 - 1
aoe-revalidate.in

@@ -1,6 +1,6 @@
 #! /bin/sh
 # aoe-revalidate - ask aoe driver to query AoE target
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
 zero=`basename $0`
 f=@devdir@/revalidate

+ 4 - 0
aoe-stat.8

@@ -31,6 +31,10 @@ The size of the AoE device is in gigabytes (billions of bytes).
 .BI ifname
 The network interface name is printed in the third column.
 .TP
+.BI payload
+If the driver exports the per-packet data payload size, it
+will appear in the fourth column, expressed in bytes.
+.TP
 .BI status
 The device status is in the last column.  Possible values
 are \fI up\fR, \fI down\fR, 

+ 32 - 8
aoe-stat.in

@@ -1,9 +1,8 @@
 #! /bin/bash
 # aoe-stat - collate and present information about AoE storage
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
 set -e
-format="%10s %15s %6s %-14s\n"
 me=`basename $0`
 sysd=${sysfs_dir:-/sys}
 
@@ -29,9 +28,25 @@ EOF
 	fi
 }
 
+re=.
+if test $# -gt 0; then
+	re=$1
+fi
+
+# compatibility for aoe drivers without payload information
 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
+	
+	test -r "$d/payload" && payload=yes
+done
+if test "$payload" = "yes"; then
+	format="%10s %15s %10s %-5s %-14s\n"
+else
+	format="%10s %15s %6s %-14s\n"
+fi
+for d in `ls -d $sysd/block/*e[0-9]*\.[0-9]* 2>/dev/null | grep -v p` end; do
+	test $d = end && continue
 
 	dev=`echo "$d" | sed 's/.*!//'`
 	sectors="`cat \"$d/size\"`"
@@ -39,9 +54,18 @@ for d in `ls -d $sysd/block/*e[0-9]*\.[0-9]* 2>/dev/null | grep -v p` end; do
 	checknode "$dev" "$minor"
 	psize=$(((512000 * $sectors) / (1000 * 1000 * 1000)))
 	psize=`printf "%04d\n" $psize | sed 's!\(...\)$!.\1!'`
-	printf "$format" \
-		"$dev" \
-		"${psize}GB" \
-		"`cat \"$d/netif\"`" \
-		"`cat \"$d/state\"`"
-done | sort
+	if test "$payload" = "yes"; then
+		printf "$format" \
+			"$dev" \
+			"${psize}GB" \
+			"`cat \"$d/netif\"`" \
+			"`cat \"$d/payload\"`" \
+			"`cat \"$d/state\"`"
+	else
+		printf "$format" \
+			"$dev" \
+			"${psize}GB" \
+			"`cat \"$d/netif\"`" \
+			"`cat \"$d/state\"`"
+	fi
+done | sort | grep $re

+ 2 - 2
aoe-version

@@ -1,8 +1,8 @@
 #! /bin/sh
 # aoe-version - display versions of AoE-related software
-# Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+# Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
 
-aoetools=21
+aoetools=26
 
 # standalone aoe drivers have a module parameter "version"
 installed="`modinfo aoe 2>/dev/null | awk '/srcversion/ {next} /^parm:.*version:aoe module/ {print $NF; exit 0}'`"

+ 1 - 1
aoecfg.8

@@ -45,7 +45,7 @@ and Error set to 4.
 .B fset
 Force set the server config string to the argument string and respond.
 .TP
-.BI \-c " cfgstr"
+.BI \-s " cfgstr"
 specify the config string.
 .TP
 .BI \-t " timeout"

+ 5 - 3
aoecfg.c

@@ -1,6 +1,6 @@
 /*
  * aoecfgstr.c - fiddle aoe configuration strings.
- * Copyright 2007, Erik Quanstrom, Coraid, Inc., Licenced under GPL v2
+ * Copyright 2008, Erik Quanstrom, Coraid, Inc., Licenced under GPL v2
  */
 #include <stdio.h>
 #include <string.h>
@@ -124,8 +124,10 @@ cfgquery(int cmd, int shelf, int slot)
 	h->cmd = Config;
 	tag = aoe_tag();
 	memmove(h->tag, &tag, sizeof h->tag);
-	c->bufcnt = 3;
-	c->vercmd = 0x10 | cmd;
+	c->bufcnt = 0;
+	c->firmware = 0;
+	c->scnt = 0;
+	c->vercmd = cmd;
 	memmove(c->data, cfgstr, cfgstrlen);
 	c->len = htons(cfgstrlen);
 	if (write(sfd, c, sizeof *c) == -1) {

+ 6 - 18
aoeping.c

@@ -1,5 +1,5 @@
 /* aoeping.c - userland aoe pinger
- * Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+ * Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
  *
  * run without arguments for usage
  */
@@ -60,20 +60,6 @@ static char *progname;
 static int sfd;			/* raw socket file descriptor */
 static uchar mac[6];
 
-#if 0
-void
-show_opts(struct progopts *opts)
-{
-	printf("shelf: %d\n", opts->shelf);
-	printf("slot: %d\n", opts->slot);
-	printf("netif: %s\n", opts->netif);
-	printf("verbose: %d\n", opts->verbose);
-	printf("timeout: %d\n", opts->timeout);
-	printf("tag: %d\n", opts->tag);
-	printf("ata_ident: %d\n", (int) opts->ata_ident);
-}
-#endif
-
 void
 usage(void)
 {
@@ -126,10 +112,12 @@ find_blade(Conf *c, struct progopts *opts)
 	h->cmd = Config;
 	tag = htonl(opts->tag);
 	memmove(h->tag, &tag, sizeof h->tag);
-	c->bufcnt = 3;
-	c->vercmd = 0x10 | Qread;
-	memset(c->data, 0xED, sizeof c->data);
+	c->bufcnt = 0;
+	c->firmware = 0;
+	c->scnt = 0;
+	c->vercmd = Qread;
 	c->len = htons(1024);
+	memset(c->data, 0xED, sizeof c->data);
 	if (write(sfd, c, sizeof *c) == -1) {
 		perror("send config query");
 		exit(EXIT_FAILURE);

+ 8 - 0
aoetools.8

@@ -31,6 +31,12 @@ collate and present information about AoE storage
 .TP
 .BI aoe-version
 display version numbers of AoE-related software
+.TP
+.BI coraid-update
+send updates to Coraid appliances
+.TP
+.BI sos-linux
+collect AoE-related information about the localhost
 .SH "SEE ALSO"
 .IR aoe-discover (8),
 .IR aoe-flush (8),
@@ -42,4 +48,6 @@ display version numbers of AoE-related software
 .IR aoe-version (8),
 .IR aoecfg (8),
 .IR aoeping (8),
+.IR coraid-update (8),
+.IR sos-linux (8),
 .IR udev (7).

+ 82 - 0
coraid-update

@@ -0,0 +1,82 @@
+#! /bin/sh
+# usage: coraid-update {update file} {AoE target}
+# coraid-update depends upon sysfs mounted on /sys
+
+# The destination must be,
+#   1) an AoE target ready for I/O, and
+#   2) not too big to be an update target
+#
+# Later, when Coraid appliances mark update targets with special ATA
+# device identify content or special target content, a prompt should
+# be added after the check of the target's size if the identifying
+# content is not detected.
+# 
+# The update file must either, 
+#   1) be an SR tarc file that looks OK to the local tar, or
+#   2) any file not ending in ".tarc".
+
+# size of update lblade in /proc/partitions is 40000
+max=70000
+
+usage="usage: coraid-update {update file} {AoE device}"
+if test "$#" != 2; then
+	echo "$usage" 1>&2
+	exit 1
+fi
+update="$1"
+ulb="$2"
+
+# if it's an update target, it should be in `aoe-stat`
+aoe-stat | awk -vt="`basename $ulb`" '
+BEGIN{fail=1}
+$1==t{fail=0}
+END{exit fail}' || {
+	exec 1>&2
+	echo "coraid-update Error: \"$ulb\" is not an AoE target"
+	echo "$usage"
+	exit 1
+}
+
+# it should have a size no larger than $max in /proc/partitions
+t="`echo $ulb | sed 's!^/dev/!!'`"
+awk -vt="$t" '$NF==t{print $3}' /proc/partitions |
+awk -vhi=$max -vdev="$ulb" '
+BEGIN{
+	err = "could not get size of " dev
+} {
+	err = "none"
+	if ($1 > hi) {
+		err = dev " is too large to be an update target"
+		exit
+	}
+} END{
+	if (err != "none") {
+		print "Error coraid-update: " err > "/dev/stderr"
+		exit 1
+	}
+	exit 0
+}' || exit 1
+
+# this test should be removed when it is performed on the appliance
+# 
+# For a 2734080-byte tarc file, an incomplete file of 2727450 bytes passes
+# this test, but one of 2727400 does not.  So this test isn't fullproof.
+# 
+if test "`echo \"$update\" | grep '\.tarc$'`"; then
+	tar tf "$update" > /dev/null 2>&1 || {
+		exec 1>&2
+		echo "coraid-update Error: \"$update\" does not appear to be a valid tarc file"
+		exit 1
+	}
+fi
+if test ! -r "$update"; then
+	echo "coraid-update Error: \"$update\" is not readable" 1>&2
+	exit 1
+fi
+
+# send it over and complain on error
+if ! dd if="$update" of="$ulb" 2> /dev/null || ! sync; then
+	exec 1>&2
+	echo "coraid-update Error: could not successfully write \"$update\" to \"$ulb\""
+	exit 1
+fi

+ 32 - 0
coraid-update.8

@@ -0,0 +1,32 @@
+.TH coraid-update 8
+.SH NAME
+coraid-update \- upload an update file to a Coraid appliance
+.SH SYNOPSIS
+.nf
+.B coraid-update {update file} {AoE device}
+.fi
+.SH DESCRIPTION
+The
+.I coraid-update
+script performs a few sanity checks before copying the local
+update
+file to the remote update AoE target on the Coraid appliance.
+.PP
+Two arguments are provided: 1) the name of the update file
+to be uploaded, and 2) the special block device file corresponding
+to the
+update target, e.g., \fI/dev/etherd/e100.40\fP.
+.PP
+It generates no output and exits with a zero status when the update
+file has been successfully uploaded 
+to the update target on the appliance.  Otherwise, an error message is
+printed to standard error and \fI coraid-update\fR exits with a
+non-zero status.
+.SH "SEE ALSO"
+.IR aoe-discover (8),
+.IR aoe-interfaces (8),
+.IR aoe-stat (8),
+.IR aoetools (8),
+.IR udev (7).
+.SH AUTHOR
+Ed L. Cashin (ecashin@coraid.com)

+ 2 - 2
dat.h

@@ -1,5 +1,5 @@
 /* dat.h - aoetools type definitions and macros
- * Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+ * Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
  */
 
 #define	nil	NULL
@@ -56,7 +56,7 @@ struct Conf {
 	Aoehdr	h;
 	u16	bufcnt;
 	u16	firmware;
-	uchar	filler;
+	uchar	scnt;
 	uchar	vercmd;
 	u16	len;
 	uchar	data[1024];

+ 1 - 1
fns.h

@@ -1,4 +1,4 @@
-/* Copyright 2007, Coraid, Inc., and licensed under GPL v.2. */
+/* Copyright 2008, Coraid, Inc., and licensed under GPL v.2. */
 int dial(char *eth);
 int getea(int s, char *name, uchar *ea);
 

+ 1 - 1
linux.c

@@ -1,5 +1,5 @@
 /* linux.c: low level access routines for Linux
- * Copyright 2007, Coraid, Inc., and licensed under GPL v.2.
+ * Copyright 2008, Coraid, Inc., and licensed under GPL v.2.
  */
 #include "config.h"
 #include <sys/socket.h>

+ 33 - 0
sos-linux

@@ -0,0 +1,33 @@
+#! /bin/sh
+
+me="`basename $0`"
+outf="$HOME/sos-linux-`date +%Y%m%d-%H%M%S`.out"
+
+if test "`whoami`" != "root"; then
+	echo "$me: please run $me as root" 1>&2
+	exit 1
+fi
+echo "$me: output file is $outf"
+
+exec > $outf
+exec 2>&1
+set -x
+uname -a
+grep . /etc/*release*
+find /sys/module/aoe -name version | xargs cat
+cat /proc/mounts
+aoe-version
+aoe-stat
+cat /proc/mdstat
+pvs
+ifconfig -a
+free
+dmesg | tail -n 50
+lspci
+grep . /sys/block/etherd\!e*.*/debug
+set +x
+for i in `aoe-stat | awk '{print $3}' | sed 's!,! !g'`; do
+	echo ethtool -S $i
+done | sort | uniq | sh -x
+# top -b -n 1
+grep . /sys/block/etherd*/debug /dev/null

+ 22 - 0
sos-linux.8

@@ -0,0 +1,22 @@
+.TH sos-linux 8
+.SH NAME
+sos-linux \- create file containing AoE-related information
+.SH SYNOPSIS
+.nf
+.B sos-linux
+.fi
+.SH DESCRIPTION
+The
+.I sos-linux
+script creates a dated output file in the home directory of the user
+running it.
+.PP
+The filename is printed on the standard output.
+.PP
+The file contains information about the local system that is likely
+to be relevant to its use as an AoE initiator.
+.SH "SEE ALSO"
+.IR aoe-stat (8),
+.IR aoetools (8).
+.SH AUTHOR
+Ed L. Cashin (ecashin@coraid.com)