return rc;
}
+int lustre_lnet_config_hsensitivity(int sen, int seq_no, struct cYAML **err_rc)
+{
+ int rc = LUSTRE_CFG_RC_NO_ERR;
+ char err_str[LNET_MAX_STR_LEN];
+ char val[LNET_MAX_STR_LEN];
+
+ snprintf(err_str, sizeof(err_str), "\"success\"");
+
+ snprintf(val, sizeof(val), "%d", sen);
+
+ rc = write_sysfs_file(modparam_path, "lnet_health_sensitivity", val,
+ 1, strlen(val) + 1);
+ if (rc)
+ snprintf(err_str, sizeof(err_str),
+ "\"cannot configure health sensitivity: %s\"",
+ strerror(errno));
+
+ cYAML_build_error(rc, seq_no, ADD_CMD, "health_sensitivity", err_str, err_rc);
+
+ return rc;
+}
+
int lustre_lnet_config_transaction_to(int timeout, int seq_no, struct cYAML **err_rc)
{
int rc = LUSTRE_CFG_RC_NO_ERR;
data.sv_value, show_rc, err_rc, l_errno);
}
+int lustre_lnet_show_hsensitivity(int seq_no, struct cYAML **show_rc,
+ struct cYAML **err_rc)
+{
+ int rc = LUSTRE_CFG_RC_OUT_OF_MEM;
+ char val[LNET_MAX_STR_LEN];
+ int sen = -1, l_errno = 0;
+ char err_str[LNET_MAX_STR_LEN];
+
+ snprintf(err_str, sizeof(err_str), "\"out of memory\"");
+
+ rc = read_sysfs_file(modparam_path, "lnet_health_sensitivity", val,
+ 1, sizeof(val));
+ if (rc) {
+ l_errno = -errno;
+ snprintf(err_str, sizeof(err_str),
+ "\"cannot get health sensitivity: %d\"", rc);
+ } else {
+ sen = atoi(val);
+ }
+
+ return build_global_yaml_entry(err_str, sizeof(err_str), seq_no,
+ "health_sensitivity", sen, show_rc,
+ err_rc, l_errno);
+}
+
int lustre_lnet_show_transaction_to(int seq_no, struct cYAML **show_rc,
struct cYAML **err_rc)
{
struct cYAML **show_rc,
struct cYAML **err_rc)
{
- struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no;
+ struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no,
+ *sen;
int rc = 0;
seq_no = cYAML_get_object_item(tree, "seq_no");
: -1,
err_rc);
+ sen = cYAML_get_object_item(tree, "health_sensitivity");
+ if (sen)
+ rc = lustre_lnet_config_hsensitivity(sen->cy_valueint,
+ seq_no ? seq_no->cy_valueint
+ : -1,
+ err_rc);
+
return rc;
}
struct cYAML **show_rc,
struct cYAML **err_rc)
{
- struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no;
+ struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no,
+ *sen;
int rc = 0;
seq_no = cYAML_get_object_item(tree, "seq_no");
: -1,
show_rc, err_rc);
+ sen = cYAML_get_object_item(tree, "health_sensitivity");
+ if (sen)
+ rc = lustre_lnet_show_hsensitivity(seq_no ? seq_no->cy_valueint
+ : -1,
+ show_rc, err_rc);
+
return rc;
}
struct cYAML **err_rc);
/*
+ * lustre_lnet_config_hsensitivity
+ * sets the health sensitivity; the value by which to decrement the
+ * health value of a local or peer NI. If 0 then health is turned off
+ *
+ * sen - sensitivity value to configure
+ * seq_no - sequence number of the request
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_config_hsensitivity(int sen, int seq_no, struct cYAML **err_rc);
+
+/*
+ * lustre_lnet_show_hsensitivity
+ * show the health sensitivity in the system
+ *
+ * seq_no - sequence number of the request
+ * show_rc - [OUT] struct cYAML tree containing health sensitivity info
+ * err_rc - [OUT] struct cYAML tree describing the error. Freed by
+ * caller
+ */
+int lustre_lnet_show_hsensitivity(int seq_no, struct cYAML **show_rc,
+ struct cYAML **err_rc);
+
+/*
* lustre_lnet_config_transaction_to
* sets the timeout after which a message expires or a timeout event is
* propagated for an expired response.
static int jt_set_numa(int argc, char **argv);
static int jt_set_retry_count(int argc, char **argv);
static int jt_set_transaction_to(int argc, char **argv);
+static int jt_set_hsensitivity(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);
"\t>0 - number of retries\n"},
{"transaction_timeout", jt_set_transaction_to, 0, "Message/Response timeout\n"
"\t>0 - timeout in seconds\n"},
+ {"health_sensitivity", jt_set_hsensitivity, 0, "sensitivity to failure\n"
+ "\t0 - turn off health evaluation\n"
+ "\t>0 - sensitivity value not more than 1000\n"},
{ 0, 0, 0, NULL }
};
return rc;
}
+static int jt_set_hsensitivity(int argc, char **argv)
+{
+ long int value;
+ int rc;
+ struct cYAML *err_rc = NULL;
+
+ rc = check_cmd(set_cmds, "set", "health_sensitivity", 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 health sensitivity value", &err_rc);
+ cYAML_print_tree2file(stderr, err_rc);
+ cYAML_free_tree(err_rc);
+ return -1;
+ }
+
+ rc = lustre_lnet_config_hsensitivity(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_transaction_to(int argc, char **argv)
{
long int value;
goto out;
}
+ rc = lustre_lnet_show_hsensitivity(-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);