File pacemaker-pengine-send-transition-graph-via-disk-if-too-big.patch of Package pacemaker.14737

commit e77dfcbb7803a292dbfddc236e91ef6ad3e044f0
Author: Andrew Beekhof <andrew@beekhof.net>
Date:   Fri Oct 20 12:53:09 2017 +1100

    Fix: PE: Restore the ability to send the transition graph via the disk if it gets too big

Index: pacemaker-1.1.16+20170320.77ea74d/pengine/pengine.c
===================================================================
--- pacemaker-1.1.16+20170320.77ea74d.orig/pengine/pengine.c
+++ pacemaker-1.1.16+20170320.77ea74d/pengine/pengine.c
@@ -18,6 +18,7 @@
 
 #include <crm_internal.h>
 
+#include <sys/stat.h>
 #include <sys/param.h>
 
 #include <crm/crm.h>
@@ -163,7 +164,21 @@ process_pe_message(xmlNode * msg, xmlNod
         crm_xml_add_int(reply, "config-warnings", crm_config_warning);
 
         if (crm_ipcs_send(sender, 0, reply, crm_ipc_server_event) == FALSE) {
-            crm_err("Couldn't send transition graph to peer, discarding");
+            int graph_file_fd = 0;
+            char *graph_file = NULL;
+            umask(S_IWGRP | S_IWOTH | S_IROTH);
+
+            graph_file = g_strdup_printf("%s/pengine.graph.XXXXXX", PE_STATE_DIR);
+            graph_file_fd = mkstemp(graph_file);
+
+            crm_err("Couldn't send transition graph to peer, writing to %s instead",
+                    graph_file);
+
+            crm_xml_add(reply, F_CRM_TGRAPH, graph_file);
+            write_xml_fd(data_set.graph, graph_file, graph_file_fd, FALSE);
+
+            free_xml(first_named_child(reply, F_CRM_DATA));
+            CRM_ASSERT(crm_ipcs_send(sender, 0, reply, crm_ipc_server_event));
         }
 
         free_xml(reply);
openSUSE Build Service is sponsored by