File bug-792124_pacemaker-stonith-monitor-log.patch of Package pacemaker

commit c9765144c0c23808b37adaf56c3305e2e2167173
Author: Gao,Yan <ygao@suse.com>
Date:   Mon Dec 17 16:09:28 2012 +0800

    Low: fencing: Suppress logging for stonith monitor actions (bnc#792124)

Index: pacemaker/fencing/commands.c
===================================================================
--- pacemaker.orig/fencing/commands.c
+++ pacemaker/fencing/commands.c
@@ -1296,7 +1296,13 @@ log_operation(async_command_t * cmd, int
         /* Logging the whole string confuses syslog when the string is xml */
         char *prefix = g_strdup_printf("%s:%d", cmd->device, pid);
 
-        crm_log_output(rc == 0 ? LOG_INFO : LOG_WARNING, prefix, output);
+        int success_log_level = LOG_INFO;
+
+        if (safe_str_eq(cmd->action, "monitor") ||
+            safe_str_eq(cmd->action, "status")) {
+            success_log_level = LOG_DEBUG;
+        }
+        crm_log_output(rc==0?success_log_level:LOG_WARNING, prefix, output);
         g_free(prefix);
     }
 }
@@ -1954,6 +1960,7 @@ stonith_command(crm_client_t * client, u
      * by 0x40AD4F: stonith_command (commands.c:1891)
      *
      */
+    int error_log_level = LOG_INFO;
 
     if (get_xpath_object("//" T_STONITH_REPLY, request, LOG_DEBUG_3)) {
         is_reply = TRUE;
@@ -1973,7 +1980,16 @@ stonith_command(crm_client_t * client, u
         rc = handle_request(client, id, flags, request, remote_peer);
     }
 
-    do_crm_log_unlikely(rc > 0 ? LOG_DEBUG : LOG_INFO, "Processed %s%s from %s: %s (%d)", op,
+    if (rc == -EINPROGRESS) {
+        xmlNode *op = get_xpath_object("//@"F_STONITH_ACTION, request, LOG_DEBUG_3);
+        const char *action = crm_element_value(op, F_STONITH_ACTION);
+
+        if (safe_str_eq(action, "monitor") ||
+            safe_str_eq(action, "status")) {
+            error_log_level = LOG_DEBUG;
+        }
+    }
+    do_crm_log_unlikely(rc > 0 ? LOG_DEBUG : error_log_level, "Processed %s%s from %s: %s (%d)", op,
                         is_reply ? " reply" : "", client ? client->name : remote_peer,
                         rc > 0 ? "" : pcmk_strerror(rc), rc);
 
Index: pacemaker/lib/fencing/st_client.c
===================================================================
--- pacemaker.orig/lib/fencing/st_client.c
+++ pacemaker/lib/fencing/st_client.c
@@ -561,8 +561,15 @@ stonith_action_create(const char *agent,
 {
     stonith_action_t *action;
 
+    int log_level = LOG_INFO;
+
+    if (safe_str_eq(_action, "monitor") ||
+        safe_str_eq(_action, "status")) {
+        log_level = LOG_DEBUG;
+    }
+
     action = calloc(1, sizeof(stonith_action_t));
-    crm_info("Initiating action %s for agent %s (target=%s)", _action, agent, victim);
+    do_crm_log(log_level, "Initiating action %s for agent %s (target=%s)", _action, agent, victim);
     action->args = make_args(_action, victim, victim_nodeid, device_args, port_map);
     action->agent = strdup(agent);
     action->action = strdup(_action);
openSUSE Build Service is sponsored by