File bsc#1181744-0003-Feature-fence-history-add-notification-upon-history-.patch of Package pacemaker.19271

From 487cdd9e3ec6ab47fde5074acbb2ff564047d59c Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Tue, 18 Jun 2019 14:09:20 +0200
Subject: [PATCH 3/7] Feature: fence-history: add notification upon
 history-synced

---
 daemons/fenced/fenced_history.c   |  5 +++++
 daemons/fenced/pacemaker-fenced.c |  3 +++
 daemons/fenced/pacemaker-fenced.h | 11 ++++++-----
 include/crm/stonith-ng.h          |  1 +
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/daemons/fenced/fenced_history.c b/daemons/fenced/fenced_history.c
index b65b64c7f..cd08d7460 100644
--- a/daemons/fenced/fenced_history.c
+++ b/daemons/fenced/fenced_history.c
@@ -420,6 +420,11 @@ stonith_fence_history(xmlNode *msg, xmlNode **output,
         stonith_fence_history_cleanup(target,
             crm_element_value(msg, F_STONITH_CALLID) != NULL);
     } else if (options & st_opt_broadcast) {
+        /* there is no clear sign atm for when a history sync
+           is done so send a notification for anything
+           that smells like history-sync
+         */
+        do_stonith_notify(0, T_STONITH_NOTIFY_HISTORY_SYNCED, 0, NULL);
         if (crm_element_value(msg, F_STONITH_CALLID)) {
             /* this is coming from the stonith-API
             *
diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c
index 7e9bb0766..7a87f93f7 100644
--- a/daemons/fenced/pacemaker-fenced.c
+++ b/daemons/fenced/pacemaker-fenced.c
@@ -279,6 +279,9 @@ get_stonith_flag(const char *name)
     } else if (safe_str_eq(name, T_STONITH_NOTIFY_HISTORY)) {
         return st_callback_notify_history;
 
+    } else if (safe_str_eq(name, T_STONITH_NOTIFY_HISTORY_SYNCED)) {
+        return st_callback_notify_history_synced;
+
     }
     return st_callback_unknown;
 }
diff --git a/daemons/fenced/pacemaker-fenced.h b/daemons/fenced/pacemaker-fenced.h
index a8531a69c..583cb47a1 100644
--- a/daemons/fenced/pacemaker-fenced.h
+++ b/daemons/fenced/pacemaker-fenced.h
@@ -158,11 +158,12 @@ typedef struct remote_fencing_op_s {
 void stonith_bcast_result_to_peers(remote_fencing_op_t * op, int rc);
 
 enum st_callback_flags {
-    st_callback_unknown        = 0x0000,
-    st_callback_notify_fence   = 0x0001,
-    st_callback_device_add     = 0x0004,
-    st_callback_device_del     = 0x0010,
-    st_callback_notify_history = 0x0020
+    st_callback_unknown               = 0x0000,
+    st_callback_notify_fence          = 0x0001,
+    st_callback_device_add            = 0x0004,
+    st_callback_device_del            = 0x0010,
+    st_callback_notify_history        = 0x0020,
+    st_callback_notify_history_synced = 0x0040
 };
 
 /*
diff --git a/include/crm/stonith-ng.h b/include/crm/stonith-ng.h
index b6407324d..418a03c85 100644
--- a/include/crm/stonith-ng.h
+++ b/include/crm/stonith-ng.h
@@ -29,6 +29,7 @@ extern "C" {
 #  define T_STONITH_NOTIFY_DISCONNECT     "st_notify_disconnect"
 #  define T_STONITH_NOTIFY_FENCE          "st_notify_fence"
 #  define T_STONITH_NOTIFY_HISTORY        "st_notify_history"
+#  define T_STONITH_NOTIFY_HISTORY_SYNCED "st_notify_history_synced"
 
 /* *INDENT-OFF* */
 enum stonith_state {
-- 
2.26.2

openSUSE Build Service is sponsored by