From 430caae7b4f34df9f5cb7410118a7e02227defad Mon Sep 17 00:00:00 2001 From: nathan Date: Wed, 21 Jun 2006 16:59:51 +0000 Subject: [PATCH] Branch b1_5 b=9860 a little safer and more verbose upgrade script --- lustre/scripts/lustre_up14.sh | 26 ++++++++++++++++++-------- lustre/utils/mount_lustre.c | 21 ++++++++++++++------- 2 files changed, 32 insertions(+), 15 deletions(-) diff --git a/lustre/scripts/lustre_up14.sh b/lustre/scripts/lustre_up14.sh index 0341783..9027237 100755 --- a/lustre/scripts/lustre_up14.sh +++ b/lustre/scripts/lustre_up14.sh @@ -4,7 +4,7 @@ # ############################################################################### -TMP=/tmp/logs +TMP=${TMP:-/tmp/logs} # Usage usage() { @@ -15,9 +15,13 @@ Usage: `basename $0` the MDS disk device (e.g. /dev/sda1) the name of the new filesystem (e.g. testfs) - This program will copy old config logs from an MDS device to - a temporary location ($TMP), from where they can be added to - the CONFIGS directory on an MGS during the upgrade procedure. + This script will extract old config logs from an MDS device to a + temporary location ($TMP). During the upgrade procedure, mount the + MGS disk as type ldiskfs (e.g. mount -t ldiskfs /dev/sda + /mnt/temp), then copy these logs into the CONFIGS directory on the + MGS (e.g. /mnt/temp/CONFIGS). Logs from many MDS's can be added + in this way. When done, unmount the MGS, and then re-mount it as + type lustre to start the service. EOF exit 1 @@ -36,13 +40,19 @@ FILES=`$DEBUGFS "ls -l LOGS" $DEV | awk '{print $9}' | awk '/[a-z]/ {print $1}'` for FILE in ${FILES}; do $DEBUGFS "dump LOGS/$FILE $TMP/temp" $DEV 2> /dev/null - CLI=`strings $TMP/temp | grep MDC` - if [ -n "$CLI" ]; then + MDC=`strings $TMP/temp | grep MDC` + LOV=`strings $TMP/temp | grep lov` + if [ -n "$MDC" ]; then TYPE=client else - TYPE=MDT0000 + if [ -n "$LOV" ]; then + TYPE=MDT0000 + else + echo "Can't determine type for log '$FILE', skipping" + continue + fi fi - echo -n "Copying log $FILE to ${FSNAME}-${TYPE}. Okay [y/n]?" + echo -n "Copying log '$FILE' to '${FSNAME}-${TYPE}'. Okay [y/n]?" read OK if [ "$OK" = "y" ]; then mv $TMP/temp $TMP/${FSNAME}-${TYPE} diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index cc336e1..5b6899f 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -371,6 +371,12 @@ int main(int argc, char *const argv[]) rc = mount(source, target, "lustre", flags, (void *)optcopy); if (rc) { + char *cli = strrchr(source, ':'); + if (cli && (strlen(cli) > 2)) + cli += 2; + else + cli = NULL; + fprintf(stderr, "%s: mount %s at %s failed: %s\n", progname, source, target, strerror(errno)); if (errno == ENODEV) @@ -383,9 +389,12 @@ int main(int argc, char *const argv[]) if (errno == ENOMEDIUM) fprintf(stderr, "This filesystem needs at least 1 OST\n"); - if (errno == ENOENT) - fprintf(stderr, "Is the MGS specification correct? Is " - "the filesystem name correct?\n"); + if (errno == ENOENT) { + fprintf(stderr, "Is the MGS specification correct?\n"); + fprintf(stderr, "Is the filesystem name correct?\n"); + fprintf(stderr, "If upgrading, is the copied client log" + " valid? (see upgrade docs)\n"); + } if (errno == EALREADY) fprintf(stderr, "The target service is already running." " (%s)\n", source); @@ -399,12 +408,10 @@ int main(int argc, char *const argv[]) fprintf(stderr, "The target service's index is already " "in use. (%s)\n", source); if (errno == EINVAL) { - char *ptr = strrchr(source, ':'); fprintf(stderr, "This may have multiple causes.\n"); - if (ptr && (strlen(ptr) > 2)) - /* client */ + if (cli) fprintf(stderr, "Is '%s' the correct filesystem" - " name?\n", ptr + 2); + " name?\n", cli); fprintf(stderr, "Are the mount options correct?\n"); fprintf(stderr, "Check the syslog for more info.\n"); } -- 1.8.3.1