Skip to content

Commit

Permalink
[FIXUP] get rid of RECONNECT attr
Browse files Browse the repository at this point in the history
  • Loading branch information
nichamon committed Jul 29, 2023
1 parent 70a04ac commit 12ca2c3
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 21 deletions.
7 changes: 7 additions & 0 deletions ldms/src/ldmsd/ldmsctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -2696,6 +2696,13 @@ static int __handle_cmd(struct ldmsctl_ctrl *ctrl, char *cmd_str)
}
free(dummy);

if ((0 == strcmp(key.token, "prdcr_add")) ||
(0 == strncmp(key.token, "prdcr_start"))) {
if (strstr(cmd_str, "interval")) {
printf("'interval' is begin deprecated. Please use 'reconnect' in the future.\n");
}
}

req_array = ldmsd_parse_config_str(cmd_str, msg_no,
ldms_xprt_msg_max(ctrl->ldms_xprt.x));
if (!req_array) {
Expand Down
9 changes: 9 additions & 0 deletions ldms/src/ldmsd/ldmsd_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,15 @@ int __process_config_file(const char *path, int *lno, int trust,
if (!off)
goto next_line;

if ((0 == strncmp(line, "prdcr_add", 9)) ||
(0 == strncmp(line, "prdcr_start"))) {
if (strstr(line, "interval")) {
ovis_log(config_log, OVIS_LWARN,
"'interval' is begin deprecated. "
"Please use 'reconnect' in the future.\n");
}
}

req_array = ldmsd_parse_config_str(line, msg_no, xprt.max_msg);
if (!req_array) {
rc = errno;
Expand Down
40 changes: 20 additions & 20 deletions ldms/src/ldmsd/ldmsd_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -1551,12 +1551,12 @@ static int prdcr_add_handler(ldmsd_req_ctxt_t reqc)
}

attr_name = "reconnect";
interval_s = ldmsd_req_attr_str_value_get_by_id(reqc, LDMSD_ATTR_RECONNECT);
if (!interval_s) {
interval_s = ldmsd_req_attr_str_value_get_by_id(reqc, LDMSD_ATTR_INTERVAL);
ovis_log(config_log, OVIS_LWARN, "The 'interval' in prdcr_add is "
"being deprecrated. Please use 'reconnect' instead.\n");
}
interval_s = ldmsd_req_attr_str_value_get_by_id(reqc, LDMSD_ATTR_INTERVAL);
// if (!interval_s) {
// interval_s = ldmsd_req_attr_str_value_get_by_id(reqc, LDMSD_ATTR_INTERVAL);
// ovis_log(config_log, OVIS_LWARN, "The 'interval' in prdcr_add is "
// "being deprecrated. Please use 'reconnect' instead.\n");
// }

if (!interval_s) {
goto einval;
Expand Down Expand Up @@ -1730,12 +1730,12 @@ static int prdcr_start_handler(ldmsd_req_ctxt_t reqc)
ldmsd_req_ctxt_sec_get(reqc, &sctxt);
interval_str = ldmsd_req_attr_str_value_get_by_id(reqc,
LDMSD_ATTR_RECONNECT);
if (!interval_str) {
interval_str = ldmsd_req_attr_str_value_get_by_id(reqc,
LDMSD_ATTR_AUTO_INTERVAL);
ovis_log(config_log, OVIS_LWARN, "The 'interval' attribute "
"in prdcr_start is being deprecated. Please use 'reconnect'.\n");
}
// if (!interval_str) {
// interval_str = ldmsd_req_attr_str_value_get_by_id(reqc,
// LDMSD_ATTR_AUTO_INTERVAL);
// ovis_log(config_log, OVIS_LWARN, "The 'interval' attribute "
// "in prdcr_start is being deprecated. Please use 'reconnect'.\n");
// }
reqc->errcode = ldmsd_prdcr_start(name, interval_str, &sctxt);
switch (reqc->errcode) {
case 0:
Expand Down Expand Up @@ -1831,14 +1831,14 @@ static int prdcr_start_regex_handler(ldmsd_req_ctxt_t reqc)
goto send_reply;
}

interval_str = ldmsd_req_attr_str_value_get_by_id(reqc, LDMSD_ATTR_RECONNECT);
if (!interval_str) {
interval_str = ldmsd_req_attr_str_value_get_by_id(reqc,
LDMSD_ATTR_INTERVAL);
ovis_log(config_log, OVIS_LWARN, "The 'interval' in "
"prdcr_start_regex is being deprecated. "
"Please use 'reconnect'.\n");
}
interval_str = ldmsd_req_attr_str_value_get_by_id(reqc, LDMSD_ATTR_INTERVAL);
// if (!interval_str) {
// interval_str = ldmsd_req_attr_str_value_get_by_id(reqc,
// LDMSD_ATTR_INTERVAL);
// ovis_log(config_log, OVIS_LWARN, "The 'interval' in "
// "prdcr_start_regex is being deprecated. "
// "Please use 'reconnect'.\n");
// }
ldmsd_req_ctxt_sec_get(reqc, &sctxt);

reqc->errcode = ldmsd_prdcr_start_regex(prdcr_regex, interval_str,
Expand Down
2 changes: 1 addition & 1 deletion ldms/src/ldmsd/ldmsd_request_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ const struct req_str_id attr_str_id_table[] = {
{ "producer", LDMSD_ATTR_PRODUCER },
{ "push", LDMSD_ATTR_PUSH },
{ "rail", LDMSD_ATTR_RAIL },
{ "reconnect", LDMSD_ATTR_RECONNECT },
{ "reconnect", LDMSD_ATTR_INTERVAL },
{ "regex", LDMSD_ATTR_REGEX },
{ "reset", LDMSD_ATTR_RESET },
{ "schema", LDMSD_ATTR_SCHEMA },
Expand Down

0 comments on commit 12ca2c3

Please sign in to comment.