File pacemaker-attrd-pacemakerd-libcrmcommon-make-Exiting-last-message.patch of Package pacemaker.14737

commit 45d914f58d936ef2b953efe04d78655a2501abf0
Author: Ken Gaillot <kgaillot@redhat.com>
Date:   Tue Jan 30 18:45:08 2018 -0600

    Log: attrd,pacemakerd,libcrmcommon: make "Exiting" last message
    
    Previously, pacemakerd would log an "Exiting" message, then call crm_exit(),
    which could log more messages. Now, crm_exit() logs the "Exiting" message,
    after doing everything else.
    
    This will result in more logs (i.e. every call of crm_exit()), but they will be
    at info level, and potentially useful.

Index: pacemaker/attrd/main.c
===================================================================
--- pacemaker.orig/attrd/main.c
+++ pacemaker/attrd/main.c
@@ -50,10 +50,9 @@ election_t *writer = NULL;
 int attrd_error = pcmk_ok;
 
 static void
-attrd_shutdown(int nsig) {
+attrd_shutdown(int nsig)
+{
     shutting_down = TRUE;
-    crm_info("Shutting down");
-
     if (mloop != NULL && g_main_is_running(mloop)) {
         g_main_quit(mloop);
     } else {
Index: pacemaker/lib/common/utils.c
===================================================================
--- pacemaker.orig/lib/common/utils.c
+++ pacemaker/lib/common/utils.c
@@ -87,17 +87,17 @@ int
 crm_exit(int rc)
 {
     mainloop_cleanup();
-
-#if HAVE_LIBXML2
-    crm_trace("cleaning up libxml");
     crm_xml_cleanup();
-#endif
 
-    crm_trace("exit %d", rc);
     qb_log_fini();
 
     free(crm_short_options);
-    free(crm_system_name);
+    if (crm_system_name) {
+        crm_info("Exiting %s " CRM_XS " with status %d", crm_system_name, rc);
+        free(crm_system_name);
+    } else {
+        crm_trace("Exiting with status %d", rc);
+    }
 
     exit(ABS(rc)); /* Always exit with a positive value so that it can be passed to crm_error
                     *
Index: pacemaker/mcp/pacemaker.c
===================================================================
--- pacemaker.orig/mcp/pacemaker.c
+++ pacemaker/mcp/pacemaker.c
@@ -1154,7 +1154,5 @@ main(int argc, char **argv)
     cluster_disconnect_cpg(&cluster);
     cluster_disconnect_cfg();
 
-    crm_info("Exiting %s", crm_system_name);
-
     return crm_exit(rc);
 }
openSUSE Build Service is sponsored by