static int jt_set_drop_asym_route(int argc, char **argv);
static int jt_list_peer(int argc, char **argv);
static int jt_add_udsp(int argc, char **argv);
+static int jt_del_udsp(int argc, char **argv);
/*static int jt_show_peer(int argc, char **argv);*/
static int lnetctl_list_commands(int argc, char **argv);
static int jt_import(int argc, char **argv);
{"ping", jt_ping, 0, "ping nid,[nid,...]"},
{"discover", jt_discover, 0, "discover nid[,nid,...]"},
{"service-id", jt_calc_service_id, 0, "Calculate IB Lustre service ID\n"},
- {"udsp", jt_udsp, 0, "udsp {add | help}"},
+ {"udsp", jt_udsp, 0, "udsp {add | del | help}"},
{"help", Parser_help, 0, "help"},
{"exit", Parser_quit, 0, "quit"},
{"quit", Parser_quit, 0, "quit"},
"\t--priority: priority value (0 - highest priority)\n"
"\t--idx: index of where to insert the rule.\n"
"\t By default, appends to the end of the rule list.\n"},
+ {"del", jt_del_udsp, 0, "delete a udsp\n"
+ "\t--idx: index of the Policy.\n"},
{ 0, 0, 0, NULL }
};
return rc;
}
+static int jt_del_udsp(int argc, char **argv)
+{
+ struct cYAML *err_rc = NULL;
+ long int idx = 0;
+ int opt, rc = 0;
+
+ const char *const short_options = "i:";
+ static const struct option long_options[] = {
+ { .name = "idx", .has_arg = required_argument, .val = 'i' },
+ { .name = NULL } };
+
+ rc = check_cmd(udsp_cmds, "udsp", "del", 0, argc, argv);
+ if (rc)
+ return rc;
+
+ while ((opt = getopt_long(argc, argv, short_options,
+ long_options, NULL)) != -1) {
+ switch (opt) {
+ case 'i':
+ rc = parse_long(optarg, &idx);
+ if (rc != 0)
+ idx = 0;
+ break;
+ case '?':
+ print_help(udsp_cmds, "udsp", "add");
+ default:
+ return 0;
+ }
+ }
+
+ rc = lustre_lnet_del_udsp(idx, -1, &err_rc);
+ if (rc != LUSTRE_CFG_RC_NO_ERR)
+ cYAML_print_tree2file(stderr, err_rc);
+
+ cYAML_free_tree(err_rc);
+
+ return rc;
+}
+
static int lnetctl_list_commands(int argc, char **argv)
{
char buffer[81] = ""; /* 80 printable chars + terminating NUL */