struct lustre_cfg_bufs bufs;
struct lustre_cfg * lcfg = NULL;
int err;
+
+ CDEBUG(D_ERROR, "lcfg %s %#x %s %s %s %s\n", cfgname, cmd, s1, s2, s3, s4);
lustre_cfg_bufs_reset(&bufs, cfgname);
if (s1)
GOTO(out_free, err);
/* Start the MGC */
- if ((err = lustre_start_simple(mgcname, LUSTRE_MGC_NAME, "MGS",
+ if ((err = lustre_start_simple(mgcname, LUSTRE_MDC_NAME/*LUSTRE_MGC_NAME*/, "MGS",
libcfs_nid2str(nid))))
GOTO(out_dereg, err);
/* Add the redundant MGS's */
- for (i = i; i < sbi->lsi_lmd->lmd_mgsnid_count; i++) {
+ for (i = 1; i < sbi->lsi_lmd->lmd_mgsnid_count; i++) {
nid = sbi->lsi_lmd->lmd_mgsnid[i];
err = do_lcfg(mgcname, nid, LCFG_ADD_UUID, libcfs_nid2str(nid),
0, 0, 0);
}
sbi->lsi_mgc = obd;
- /* Get a new index if needed */
- if (sbi->lsi_ldd->ldd_flags & LDD_F_NEED_INDEX) {
- // FIXME implement
- CERROR("Need new server index from MGS!\n");
- // rewrite last_rcvd, ldd (for new svname)
- }
-
out_free:
OBD_FREE(mgcname, mgcname_size);
out:
LASSERT(obd);
CERROR("starting target %s\n", sbi->lsi_ldd->ldd_svname);
+
+ /* Get a new index if needed */
+ if (sbi->lsi_ldd->ldd_flags & LDD_F_NEED_INDEX) {
+ // FIXME implement
+ CERROR("Need new target index from MGS!\n");
+ // FIXME rewrite last_rcvd, ldd (for new svname)
+ }
/* The MGC starts targets using the svname llog */
ioc_data.ioc_inllen1 = strlen(sbi->lsi_ldd->ldd_svname) + 1;
/* mount to read server info */
mnt = lustre_kern_mount(sb);
if (IS_ERR(mnt)) {
+ err = PTR_ERR(mnt);
CERROR("Unable to mount device %s: %d\n",
sbi->lsi_lmd->lmd_dev, err);
- GOTO(out, err = PTR_ERR(mnt));
+ GOTO(out, err);
}
LASSERT(sbi->lsi_ldd);
CERROR("Found service %s for fs %s on device %s\n",
err = lustre_start_mgc(sb, mnt);
if (err)
GOTO(out_dereg, err);
-
+
/* Set up all obd devices for service */
err = server_start_targets(sb);
if (err < 0) {
LCONSOLE_ERROR("Too many NIDs: '%s'\n", s1);
goto invalid;
}
- lmd->lmd_mgsnid[lmd->lmd_mgsnid_count++] = libcfs_str2nid(s1);
+ lmd->lmd_mgsnid[lmd->lmd_mgsnid_count++] = nid;
s1 = s2 + 1;
}
#include <getopt.h>
#include <sys/utsname.h>
-#include <linux/lustre_disk.h>
-//#include <portals/ptlctl.h>
#include "obdctl.h"
int verbose;
void usage(FILE *out)
{
fprintf(out, "%s v1.%d\n", progname, LMD_MAGIC & 0xFF);
- fprintf(out, "usage: %s <mdsnode>:/<mdsname>/<cfgname> <mountpt> "
+ fprintf(out, "usage: %s <mgmtnid>[:<altmgtnid>...]:/<filesystem>[/<cfgname>] <mountpt> "
"[-fhnv] [-o mntopt]\n", progname);
fprintf(out, "\t<mdsnode>: nid of MDS (config) node\n"
- "\t<mdsname>: name of MDS service (e.g. mds1)\n"
+ "\t<filesystem>: name of the Lustre filesystem (e.g. lustre1)\n"
"\t<cfgname>: name of client config (e.g. client)\n"
"\t<mountpt>: filesystem mountpoint (e.g. /mnt/lustre)\n"
"\t-f|--fake: fake mount (updates /etc/mtab)\n"
exit((out != stdout) ? EINVAL : 0);
}
-static int load_module(char *module_name)
-{
- char buf[256];
- int rc;
-
- if (verbose)
- printf("loading %s\n", module_name);
- sprintf(buf, "/sbin/modprobe %s", module_name);
- rc = system(buf);
- if (rc) {
- fprintf(stderr, "%s: failed to modprobe %s: %s\n",
- progname, module_name, strerror(errno));
- fprintf(stderr, "Check /etc/modules.conf\n");
- }
- return rc;
-}
-
-static int load_modules()
-{
- int rc = 0;
-
- rc = load_module("lustre");
- rc = load_module("mds");
- rc = load_module("ost");
- return rc;
-}
-
static int check_mtab_entry(char *spec, char *mtpt, char *type)
{
FILE *fp;
return rc;
}
+/* Get rid of symbolic hostnames for tcp */
+#define MAXNIDSTR 256
+static char *convert_hostnames(char *s1)
+{
+ char *converted, *s2, *c;
+ int left = MAXNIDSTR;
+ lnet_nid_t nid;
+
+ converted = malloc(left);
+ c = converted;
+ while ((left > 0) && ((s2 = strsep(&s1, ",:")))) {
+ nid = libcfs_str2nid(s2);
+ if (nid == LNET_NID_ANY) {
+ if (*s2 == '/')
+ /* end of nids */
+ break;
+ fprintf(stderr, "%s: Can't parse NID '%s'\n",
+ progname, s2);
+ free(converted);
+ return NULL;
+ }
+ if (LNET_NETTYP(LNET_NIDNET(nid)) == SOCKLND) {
+ __u32 addr = LNET_NIDADDR(nid);
+ c += snprintf(c, left, "%u.%u.%u.%u@%s%u:",
+ (addr >> 24) & 0xff, (addr >> 16) & 0xff,
+ (addr >> 8) & 0xff, addr & 0xff,
+ libcfs_lnd2str(SOCKLND),
+ LNET_NETNUM(LNET_NIDNET(nid)));
+ } else {
+ c += snprintf(converted, left, "%s:", s2);
+ }
+ left = converted + MAXNIDSTR - c;
+ }
+ snprintf(c, left, "%s", s2);
+ return converted;
+}
/*****************************************************************************
*
progname = strrchr(argv[0], '/');
progname = progname ? progname + 1 : argv[0];
- printf("starting %s\n", progname);
-
while ((opt = getopt_long(argc, argv, "fhno:v",
long_opt, NULL)) != EOF){
switch (opt) {
usage(stderr);
}
- source = argv[optind];
+ source = convert_hostnames(argv[optind]);
target = argv[optind + 1];
+ if (!source) {
+ usage(stderr);
+ }
+
if (verbose) {
for (i = 0; i < argc; i++)
printf("arg[%d] = %s\n", i, argv[i]);
return rc;
}
- /* FIXME remove */
- if ((rc = load_modules())) {
- return rc;
- }
-
/* In Linux 2.4, the target device doesn't get passed to any of our
functions. So we'll stick it on the end of the options. */
- optlen = strlen(options) + strlen(",device=") + strlen(target);
+ optlen = strlen(options) + strlen(",device=") + strlen(source);
optcopy = malloc(optlen);
strcpy(optcopy, options);
strcat(optcopy, ",device=");
}
free(optcopy);
+ free(source);
return rc;
}