X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fliblustre%2Ftests%2Frecovery_small.c;h=5e1da4ef06c10c44b6133dd6089ae22a8e5d3167;hb=fbf5870b9848929d352460f1f005b79c0b5ccc5a;hp=5aed06cabf1df919ff228eacac918b8b19026be8;hpb=090c677210ee2946d99c71412e4ff762bb300f4f;p=fs%2Flustre-release.git diff --git a/lustre/liblustre/tests/recovery_small.c b/lustre/liblustre/tests/recovery_small.c index 5aed06c..5e1da4e 100644 --- a/lustre/liblustre/tests/recovery_small.c +++ b/lustre/liblustre/tests/recovery_small.c @@ -1,24 +1,41 @@ /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*- * vim:expandtab:shiftwidth=8:tabstop=8: * - * Lustre Light user test program + * GPL HEADER START + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * - * Copyright (c) 2002, 2003 Cluster File Systems, Inc. + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * This file is part of Lustre, http://www.lustre.org. + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License version 2 for more details (a copy is included + * in the LICENSE file that accompanied this code). * - * Lustre is free software; you can redistribute it and/or - * modify it under the terms of version 2 of the GNU General Public - * License as published by the Free Software Foundation. + * You should have received a copy of the GNU General Public License + * version 2 along with this program; If not, see + * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * - * Lustre is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. + * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, + * CA 95054 USA or visit www.sun.com if you need additional information or + * have any questions. * - * You should have received a copy of the GNU General Public License - * along with Lustre; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * GPL HEADER END + */ +/* + * Copyright 2008 Sun Microsystems, Inc. All rights reserved + * Use is subject to license terms. + */ +/* + * This file is part of Lustre, http://www.lustre.org/ + * Lustre is a trademark of Sun Microsystems, Inc. + * + * lustre/liblustre/tests/recovery_small.c + * + * Lustre Light user test program */ #define _BSD_SOURCE @@ -39,6 +56,8 @@ #include "test_common.h" +#define MAX_STRING_SIZE 2048 + static struct { const char *name; unsigned long code; @@ -52,6 +71,7 @@ static struct { static int drop_index = 0; static char mds_server[1024] = {0, }; +static char ssh_cmd[MAX_STRING_SIZE] = {0,}; int do_stat(const char *name, struct stat *buf) { @@ -121,15 +141,15 @@ void cleanup_dir(const char *path) #define FAIL() \ do { \ - char cmd[1024]; \ + char cmd[MAX_STRING_SIZE]; \ int rc; \ \ if (drop_arr[drop_index].name) { \ printf("server drops next %s\n", drop_arr[drop_index].name); \ sprintf(cmd, \ - "ssh %s \"echo %lu > /proc/sys/lustre/fail_loc\"", \ - mds_server, drop_arr[drop_index].code); \ - if (system(cmd)) { \ + "%s %s \"echo %lu > /proc/sys/lustre/fail_loc\"", \ + ssh_cmd, mds_server, drop_arr[drop_index].code); \ + if ((rc = system(cmd))) { \ printf("error excuting remote command: %d\n", rc); \ exit(rc); \ } \ @@ -141,8 +161,8 @@ void cleanup_dir(const char *path) char cmd[1024]; \ \ if (drop_arr[drop_index].name) { \ - sprintf(cmd, "ssh %s \"echo 0 > /proc/sys/lustre/fail_loc\"", \ - mds_server); \ + sprintf(cmd, "%s %s \"echo 0 > /proc/sys/lustre/fail_loc\"", \ + ssh_cmd, mds_server); \ system(cmd); \ } \ } while (0) @@ -293,8 +313,8 @@ void t7() LEAVE(); } -extern int portal_debug; -extern int portal_subsystem_debug; +extern int libcfs_debug; +extern int libcfs_subsystem_debug; extern void __liblustre_setup_(void); extern void __liblustre_cleanup_(void); @@ -313,10 +333,11 @@ int main(int argc, char * argv[]) static struct option long_opts[] = { {"target", 1, 0, 0}, {"dumpfile", 1, 0, 0}, + {"ssh", 1, 0, 0}, {0, 0, 0, 0} }; - if (argc < 3) + if (argc < 3 - (getenv(ENV_LUSTRE_MNTTGT)||getenv(ENV_LUSTRE_DUMPFILE))) usage(argv[0]); while ((c = getopt_long(argc, argv, "s:", long_opts, &opt_index)) != -1) { @@ -329,12 +350,14 @@ int main(int argc, char * argv[]) setenv(ENV_LUSTRE_MNTTGT, optarg, 1); } else if (!strcmp(long_opts[opt_index].name, "dumpfile")) { setenv(ENV_LUSTRE_DUMPFILE, optarg, 1); + } else if (!strcmp(long_opts[opt_index].name, "ssh")) { + safe_strncpy(ssh_cmd, optarg, MAX_STRING_SIZE); } else usage(argv[0]); break; } case 's': - strcpy(mds_server, optarg); + safe_strncpy(mds_server, optarg, MAX_STRING_SIZE); break; default: usage(argv[0]); @@ -347,13 +370,18 @@ int main(int argc, char * argv[]) if (strlen(mds_server) == 0) usage(argv[0]); - sprintf(cmd, "ssh %s cat /dev/null", mds_server); + /* default to using ssh */ + if (!strlen(ssh_cmd)) { + safe_strncpy(ssh_cmd, "ssh", MAX_STRING_SIZE); + } + + sprintf(cmd, "%s %s cat /dev/null", ssh_cmd, mds_server); if (system(cmd)) { - printf("can't access server node: %s\n", mds_server); + printf("Can't access server node: %s using method: %s\n", mds_server, ssh_cmd); exit(-1); } - setenv(ENV_LUSTRE_TIMEOUT, "10", 1); + setenv(ENV_LUSTRE_TIMEOUT, "5", 1); __liblustre_setup_(); @@ -362,7 +390,9 @@ int main(int argc, char * argv[]) t2(); t3(); t4(); +#if 0 t5(); +#endif t6(); t7();