File pacemaker-crmd-LRM-related-log-messages.patch of Package pacemaker.14737

commit 06efda973f70f1f5bb7b079a072adc969af9a49b
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Thu Jan 12 10:07:23 2017 -0600

    Log: crmd: improve crmd's LRM-related log messages

diff --git a/crmd/lrm.c b/crmd/lrm.c
index 07e8e702a..9068652e4 100644
--- a/crmd/lrm.c
+++ b/crmd/lrm.c
@@ -37,6 +37,8 @@
 #define START_DELAY_THRESHOLD 5 * 60 * 1000
 #define MAX_LRM_REG_FAILS 30
 
+#define s_if_plural(i) (((i) == 1)? "" : "s")
+
 struct delete_event_s {
     int rc;
     const char *rsc;
@@ -372,8 +374,10 @@ do_lrm_control(long long action,
 
         if (ret != pcmk_ok) {
             if (lrm_state->num_lrm_register_fails < MAX_LRM_REG_FAILS) {
-                crm_warn("Failed to sign on to the LRM %d"
-                         " (%d max) times", lrm_state->num_lrm_register_fails, MAX_LRM_REG_FAILS);
+                crm_warn("Failed to connect to the LRM %d time%s (%d max)",
+                         lrm_state->num_lrm_register_fails,
+                         s_if_plural(lrm_state->num_lrm_register_fails),
+                         MAX_LRM_REG_FAILS);
 
                 crm_timer_start(wait_timer);
                 crmd_fsa_stall(FALSE);
@@ -382,8 +386,9 @@ do_lrm_control(long long action,
         }
 
         if (ret != pcmk_ok) {
-            crm_err("Failed to sign on to the LRM %d" " (max) times",
-                    lrm_state->num_lrm_register_fails);
+            crm_err("Failed to connect to the LRM the max allowed %d time%s",
+                    lrm_state->num_lrm_register_fails,
+                    s_if_plural(lrm_state->num_lrm_register_fails));
             register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
             return;
         }
@@ -425,8 +430,8 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
         guint nremaining = g_hash_table_size(lrm_state->pending_ops);
 
         if (removed || nremaining) {
-            crm_notice("Stopped %u recurring operations at %s (%u operations remaining)",
-                       removed, when, nremaining);
+            crm_notice("Stopped %u recurring operation%s at %s (%u remaining)",
+                       removed, s_if_plural(removed), when, nremaining);
         }
     }
 
@@ -441,7 +446,8 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
     }
 
     if (counter > 0) {
-        do_crm_log(log_level, "%d pending LRM operations at %s", counter, when);
+        do_crm_log(log_level, "%d pending LRM operation%s at %s",
+                   counter, s_if_plural(counter), when);
 
         if (cur_state == S_TERMINATE || !is_set(fsa_input_register, R_SENT_RSC_STOP)) {
             g_hash_table_iter_init(&gIter, lrm_state->pending_ops);
@@ -459,7 +465,7 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
         return rc;
     }
 
-    if (cur_state == S_TERMINATE || is_set(fsa_input_register, R_SHUTDOWN)) {
+    if (is_set(fsa_input_register, R_SHUTDOWN)) {
         /* At this point we're not waiting, we're just shutting down */
         when = "shutdown";
     }
@@ -472,7 +478,11 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
         }
 
         counter++;
-        crm_trace("Found %s active", entry->id);
+        if (log_level == LOG_ERR) {
+            crm_info("Found %s active at %s", entry->id, when);
+        } else {
+            crm_trace("Found %s active at %s", entry->id, when);
+        }
         if (lrm_state->pending_ops) {
             GHashTableIter hIter;
 
@@ -488,7 +498,8 @@ lrm_state_verify_stopped(lrm_state_t * lrm_state, enum crmd_fsa_state cur_state,
     }
 
     if (counter) {
-        crm_err("%d resources were active at %s.", counter, when);
+        crm_err("%d resource%s active at %s",
+                counter, (counter == 1)? " was" : "s were", when);
     }
 
     return rc;
@@ -1489,8 +1500,8 @@ do_lrm_invoke(long long action,
     lrm_state = lrm_state_find(target_node);
 
     if (lrm_state == NULL && is_remote_node) {
-        crm_err("no lrmd connection for remote node %s found on cluster node %s. Can not process request.",
-            target_node, fsa_our_uname);
+        crm_err("Failing action because remote node %s has no connection to cluster node %s",
+                target_node, fsa_our_uname);
 
         /* The action must be recorded here and in the CIB as failed */
         synthesize_lrmd_failure(NULL, input->xml, PCMK_OCF_CONNECTION_DIED);
@@ -1785,7 +1796,7 @@ do_lrm_invoke(long long action,
         lrmd_free_rsc_info(rsc);
 
     } else {
-        crm_err("Operation was neither a lrm_query, nor a rsc op.  %s", crm_str(crm_op));
+        crm_err("Cannot perform operation %s of unknown type", crm_str(crm_op));
         register_fsa_error(C_FSA_INTERNAL, I_ERROR, NULL);
     }
 }
@@ -2108,8 +2119,8 @@ do_lrm_rsc_op(lrm_state_t * lrm_state, lrmd_rsc_info_t * rsc, const char *operat
             lrm_state->pending_ops, stop_recurring_action_by_rsc, &data);
 
         if (removed) {
-            crm_debug("Stopped %u recurring operations in preparation for %s_%s_%d",
-                      removed, rsc->id, operation, op->interval);
+            crm_debug("Stopped %u recurring operation%s in preparation for %s_%s_%d",
+                      removed, s_if_plural(removed), rsc->id, operation, op->interval);
         }
     }
 
openSUSE Build Service is sponsored by