Blame SOURCES/pacemaker-log_crm_mon_clean_up_the_output_for_failed_operations.patch

ed0026
commit a301734d5c3e0c16c96df02d83db074e68c6acf7
ed0026
Author: Andrew Beekhof <andrew@beekhof.net>
ed0026
Date:   Wed Aug 7 12:11:42 2013 +1000
ed0026
ed0026
    Log: crm_mon: Clean up the output for failed operations
ed0026
ed0026
diff --git a/tools/crm_mon.c b/tools/crm_mon.c
ed0026
index a6a20c6..d3e43c4 100644
ed0026
--- a/tools/crm_mon.c
ed0026
+++ b/tools/crm_mon.c
ed0026
@@ -1383,31 +1383,35 @@ print_status(pe_working_set_t * data_set)
ed0026
         print_as("\nFailed actions:\n");
ed0026
         for (xml_op = __xml_first_child(data_set->failed); xml_op != NULL;
ed0026
              xml_op = __xml_next(xml_op)) {
ed0026
-            int val = 0;
ed0026
+            int status = 0;
ed0026
+            int rc = 0;
ed0026
             const char *id = ID(xml_op);
ed0026
             const char *op_key = crm_element_value(xml_op, XML_LRM_ATTR_TASK_KEY);
ed0026
             const char *last = crm_element_value(xml_op, XML_RSC_OP_LAST_CHANGE);
ed0026
             const char *node = crm_element_value(xml_op, XML_ATTR_UNAME);
ed0026
             const char *call = crm_element_value(xml_op, XML_LRM_ATTR_CALLID);
ed0026
-            const char *rc = crm_element_value(xml_op, XML_LRM_ATTR_RC);
ed0026
-            const char *status = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS);
ed0026
+            const char *rc_s = crm_element_value(xml_op, XML_LRM_ATTR_RC);
ed0026
+            const char *status_s = crm_element_value(xml_op, XML_LRM_ATTR_OPSTATUS);
ed0026
 
ed0026
-            val = crm_parse_int(status, "0");
ed0026
-            print_as("    %s (node=%s, call=%s, rc=%s, status=%s",
ed0026
-                     op_key ? op_key : id, node, call, rc, services_lrm_status_str(val));
ed0026
+            rc = crm_parse_int(rc_s, "0");
ed0026
+            status = crm_parse_int(status_s, "0");
ed0026
 
ed0026
             if (last) {
ed0026
                 time_t run_at = crm_parse_int(last, "0");
ed0026
+                char *run_at_s = ctime(&run_at);
ed0026
+                if(run_at_s) {
ed0026
+                    run_at_s[24] = 0; /* Overwrite the newline */
ed0026
+                }
ed0026
 
ed0026
-                print_as(", last-rc-change=%s, queued=%sms, exec=%sms\n",
ed0026
-                         ctime(&run_at),
ed0026
-                         crm_element_value(xml_op, XML_RSC_OP_T_EXEC),
ed0026
-                         crm_element_value(xml_op, XML_RSC_OP_T_QUEUE));
ed0026
+                print_as("    %s on %s '%s' (%d): call=%s, status=%s, last-rc-change='%s', queued=%sms, exec=%sms\n",
ed0026
+                         op_key ? op_key : id, node, lrmd_event_rc2str(rc), rc, call, services_lrm_status_str(status),
ed0026
+                         run_at_s, crm_element_value(xml_op, XML_RSC_OP_T_EXEC), crm_element_value(xml_op, XML_RSC_OP_T_QUEUE));
ed0026
+            } else {
ed0026
+                print_as("    %s on %s '%s' (%d): call=%s, status=%s\n",
ed0026
+                         op_key ? op_key : id, node, lrmd_event_rc2str(rc), rc, call, services_lrm_status_str(status));
ed0026
             }
ed0026
-
ed0026
-            val = crm_parse_int(rc, "0");
ed0026
-            print_as("): %s\n", lrmd_event_rc2str(val));
ed0026
         }
ed0026
+        print_as("\n");
ed0026
     }
ed0026
 
ed0026
     if (print_tickets || print_neg_location_prefix) {