Whamcloud - gitweb
LU-9120 lnet: set retry count from lnetctl
[fs/lustre-release.git] / lnet / utils / lnetctl.c
index e14d43e..27ba97d 100644 (file)
@@ -53,6 +53,7 @@ static int jt_set_tiny(int argc, char **argv);
 static int jt_set_small(int argc, char **argv);
 static int jt_set_large(int argc, char **argv);
 static int jt_set_numa(int argc, char **argv);
+static int jt_set_retry_count(int argc, char **argv);
 static int jt_add_peer_nid(int argc, char **argv);
 static int jt_del_peer_nid(int argc, char **argv);
 static int jt_set_max_intf(int argc, char **argv);
@@ -174,6 +175,9 @@ command_t set_cmds[] = {
        {"discovery", jt_set_discovery, 0, "enable/disable peer discovery\n"
         "\t0 - disable peer discovery\n"
         "\t1 - enable peer discovery (default)\n"},
+       {"retry_count", jt_set_retry_count, 0, "number of retries\n"
+        "\t0 - turn of retries\n"
+        "\t>0 - number of retries\n"},
        { 0, 0, 0, NULL }
 };
 
@@ -328,6 +332,34 @@ static int jt_set_numa(int argc, char **argv)
        return rc;
 }
 
+static int jt_set_retry_count(int argc, char **argv)
+{
+       long int value;
+       int rc;
+       struct cYAML *err_rc = NULL;
+
+       rc = check_cmd(set_cmds, "set", "retry_count", 2, argc, argv);
+       if (rc)
+               return rc;
+
+       rc = parse_long(argv[1], &value);
+       if (rc != 0) {
+               cYAML_build_error(-1, -1, "parser", "set",
+                                 "cannot parse retry_count value", &err_rc);
+               cYAML_print_tree2file(stderr, err_rc);
+               cYAML_free_tree(err_rc);
+               return -1;
+       }
+
+       rc = lustre_lnet_config_retry_count(value, -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 jt_set_discovery(int argc, char **argv)
 {
        long int value;
@@ -980,6 +1012,12 @@ static int jt_show_global(int argc, char **argv)
                goto out;
        }
 
+       rc = lustre_lnet_show_retry_count(-1, &show_rc, &err_rc);
+       if (rc != LUSTRE_CFG_RC_NO_ERR) {
+               cYAML_print_tree2file(stderr, err_rc);
+               goto out;
+       }
+
        if (show_rc)
                cYAML_print_tree(show_rc);