"\t NID in the list becomes the Primary NID of a newly created\n"
"\t peer. \n"
"\t--nid: one or more peer NIDs\n"
- "\t--non_mr: create this peer as not Multi-Rail capable\n"},
+ "\t--non_mr: create this peer as not Multi-Rail capable\n"
+ "\t--ip2nets: specify a range of nids per peer"},
{"del", jt_del_peer_nid, 0, "delete a peer NID\n"
"\t--prim_nid: Primary NID of the peer.\n"
"\t--nid: list of NIDs to remove. If none provided,\n"
- "\t peer is deleted\n"},
+ "\t peer is deleted\n"
+ "\t--ip2nets: specify a range of nids per peer"},
{"show", jt_show_peer, 0, "show peer information\n"
"\t--nid: NID of peer to filter on.\n"
"\t--verbose: Include extended statistics\n"},
case 'h':
printf("export FILE\n"
"export > FILE : export configuration\n"
+ "\t--backup: export only what's necessary for reconfig\n"
"\t--help: display this help\n");
return 0;
default:
struct cYAML *err_rc = NULL;
int rc = LUSTRE_CFG_RC_NO_ERR, opt, i;
bool non_mr = false;
+ bool ip2nets = false, nid_list = false, prim_nid_present = false;
- const char *const short_options = "k:n:mh";
+ const char *const short_options = "k:n:i:mh";
const struct option long_options[] = {
{ "prim_nid", 1, NULL, 'k' },
{ "nid", 1, NULL, 'n' },
{ "non_mr", 0, NULL, 'm'},
{ "help", 0, NULL, 'h' },
+ { "ip2nets", 1, NULL, 'i' },
{ NULL, 0, NULL, 0 },
};
long_options, NULL)) != -1) {
switch (opt) {
case 'k':
+ prim_nid_present = true;
+ if (ip2nets) {
+ cYAML_build_error(-1, -1, "peer", "add",
+ "ip2nets can not be specified"
+ " along side prim_nid parameter.",
+ &err_rc);
+ goto failed;
+ }
prim_nid = optarg;
break;
+ case 'i':
case 'n':
+ if (opt == 'i')
+ ip2nets = true;
+
+ if (opt == 'n')
+ nid_list = true;
+
+ if (ip2nets && (nid_list || prim_nid_present)) {
+ cYAML_build_error(-1, -1, "peer", "add",
+ "ip2nets can not be specified"
+ " along side nid or prim_nid"
+ " parameters", &err_rc);
+ goto failed;
+ }
+
size = lustre_lnet_parse_nids(optarg, nids, size,
&nids2);
if (nids2 == NULL)
}
}
+ for (; optind < argc; optind++) {
+ size = lustre_lnet_parse_nids(argv[optind], nids, size,
+ &nids2);
+ if (nids2 == NULL)
+ goto failed;
+ nids = nids2;
+ }
+
rc = lustre_lnet_config_peer_nid(prim_nid, nids, size,
- !non_mr, -1, &err_rc);
+ !non_mr, ip2nets, -1, &err_rc);
failed:
if (nids) {
char **nids = NULL, **nids2 = NULL;
struct cYAML *err_rc = NULL;
int rc = LUSTRE_CFG_RC_NO_ERR, opt, i, size = 0;
+ bool ip2nets = false, nid_list = false, prim_nid_present = false;
- const char *const short_options = "k:n:h";
+ const char *const short_options = "k:n:i:h";
const struct option long_options[] = {
{ "prim_nid", 1, NULL, 'k' },
{ "nid", 1, NULL, 'n' },
{ "help", 0, NULL, 'h' },
+ { "ip2nets", 1, NULL, 'i' },
{ NULL, 0, NULL, 0 },
};
long_options, NULL)) != -1) {
switch (opt) {
case 'k':
+ prim_nid_present = true;
+ if (ip2nets) {
+ cYAML_build_error(-1, -1, "peer", "add",
+ "ip2nets can not be specified"
+ " along side prim_nid parameter.",
+ &err_rc);
+ goto failed;
+ }
prim_nid = optarg;
break;
+ case 'i':
case 'n':
+ if (opt == 'i')
+ ip2nets = true;
+
+ if (opt == 'n')
+ nid_list = true;
+
+ if (ip2nets && (nid_list || prim_nid_present)) {
+ cYAML_build_error(-1, -1, "peer", "add",
+ "ip2nets can not be specified"
+ " along side nid or prim_nid"
+ " parameters", &err_rc);
+ goto failed;
+ }
size = lustre_lnet_parse_nids(optarg, nids, size,
&nids2);
if (nids2 == NULL)
}
}
- rc = lustre_lnet_del_peer_nid(prim_nid, nids, size, -1, &err_rc);
+ for (; optind < argc; optind++) {
+ size = lustre_lnet_parse_nids(argv[optind], nids, size,
+ &nids2);
+ if (nids2 == NULL)
+ goto failed;
+ nids = nids2;
+ }
+
+ rc = lustre_lnet_del_peer_nid(prim_nid, nids, size, ip2nets, -1, &err_rc);
failed:
if (nids) {