X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lnet%2Futils%2Flnetctl.c;fp=lnet%2Futils%2Flnetctl.c;h=97515e1544895abac27dcc2ea322f24f57c7a9f8;hb=bbb3a875717f159c4a99eccebf0c28f30459da4f;hp=631c18e5273fa0e93d227ffef0f24e71a1baeb5e;hpb=adb73693529da52741af7f20b4ab8229e47e6713;p=fs%2Flustre-release.git diff --git a/lnet/utils/lnetctl.c b/lnet/utils/lnetctl.c index 631c18e..97515e1 100644 --- a/lnet/utils/lnetctl.c +++ b/lnet/utils/lnetctl.c @@ -66,6 +66,7 @@ static int jt_set_discovery(int argc, char **argv); 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); @@ -108,7 +109,7 @@ command_t cmd_list[] = { {"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"}, @@ -270,6 +271,8 @@ command_t udsp_cmds[] = { "\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 } }; @@ -2143,6 +2146,45 @@ static int jt_add_udsp(int argc, char **argv) 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 */