You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

97 lines
4.0 KiB

From 30eb9a980db152f6c803a35d3b261a563ad4ee75 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Wed, 24 Jan 2018 10:51:34 -0600
Subject: [PATCH 1/2] Low: tools: crm_resource --refresh should ignore
--operation and --interval
It already did when a resource was not specified.
Also update help text to clarify cleanup vs refresh.
---
tools/crm_resource.c | 26 ++++++++++++++++-----------
1 file changed, 16 insertions(+), 10 deletions(-)
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
index 3fbc6e1..d007668 100644
--- a/tools/crm_resource.c
+++ b/tools/crm_resource.c
@@ -212,14 +212,16 @@ static struct crm_option long_options[] = {
},
{
"cleanup", no_argument, NULL, 'C',
- "\t\tDelete failed operations from a resource's history allowing its current state to be rechecked.\n"
+ "\t\tIf resource has any past failures, clear its history and fail count.\n"
"\t\t\t\tOptionally filtered by --resource, --node, --operation, and --interval (otherwise all).\n"
+ "\t\t\t\t--operation and --interval apply to fail counts, but entire history is always cleared,\n"
+ "\t\t\t\tto allow current state to be rechecked.\n"
},
{
"refresh", no_argument, NULL, 'R',
"\t\tDelete resource's history (including failures) so its current state is rechecked.\n"
- "\t\t\t\tOptionally filtered by --resource, --node, --operation, and --interval (otherwise all).\n"
- "\t\t\t\tUnless --force is specified, resource's group or clone (if any) will also be cleaned"
+ "\t\t\t\tOptionally filtered by --resource and --node (otherwise all).\n"
+ "\t\t\t\tUnless --force is specified, resource's group or clone (if any) will also be refreshed."
},
{
"set-parameter", required_argument, NULL, 'p',
@@ -438,7 +440,6 @@ main(int argc, char **argv)
bool require_resource = TRUE; /* whether command requires that resource be specified */
bool require_dataset = TRUE; /* whether command requires populated dataset instance */
bool require_crmd = FALSE; /* whether command requires connection to CRMd */
- bool just_errors = TRUE; /* whether cleanup command deletes all history or just errors */
int rc = pcmk_ok;
int is_ocf_rc = 0;
@@ -630,8 +631,7 @@ main(int argc, char **argv)
if (cib_file == NULL) {
require_crmd = TRUE;
}
- just_errors = FALSE;
- rsc_cmd = 'C';
+ rsc_cmd = 'R';
find_flags = pe_find_renamed|pe_find_anon;
break;
@@ -641,7 +641,6 @@ main(int argc, char **argv)
if (cib_file == NULL) {
require_crmd = TRUE;
}
- just_errors = TRUE;
rsc_cmd = 'C';
find_flags = pe_find_renamed|pe_find_anon;
break;
@@ -1092,7 +1091,14 @@ main(int argc, char **argv)
rc = cli_resource_delete_attribute(rsc, rsc_id, prop_set, prop_id,
prop_name, cib_conn, &data_set);
- } else if ((rsc_cmd == 'C') && rsc) {
+ } else if (((rsc_cmd == 'C') || (rsc_cmd == 'R')) && rsc) {
+ bool just_errors = TRUE;
+
+ if (rsc_cmd == 'R') {
+ just_errors = FALSE;
+ operation = NULL;
+ interval = 0;
+ }
if (do_force == FALSE) {
rsc = uber_parent(rsc);
}
@@ -1113,14 +1119,14 @@ main(int argc, char **argv)
start_mainloop();
}
- } else if (rsc_cmd == 'C' && just_errors) {
+ } else if (rsc_cmd == 'C') {
rc = cli_cleanup_all(crmd_channel, host_uname, operation, interval,
&data_set);
if (rc == pcmk_ok) {
start_mainloop();
}
- } else if (rsc_cmd == 'C') {
+ } else if (rsc_cmd == 'R') {
#if HAVE_ATOMIC_ATTRD
const char *router_node = host_uname;
xmlNode *msg_data = NULL;
--
1.8.3.1