File bug-974108-pacemaker_cib-fencing-set-status-callback.patch of Package pacemaker.3577

commit 58dcf0a73ef5712af3f8fbe87c89852646f37540
Author: Gao,Yan <ygao@suse.com>
Date:   Tue Apr 12 21:39:51 2016 +0200

    Fix: cib/fencing: Set status callback before connecting to cluster
    
    Otherwise, we'd at least miss the initial call to crm_status_callback():
    
    init_cs_connection_once() -> crm_get_peer() -> crm_update_peer_uname()
    -> crm_status_callback()
    
    Previously for stonithd, it would not be able to broadcast its uname at
    the earliest time, which could potentially introduce other issues.

diff --git a/cib/main.c b/cib/main.c
index cbaf7b5..cc3a463 100644
--- a/cib/main.c
+++ b/cib/main.c
@@ -485,14 +485,16 @@ cib_init(void)
     }
 
     if (stand_alone == FALSE) {
+        if (is_openais_cluster()) {
+            crm_set_status_callback(&cib_peer_update_callback);
+        }
+
         if (crm_cluster_connect(&crm_cluster) == FALSE) {
             crm_crit("Cannot sign in to the cluster... terminating");
             crm_exit(DAEMON_RESPAWN_STOP);
         }
         cib_our_uname = crm_cluster.uname;
-        if (is_openais_cluster()) {
-            crm_set_status_callback(&cib_peer_update_callback);
-        }
+
 #if SUPPORT_HEARTBEAT
         if (is_heartbeat_cluster()) {
 
diff --git a/fencing/main.c b/fencing/main.c
index 1435d8e..7610723 100644
--- a/fencing/main.c
+++ b/fencing/main.c
@@ -1450,6 +1450,8 @@ main(int argc, char **argv)
 #endif
         }
 
+        crm_set_status_callback(&st_peer_update_callback);
+
         if (crm_cluster_connect(&cluster) == FALSE) {
             crm_crit("Cannot sign in to the cluster... terminating");
             crm_exit(DAEMON_RESPAWN_STOP);
@@ -1486,7 +1488,6 @@ main(int argc, char **argv)
         stonith_our_uname = strdup("localhost");
     }
 
-    crm_set_status_callback(&st_peer_update_callback);
 
     device_list = g_hash_table_new_full(crm_str_hash, g_str_equal, NULL, free_device);
 
openSUSE Build Service is sponsored by