From d19b4818efeaf14881c62ff7ce0fb8452808690d Mon Sep 17 00:00:00 2001 From: ericm Date: Thu, 13 Nov 2003 06:56:20 +0000 Subject: [PATCH] liblustre: - adjust the way of zeroconf - bring lltest/recovery_small to zeroconf --- lustre/liblustre/recovery_small.c | 34 ++++++++++++++++++++++++---------- lustre/liblustre/test_common.h | 4 ++++ lustre/utils/lrun | 6 +++--- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/lustre/liblustre/recovery_small.c b/lustre/liblustre/recovery_small.c index 700faa8..578480e 100644 --- a/lustre/liblustre/recovery_small.c +++ b/lustre/liblustre/recovery_small.c @@ -301,34 +301,48 @@ extern void __liblustre_cleanup_(void); void usage(const char *cmd) { - printf("Usage: %s -s server_name [-c config_file]\n", cmd); + printf("Usage: \t%s -s mds_hostname --target mdsnid:/mdsname/profile\n", cmd); + printf(" \t%s -s mds_hostname --dumpfile dumpfile\n", cmd); + exit(-1); } int main(int argc, char * argv[]) { - int c; + int opt_index, c; char cmd[1024]; + static struct option long_opts[] = { + {"target", 1, 0, 0}, + {"dumpfile", 1, 0, 0}, + {0, 0, 0, 0} + }; - setenv("LIBLUSTRE_USE_ZCONF", "no", 1); + if (argc < 3) + usage(argv[0]); - while ((c = getopt(argc, argv, "c:s:")) != -1) { + while ((c = getopt_long(argc, argv, "s:", long_opts, &opt_index)) != -1) { switch (c) { - case 'c': - setenv("LIBLUSTRE_CONFIG_FILE", optarg, 1); + case 0: { + if (!optarg[0]) + usage(argv[0]); + + if (!strcmp(long_opts[opt_index].name, "target")) { + setenv(ENV_LUSTRE_MNTTGT, optarg, 1); + } else if (!strcmp(long_opts[opt_index].name, "dumpfile")) { + setenv(ENV_LUSTRE_DUMPFILE, optarg, 1); + } else + usage(argv[0]); break; + } case 's': strcpy(mds_server, optarg); break; default: usage(argv[0]); - exit(-1); } } - if (argc < 2 || optind != argc) { + if (optind != argc) usage(argv[0]); - exit(-1); - } sprintf(cmd, "ssh %s cat /dev/null", mds_server); if (system(cmd)) { diff --git a/lustre/liblustre/test_common.h b/lustre/liblustre/test_common.h index 416e100..6628b4d 100644 --- a/lustre/liblustre/test_common.h +++ b/lustre/liblustre/test_common.h @@ -1,6 +1,10 @@ #ifndef __TEST_COMMON__H #define __TEST_COMMON__H +#define ENV_LUSTRE_MNTPNT "LIBLUSTRE_MOUNT_POINT" +#define ENV_LUSTRE_MNTTGT "LIBLUSTRE_MOUNT_TARGET" +#define ENV_LUSTRE_DUMPFILE "LIBLUSTRE_DUMPFILE" + extern int exit_on_err; void t_touch(const char *path); diff --git a/lustre/utils/lrun b/lustre/utils/lrun index 3f96820..b7dc796 100755 --- a/lustre/utils/lrun +++ b/lustre/utils/lrun @@ -1,8 +1,8 @@ #!/bin/sh -LUSTRE_MOUNT_POINT=${LUSTRE_MOUNT_POINT:-"/mnt/lustre"} -LIBLUSTRE_USE_ZCONF="no" -LUSTRE_CONFIG_FILE=${LUSTRE_CONFIG_FILE:-"/tmp/DUMP_FILE"} +LIBLUSTRE_MOUNT_POINT=${LIBLUSTRE_MOUNT_POINT:-"/mnt/lustre"} +LIBLUSTRE_MOUNT_TARGET=${LIBLUSTRE_MOUNT_TARGET:-""} +LIBLUSTRE_DUMPFILE=${LIBLUSTRE_DUMPFILE:-"/tmp/DUMP_FILE"} LD_PRELOAD=${LD_PRELOAD:-"/usr/lib/liblustre.so"} export LUSTRE_MOUNT_POINT -- 1.8.3.1