return rc;
}
+int lustre_lnet_config_recov_intrv(int intrv, 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", intrv);
+
+ rc = write_sysfs_file(modparam_path, "lnet_recovery_interval", val,
+ 1, strlen(val) + 1);
+ if (rc)
+ snprintf(err_str, sizeof(err_str),
+ "\"cannot configure recovery interval: %s\"",
+ strerror(errno));
+
+ cYAML_build_error(rc, seq_no, ADD_CMD, "recovery_interval", err_str, err_rc);
+
+ return rc;
+}
+
int lustre_lnet_config_hsensitivity(int sen, 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_recov_intrv(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 intrv = -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_recovery_interval", val,
+ 1, sizeof(val));
+ if (rc) {
+ l_errno = -errno;
+ snprintf(err_str, sizeof(err_str),
+ "\"cannot get recovery interval: %d\"", rc);
+ } else {
+ intrv = atoi(val);
+ }
+
+ return build_global_yaml_entry(err_str, sizeof(err_str), seq_no,
+ "recovery_interval", intrv, show_rc,
+ err_rc, l_errno);
+}
+
int lustre_lnet_show_hsensitivity(int seq_no, struct cYAML **show_rc,
struct cYAML **err_rc)
{
goto out;
}
+ if (nid_list.rlst_num_nids == 0)
+ goto out;
+
root = cYAML_create_object(NULL, NULL);
if (root == NULL)
goto out;
struct cYAML **err_rc)
{
struct lnet_ioctl_lnet_stats data;
+ struct lnet_counters *cntrs;
int rc;
int l_errno;
char err_str[LNET_MAX_STR_LEN];
LIBCFS_IOC_INIT_V2(data, st_hdr);
rc = l_ioctl(LNET_DEV_ID, IOC_LIBCFS_GET_LNET_STATS, &data);
- if (rc != 0) {
+ if (rc) {
l_errno = errno;
snprintf(err_str,
sizeof(err_str),
rc = LUSTRE_CFG_RC_OUT_OF_MEM;
+ cntrs = &data.st_cntrs;
+
root = cYAML_create_object(NULL, NULL);
- if (root == NULL)
+ if (!root)
goto out;
stats = cYAML_create_object(root, "statistics");
- if (stats == NULL)
+ if (!stats)
goto out;
- if (cYAML_create_number(stats, "msgs_alloc",
- data.st_cntrs.msgs_alloc) == NULL)
+ if (!cYAML_create_number(stats, "msgs_alloc",
+ cntrs->lct_common.lcc_msgs_alloc))
goto out;
- if (cYAML_create_number(stats, "msgs_max",
- data.st_cntrs.msgs_max) == NULL)
+ if (!cYAML_create_number(stats, "msgs_max",
+ cntrs->lct_common.lcc_msgs_max))
goto out;
- if (cYAML_create_number(stats, "rst_alloc",
- data.st_cntrs.rst_alloc) == NULL)
+ if (!cYAML_create_number(stats, "rst_alloc",
+ cntrs->lct_health.lch_rst_alloc))
goto out;
- if (cYAML_create_number(stats, "errors",
- data.st_cntrs.errors) == NULL)
+ if (!cYAML_create_number(stats, "errors",
+ cntrs->lct_common.lcc_errors))
goto out;
- if (cYAML_create_number(stats, "send_count",
- data.st_cntrs.send_count) == NULL)
+ if (!cYAML_create_number(stats, "send_count",
+ cntrs->lct_common.lcc_send_count))
goto out;
- if (cYAML_create_number(stats, "resend_count",
- data.st_cntrs.resend_count) == NULL)
+ if (!cYAML_create_number(stats, "resend_count",
+ cntrs->lct_health.lch_resend_count))
goto out;
- if (cYAML_create_number(stats, "response_timeout_count",
- data.st_cntrs.response_timeout_count) == NULL)
+ if (!cYAML_create_number(stats, "response_timeout_count",
+ cntrs->lct_health.lch_response_timeout_count))
goto out;
- if (cYAML_create_number(stats, "local_interrupt_count",
- data.st_cntrs.local_interrupt_count) == NULL)
+ if (!cYAML_create_number(stats, "local_interrupt_count",
+ cntrs->lct_health.lch_local_interrupt_count))
goto out;
- if (cYAML_create_number(stats, "local_dropped_count",
- data.st_cntrs.local_dropped_count) == NULL)
+ if (!cYAML_create_number(stats, "local_dropped_count",
+ cntrs->lct_health.lch_local_dropped_count))
goto out;
- if (cYAML_create_number(stats, "local_aborted_count",
- data.st_cntrs.local_aborted_count) == NULL)
+ if (!cYAML_create_number(stats, "local_aborted_count",
+ cntrs->lct_health.lch_local_aborted_count))
goto out;
- if (cYAML_create_number(stats, "local_no_route_count",
- data.st_cntrs.local_no_route_count) == NULL)
+ if (!cYAML_create_number(stats, "local_no_route_count",
+ cntrs->lct_health.lch_local_no_route_count))
goto out;
- if (cYAML_create_number(stats, "local_timeout_count",
- data.st_cntrs.local_timeout_count) == NULL)
+ if (!cYAML_create_number(stats, "local_timeout_count",
+ cntrs->lct_health.lch_local_timeout_count))
goto out;
- if (cYAML_create_number(stats, "local_error_count",
- data.st_cntrs.local_error_count) == NULL)
+ if (!cYAML_create_number(stats, "local_error_count",
+ cntrs->lct_health.lch_local_error_count))
goto out;
- if (cYAML_create_number(stats, "remote_dropped_count",
- data.st_cntrs.remote_dropped_count) == NULL)
+ if (!cYAML_create_number(stats, "remote_dropped_count",
+ cntrs->lct_health.lch_remote_dropped_count))
goto out;
- if (cYAML_create_number(stats, "remote_error_count",
- data.st_cntrs.remote_error_count) == NULL)
+ if (!cYAML_create_number(stats, "remote_error_count",
+ cntrs->lct_health.lch_remote_error_count))
goto out;
- if (cYAML_create_number(stats, "remote_timeout_count",
- data.st_cntrs.remote_timeout_count) == NULL)
+ if (!cYAML_create_number(stats, "remote_timeout_count",
+ cntrs->lct_health.lch_remote_timeout_count))
goto out;
- if (cYAML_create_number(stats, "network_timeout_count",
- data.st_cntrs.network_timeout_count) == NULL)
+ if (!cYAML_create_number(stats, "network_timeout_count",
+ cntrs->lct_health.lch_network_timeout_count))
goto out;
- if (cYAML_create_number(stats, "recv_count",
- data.st_cntrs.recv_count) == NULL)
+ if (!cYAML_create_number(stats, "recv_count",
+ cntrs->lct_common.lcc_recv_count))
goto out;
- if (cYAML_create_number(stats, "route_count",
- data.st_cntrs.route_count) == NULL)
+ if (!cYAML_create_number(stats, "route_count",
+ cntrs->lct_common.lcc_route_count))
goto out;
- if (cYAML_create_number(stats, "drop_count",
- data.st_cntrs.drop_count) == NULL)
+ if (!cYAML_create_number(stats, "drop_count",
+ cntrs->lct_common.lcc_drop_count))
goto out;
- if (cYAML_create_number(stats, "send_length",
- data.st_cntrs.send_length) == NULL)
+ if (!cYAML_create_number(stats, "send_length",
+ cntrs->lct_common.lcc_send_length))
goto out;
- if (cYAML_create_number(stats, "recv_length",
- data.st_cntrs.recv_length) == NULL)
+ if (!cYAML_create_number(stats, "recv_length",
+ cntrs->lct_common.lcc_recv_length))
goto out;
- if (cYAML_create_number(stats, "route_length",
- data.st_cntrs.route_length) == NULL)
+ if (!cYAML_create_number(stats, "route_length",
+ cntrs->lct_common.lcc_route_length))
goto out;
- if (cYAML_create_number(stats, "drop_length",
- data.st_cntrs.drop_length) == NULL)
+ if (!cYAML_create_number(stats, "drop_length",
+ cntrs->lct_common.lcc_drop_length))
goto out;
- if (show_rc == NULL)
+ if (!show_rc)
cYAML_print_tree(root);
snprintf(err_str, sizeof(err_str), "\"success\"");
{
char **nids = NULL;
int num, rc;
- struct cYAML *seq_no, *prim_nid, *non_mr, *ip2nets, *peer_nis;
+ struct cYAML *seq_no, *prim_nid, *mr, *ip2nets, *peer_nis;
char err_str[LNET_MAX_STR_LEN];
+ bool mr_value;
seq_no = cYAML_get_object_item(tree, "seq_no");
prim_nid = cYAML_get_object_item(tree, "primary nid");
- non_mr = cYAML_get_object_item(tree, "non_mr");
+ mr = cYAML_get_object_item(tree, "Multi-Rail");
ip2nets = cYAML_get_object_item(tree, "ip2nets");
peer_nis = cYAML_get_object_item(tree, "peer ni");
return rc;
}
+ if (!mr)
+ mr_value = true;
+ else {
+ if (!mr->cy_valuestring || !strcmp(mr->cy_valuestring, "True"))
+ mr_value = true;
+ else if (!strcmp(mr->cy_valuestring, "False"))
+ mr_value = false;
+ else {
+ rc = LUSTRE_CFG_RC_BAD_PARAM;
+ snprintf(err_str, sizeof(err_str), "Bad MR value");
+ cYAML_build_error(rc, (seq_no) ? seq_no->cy_valueint : -1,
+ ADD_CMD, "peer", err_str, err_rc);
+ return rc;
+ }
+ }
+
num = yaml_copy_peer_nids((ip2nets) ? ip2nets : peer_nis, &nids,
(prim_nid) ? prim_nid->cy_valuestring : NULL,
false);
}
rc = lustre_lnet_config_peer_nid((prim_nid) ? prim_nid->cy_valuestring : NULL,
- nids, num,
- (non_mr) ? false : true,
+ nids, num, mr_value,
(ip2nets) ? true : false,
(seq_no) ? seq_no->cy_valueint : -1,
err_rc);
struct cYAML **err_rc)
{
struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no,
- *sen;
+ *sen, *recov;
int rc = 0;
seq_no = cYAML_get_object_item(tree, "seq_no");
: -1,
err_rc);
+ recov = cYAML_get_object_item(tree, "recovery_interval");
+ if (recov)
+ rc = lustre_lnet_config_recov_intrv(recov->cy_valueint,
+ seq_no ? seq_no->cy_valueint
+ : -1,
+ err_rc);
+
return rc;
}
struct cYAML **err_rc)
{
struct cYAML *max_intf, *numa, *discovery, *retry, *tto, *seq_no,
- *sen;
+ *sen, *recov;
int rc = 0;
seq_no = cYAML_get_object_item(tree, "seq_no");
: -1,
show_rc, err_rc);
+ recov = cYAML_get_object_item(tree, "recovery_interval");
+ if (recov)
+ rc = lustre_lnet_show_recov_intrv(seq_no ? seq_no->cy_valueint
+ : -1,
+ show_rc, err_rc);
+
return rc;
}