Merge pull request #14184 from opensourcerouting/fix/cpu-wall-warning_vtysh_fixes_for_no_form

lib: Allow unsetting walltime-warning and cpu-warning
This commit is contained in:
Donald Sharp 2023-08-15 16:01:07 -04:00 committed by GitHub
commit 7cfdbe97c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 26 deletions

View File

@ -355,7 +355,7 @@ DEFPY (service_cputime_stats,
DEFPY (service_cputime_warning, DEFPY (service_cputime_warning,
service_cputime_warning_cmd, service_cputime_warning_cmd,
"[no] service cputime-warning (1-4294967295)", "[no] service cputime-warning ![(1-4294967295)]",
NO_STR NO_STR
"Set up miscellaneous service\n" "Set up miscellaneous service\n"
"Warn for tasks exceeding CPU usage threshold\n" "Warn for tasks exceeding CPU usage threshold\n"
@ -368,16 +368,9 @@ DEFPY (service_cputime_warning,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
ALIAS (service_cputime_warning,
no_service_cputime_warning_cmd,
"no service cputime-warning",
NO_STR
"Set up miscellaneous service\n"
"Warn for tasks exceeding CPU usage threshold\n")
DEFPY (service_walltime_warning, DEFPY (service_walltime_warning,
service_walltime_warning_cmd, service_walltime_warning_cmd,
"[no] service walltime-warning (1-4294967295)", "[no] service walltime-warning ![(1-4294967295)]",
NO_STR NO_STR
"Set up miscellaneous service\n" "Set up miscellaneous service\n"
"Warn for tasks exceeding total wallclock threshold\n" "Warn for tasks exceeding total wallclock threshold\n"
@ -390,13 +383,6 @@ DEFPY (service_walltime_warning,
return CMD_SUCCESS; return CMD_SUCCESS;
} }
ALIAS (service_walltime_warning,
no_service_walltime_warning_cmd,
"no service walltime-warning",
NO_STR
"Set up miscellaneous service\n"
"Warn for tasks exceeding total wallclock threshold\n")
static void show_thread_poll_helper(struct vty *vty, struct event_loop *m) static void show_thread_poll_helper(struct vty *vty, struct event_loop *m)
{ {
const char *name = m->name ? m->name : "main"; const char *name = m->name ? m->name : "main";
@ -525,9 +511,7 @@ void event_cmd_init(void)
install_element(CONFIG_NODE, &service_cputime_stats_cmd); install_element(CONFIG_NODE, &service_cputime_stats_cmd);
install_element(CONFIG_NODE, &service_cputime_warning_cmd); install_element(CONFIG_NODE, &service_cputime_warning_cmd);
install_element(CONFIG_NODE, &no_service_cputime_warning_cmd);
install_element(CONFIG_NODE, &service_walltime_warning_cmd); install_element(CONFIG_NODE, &service_walltime_warning_cmd);
install_element(CONFIG_NODE, &no_service_walltime_warning_cmd);
install_element(VIEW_NODE, &show_thread_timers_cmd); install_element(VIEW_NODE, &show_thread_timers_cmd);
} }

View File

@ -484,8 +484,7 @@ void vtysh_config_parse_line(void *arg, const char *line)
config = config_get(RPKI_NODE, line); config = config_get(RPKI_NODE, line);
else { else {
if (strncmp(line, "log", strlen("log")) == 0 || if (strncmp(line, "log", strlen("log")) == 0 ||
strncmp(line, "hostname", strlen("hostname")) == strncmp(line, "hostname", strlen("hostname")) == 0 ||
0 ||
strncmp(line, "domainname", strlen("domainname")) == strncmp(line, "domainname", strlen("domainname")) ==
0 || 0 ||
strncmp(line, "allow-reserved-ranges", strncmp(line, "allow-reserved-ranges",
@ -497,12 +496,9 @@ void vtysh_config_parse_line(void *arg, const char *line)
strlen("no ip prefix-list")) == 0 || strlen("no ip prefix-list")) == 0 ||
strncmp(line, "no ipv6 prefix-list", strncmp(line, "no ipv6 prefix-list",
strlen("no ipv6 prefix-list")) == 0 || strlen("no ipv6 prefix-list")) == 0 ||
strncmp(line, "service ", strlen("service ")) == strncmp(line, "service ", strlen("service ")) == 0 ||
0 || strncmp(line, "no service ",
strncmp(line, "no service cputime-stats", strlen("no service ")) == 0)
strlen("no service cputime-stats")) == 0 ||
strncmp(line, "service cputime-warning",
strlen("service cputime-warning")) == 0)
config_add_line_uniq(config_top, line); config_add_line_uniq(config_top, line);
else else
config_add_line(config_top, line); config_add_line(config_top, line);