/* Ensure this is not a failover node that is connecting first*/
static int mgs_check_failover_reg(struct mgs_target_info *mti)
{
- lnet_nid_t nid;
+ struct lnet_nid nid;
char *ptr;
int i;
ptr = mti->mti_params;
while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) {
- while (class_parse_nid4_quiet(ptr, &nid, &ptr) == 0) {
+ while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
for (i = 0; i < mti->mti_nid_count; i++) {
- if (nid == mti->mti_nids[i]) {
+ struct lnet_nid nid2;
+
+ lnet_nid4_to_nid(mti->mti_nids[i], &nid2);
+ if (nid_same(&nid, &nid2)) {
LCONSOLE_WARN("Denying initial registration attempt from nid %s, specified as failover\n",
- libcfs_nid2str(nid));
+ libcfs_nidstr(&nid));
return -EADDRNOTAVAIL;
}
}
struct mgs_replace_data *mrd)
{
int nids_added = 0;
- lnet_nid_t nid;
+ struct lnet_nid nid;
char *ptr;
int rc = 0;
/* LCFG_ADD_UUID command found. Let's skip original command
and add passed nids */
ptr = mrd->target.mti_params;
- while (class_parse_nid4(ptr, &nid, &ptr) == 0) {
- struct lnet_nid lnid;
-
+ while (class_parse_nid(ptr, &nid, &ptr) == 0) {
if (!mrd->nodeuuid) {
rc = name_create(&mrd->nodeuuid,
- libcfs_nid2str(nid), "");
+ libcfs_nidstr(&nid), "");
if (rc) {
CERROR("Can't create uuid for "
"nid %s, device %s\n",
- libcfs_nid2str(nid),
+ libcfs_nidstr(&nid),
mrd->target.mti_svname);
return rc;
}
}
- CDEBUG(D_MGS, "add nid %s with uuid %s, "
- "device %s\n", libcfs_nid2str(nid),
- mrd->target.mti_params,
- mrd->nodeuuid);
- lnet_nid4_to_nid(nid, &lnid);
+ CDEBUG(D_MGS, "add nid %s with uuid %s, device %s\n",
+ libcfs_nidstr(&nid),
+ mrd->target.mti_params,
+ mrd->nodeuuid);
rc = record_add_uuid(env,
- mrd->temp_llh, &lnid,
+ mrd->temp_llh, &nid,
mrd->nodeuuid);
if (rc)
CWARN("%s: Can't add nid %s for uuid %s :rc=%d\n",
mrd->target.mti_svname,
- libcfs_nid2str(nid),
+ libcfs_nidstr(&nid),
mrd->nodeuuid, rc);
else
nids_added++;
}
if (nids_added == 0) {
- CERROR("No new nids were added, nid %s with uuid %s, "
- "device %s\n", libcfs_nid2str(nid),
+ CERROR("No new nids were added, nid %s with uuid %s, device %s\n",
+ libcfs_nidstr(&nid),
mrd->nodeuuid ? mrd->nodeuuid : "NULL",
mrd->target.mti_svname);
name_destroy(&mrd->nodeuuid);
if (mrd->failover) {
ptr = mrd->failover;
- while (class_parse_nid4(ptr, &nid, &ptr) == 0) {
- struct lnet_nid lnid;
-
+ while (class_parse_nid(ptr, &nid, &ptr) == 0) {
if (mrd->nodeuuid == NULL) {
rc = name_create(&mrd->nodeuuid,
- libcfs_nid2str(nid),
+ libcfs_nidstr(&nid),
"");
if (rc)
return rc;
}
CDEBUG(D_MGS, "add nid %s for failover %s\n",
- libcfs_nid2str(nid), mrd->nodeuuid);
- lnet_nid4_to_nid(nid, &lnid);
- rc = record_add_uuid(env, mrd->temp_llh, &lnid,
+ libcfs_nidstr(&nid), mrd->nodeuuid);
+ rc = record_add_uuid(env, mrd->temp_llh, &nid,
mrd->nodeuuid);
if (rc) {
CWARN("%s: Can't add nid %s for failover %s :rc = %d\n",
mrd->target.mti_svname,
- libcfs_nid2str(nid),
+ libcfs_nidstr(&nid),
mrd->nodeuuid, rc);
name_destroy(&mrd->nodeuuid);
return rc;
{
char *failnodeuuid = NULL;
char *ptr = mti->mti_params;
- lnet_nid_t nid;
+ struct lnet_nid nid;
int rc = 0;
/*
/*
* Pull failnid info out of params string, which may contain something
- * like "<nid1>,<nid2>:<nid3>,<nid4>". class_parse_nid4() does not
+ * like "<nid1>,<nid2>:<nid3>,<nid4>". class_parse_nid() does not
* complain about abnormal inputs like ",:<nid1>", "<nid1>:,<nid2>",
* etc. However, convert_hostnames() should have caught those.
*/
while (class_find_param(ptr, PARAM_FAILNODE, &ptr) == 0) {
- while (class_parse_nid4(ptr, &nid, &ptr) == 0) {
+ while (class_parse_nid(ptr, &nid, &ptr) == 0) {
char nidstr[LNET_NIDSTR_SIZE];
- struct lnet_nid lnid;
if (failnodeuuid == NULL) {
/* We don't know the failover node name,
* so just use the first nid as the uuid */
- libcfs_nid2str_r(nid, nidstr, sizeof(nidstr));
+ libcfs_nidstr_r(&nid, nidstr, sizeof(nidstr));
rc = name_create(&failnodeuuid, nidstr, "");
if (rc != 0)
return rc;
}
CDEBUG(D_MGS,
"add nid %s for failover uuid %s, client %s\n",
- libcfs_nid2str_r(nid, nidstr, sizeof(nidstr)),
+ libcfs_nidstr_r(&nid, nidstr, sizeof(nidstr)),
failnodeuuid, cliname);
- lnet_nid4_to_nid(nid, &lnid);
- rc = record_add_uuid(env, llh, &lnid, failnodeuuid);
+ rc = record_add_uuid(env, llh, &nid, failnodeuuid);
/*
* If *ptr is ':', we have added all NIDs for
* failnodeuuid.
return rc;
}
+static int do_lcfg_nid(char *cfgname, struct lnet_nid *nid, int cmd,
+ char *s1)
+{
+ if (nid_is_nid4(nid))
+ return do_lcfg(cfgname, lnet_nid_to_nid4(nid), cmd, s1,
+ NULL, NULL, NULL);
+ return -EINVAL;
+}
+
/**
* Call class_attach and class_setup. These methods in turn call
* OBD type-specific methods.
struct obd_export *exp;
struct obd_uuid *uuid = NULL;
uuid_t uuidc;
- lnet_nid_t nid;
+ struct lnet_nid nid;
char nidstr[LNET_NIDSTR_SIZE];
char *mgcname = NULL, *niduuid = NULL, *mgssec = NULL;
char *ptr;
/* mount -o mgsnode=nid */
ptr = lsi->lsi_lmd->lmd_mgs;
if (lsi->lsi_lmd->lmd_mgs &&
- (class_parse_nid4(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) {
+ (class_parse_nid(lsi->lsi_lmd->lmd_mgs, &nid, &ptr) == 0)) {
i++;
} else if (IS_MGS(lsi)) {
struct lnet_processid id;
while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
if (nid_is_lo0(&id.nid))
continue;
- nid = lnet_nid_to_nid4(&id.nid);
+ nid = id.nid;
i++;
break;
}
} else { /* client */
/* Use NIDs from mount line: uml1,1@elan:uml2,2@elan:/lustre */
ptr = lsi->lsi_lmd->lmd_dev;
- if (class_parse_nid4(ptr, &nid, &ptr) == 0)
+ if (class_parse_nid(ptr, &nid, &ptr) == 0)
i++;
}
if (i == 0) {
mutex_lock(&mgc_start_lock);
- libcfs_nid2str_r(nid, nidstr, sizeof(nidstr));
+ libcfs_nidstr_r(&nid, nidstr, sizeof(nidstr));
len = strlen(LUSTRE_MGC_OBDNAME) + strlen(nidstr) + 1;
OBD_ALLOC(mgcname, len);
OBD_ALLOC(niduuid, len + 2);
struct lnet_processid id;
while ((rc = LNetGetId(i++, &id)) != -ENOENT) {
- rc = do_lcfg(mgcname, lnet_nid_to_nid4(&id.nid),
- LCFG_ADD_UUID,
- niduuid, NULL, NULL, NULL);
+ rc = do_lcfg_nid(mgcname, &id.nid,
+ LCFG_ADD_UUID,
+ niduuid);
}
} else {
/* Use mgsnode= nids */
* Multiple NIDs on one MGS node are separated
* by commas.
*/
- while (class_parse_nid4(ptr, &nid, &ptr) == 0) {
- rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID,
- niduuid, NULL, NULL, NULL);
+ while (class_parse_nid(ptr, &nid, &ptr) == 0) {
+ rc = do_lcfg_nid(mgcname, &nid,
+ LCFG_ADD_UUID,
+ niduuid);
if (rc == 0)
++i;
/* Stop at the first failover NID */
} else { /* client */
/* Use NIDs from mount line: uml1,1@elan:uml2,2@elan:/lustre */
ptr = lsi->lsi_lmd->lmd_dev;
- while (class_parse_nid4(ptr, &nid, &ptr) == 0) {
- rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID,
- niduuid, NULL, NULL, NULL);
+ while (class_parse_nid(ptr, &nid, &ptr) == 0) {
+ rc = do_lcfg_nid(mgcname, &nid, LCFG_ADD_UUID,
+ niduuid);
if (rc == 0)
++i;
/* Stop at the first failover NID */
/* New failover node */
sprintf(niduuid, "%s_%x", mgcname, i);
j = 0;
- while (class_parse_nid4_quiet(ptr, &nid, &ptr) == 0) {
- rc = do_lcfg(mgcname, nid, LCFG_ADD_UUID,
- niduuid, NULL, NULL, NULL);
+ while (class_parse_nid_quiet(ptr, &nid, &ptr) == 0) {
+ rc = do_lcfg_nid(mgcname, &nid, LCFG_ADD_UUID,
+ niduuid);
if (rc == 0)
++j;
if (*ptr == ':')
/* Collect multiple values for mgsnid specifiers */
static int lmd_parse_mgs(struct lustre_mount_data *lmd, char **ptr)
{
- lnet_nid_t nid;
+ struct lnet_nid nid;
char *tail = *ptr;
char *mgsnid;
int length;
int oldlen = 0;
/* Find end of NID-list */
- while (class_parse_nid4_quiet(tail, &nid, &tail) == 0)
+ while (class_parse_nid_quiet(tail, &nid, &tail) == 0)
; /* do nothing */
length = tail - *ptr;