MGS/MDT: \fIerrors=remount-ro,iopen_nopriv,user_xattr\fR.
\fBDO NOT\fR alter the default mount options unless you know what you are doing.
.TP
+.BI \--network= net,...
+Network(s) to restrict this ost/mdt to. This option can be repeated as desired.
+.TP
.BI \--mgsnode= nid,...
Set the NID(s) of the MGS node, required for all targets other than the MGS.
.TP
MGS/MDT: \fIerrors=remount-ro,iopen_nopriv,user_xattr\fR.
\fBDO NOT\fR alter the default mount options unless you know what you are doing.
.TP
+.BI \--network= net,...
+Network(s) to restrict this ost/mdt to. This option can be repeated as desired.
+.TP
.BI \--mgs
Add a configuration management service to this target
.TP
int class_get_next_param(char **params, char *copy);
int class_match_param(char *buf, char *key, char **valp);
int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh);
+int class_parse_net(char *buf, __u32 *net, char **endh);
+int class_match_net(char *buf, lnet_nid_t nid);
/* obd_mount.c */
int do_lcfg(char *cfgname, lnet_nid_t nid, int cmd,
char *s1, char *s2, char *s3, char *s4);
#define PARAM_FAILNODE "failover.node=" /* add failover nid */
#define PARAM_FAILMODE "failover.mode=" /* initial mount only */
#define PARAM_ACTIVE "active=" /* activate/deactivate */
+#define PARAM_NETWORK "network=" /* bind on nid */
/* Prefixes for parameters handled by obd's proc methods (XXX_process_config) */
#define PARAM_OST "ost."
return 0;
}
+static int parse_nid(char *buf, void *value)
+{
+ lnet_nid_t *nid = (lnet_nid_t *)value;
+
+ *nid = libcfs_str2nid(buf);
+ if (*nid != LNET_NID_ANY)
+ return 0;
+
+ LCONSOLE_ERROR_MSG(0x159, "Can't parse NID '%s'\n", buf);
+ return -EINVAL;
+}
+
+static int parse_net(char *buf, void *value)
+{
+ __u32 *net = (__u32 *)net;
+
+ *net = libcfs_str2net(buf);
+ CDEBUG(D_INFO, "Net %s\n", libcfs_net2str(*net));
+ return 0;
+}
+
+enum {
+ CLASS_PARSE_NID = 1,
+ CLASS_PARSE_NET,
+};
+
/* 0 is good nid,
1 not found
< 0 error
endh is set to next separator */
-int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh)
+static int class_parse_value(char *buf, int opc, void *value, char **endh)
{
- char tmp, *endp;
+ char *endp;
+ char tmp;
+ int rc = 0;
if (!buf)
return 1;
tmp = *endp;
*endp = '\0';
- *nid = libcfs_str2nid(buf);
- if (*nid == LNET_NID_ANY) {
- LCONSOLE_ERROR_MSG(0x159, "Can't parse NID '%s'\n", buf);
- *endp = tmp;
- return -EINVAL;
+ switch (opc) {
+ default:
+ LBUG();
+ case CLASS_PARSE_NID:
+ rc = parse_nid(buf, value);
+ break;
+ case CLASS_PARSE_NET:
+ rc = parse_net(buf, value);
+ break;
}
*endp = tmp;
-
+ if (rc != 0)
+ return rc;
if (endh)
*endh = endp;
- CDEBUG(D_INFO, "Nid %s\n", libcfs_nid2str(*nid));
+ return 0;
+}
+
+int class_parse_nid(char *buf, lnet_nid_t *nid, char **endh)
+{
+ return class_parse_value(buf, CLASS_PARSE_NID, (void *)nid, endh);
+}
+
+int class_parse_net(char *buf, __u32 *net, char **endh)
+{
+ return class_parse_value(buf, CLASS_PARSE_NET, (void *)net, endh);
+}
+
+int class_match_net(char *buf, lnet_nid_t nid)
+{
+ __u32 net;
+
+ while (class_find_param(buf, PARAM_NETWORK, &buf) == 0) {
+ /* please restrict to the nids pertaining to
+ * the specified networks */
+ while (class_parse_net(buf, &net, &buf) == 0) {
+ if (LNET_NIDNET(nid) == net)
+ return 1;
+ }
+ }
return 0;
}
EXPORT_SYMBOL(class_get_next_param);
EXPORT_SYMBOL(class_match_param);
EXPORT_SYMBOL(class_parse_nid);
+EXPORT_SYMBOL(class_parse_net);
+EXPORT_SYMBOL(class_match_net);
/********************** class fns **********************/
struct lustre_sb_info *lsi = s2lsi(sb);
struct lustre_disk_data *ldd = lsi->lsi_ldd;
lnet_process_id_t id;
- int i = 0;
+ int i = 0;
ENTRY;
if (!(lsi->lsi_flags & LSI_SERVER))
while (LNetGetId(i++, &id) != -ENOENT) {
if (LNET_NETTYP(LNET_NIDNET(id.nid)) == LOLND)
continue;
+
+ if (class_find_param(ldd->ldd_params,
+ PARAM_NETWORK, NULL) == 0 &&
+ !class_match_net(ldd->ldd_params, id.nid)) {
+ /* can't match specified network */
+ continue;
+ }
+
mti->mti_nids[mti->mti_nid_count] = id.nid;
mti->mti_nid_count++;
if (mti->mti_nid_count >= MTI_NIDS_MAX) {
*/
"\t\t--comment=<user comment>: arbitrary user string (%d bytes)\n"
"\t\t--mountfsoptions=<opts> : permanent mount options\n"
+ "\t\t--network=<net>[,<...>] : network(s) to restrict this ost/mdt to\n"
#ifndef TUNEFS
"\t\t--backfstype=<fstype> : backing fs type (ext3, ldiskfs)\n"
"\t\t--device-size=#N(KB) : device size for loop devices\n"
{"verbose", 0, 0, 'v'},
{"writeconf", 0, 0, 'w'},
{"upgrade_to_18", 0, 0, 'U'},
+ {"network", 1, 0, 't'},
{0, 0, 0, 0}
};
char *optstring = "b:c:C:d:ef:Ghi:k:L:m:MnNo:Op:Pqru:vw";
case 'r':
mop->mo_flags |= MO_FORCEFORMAT;
break;
+ case 't':
+ if (!IS_MDT(&mop->mo_ldd) && !IS_OST(&mop->mo_ldd)) {
+ badopt(long_opt[longidx].name, "MDT,OST");
+ return 1;
+ }
+
+ if (!optarg)
+ return 1;
+
+ rc = add_param(mop->mo_ldd.ldd_params,
+ PARAM_NETWORK, optarg);
+ if (rc != 0)
+ return rc;
+ /* Must update the mgs logs */
+ mop->mo_ldd.ldd_flags |= LDD_F_UPDATE;
+ break;
case 'u':
strscpy(mop->mo_ldd.ldd_userdata, optarg,
sizeof(mop->mo_ldd.ldd_userdata));