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

From 4625dd976d9e9cd08e0fefa0bbe057fb91510d98 Mon Sep 17 00:00:00 2001
From: Klaus Wenninger <klaus.wenninger@aon.at>
Date: Mon, 8 Jul 2019 19:12:53 +0200
Subject: [PATCH 3/8] Feature: fence-history: add notification upon
 history-synced

---
 fencing/history.c        |  5 +++++
 fencing/internal.h       | 11 ++++++-----
 fencing/main.c           |  3 +++
 include/crm/stonith-ng.h |  1 +
 4 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/fencing/history.c b/fencing/history.c
index c48784886..4f1fc4a28 100644
--- a/fencing/history.c
+++ b/fencing/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/fencing/internal.h b/fencing/internal.h
index cd48b53a1..a51b0e628 100644
--- a/fencing/internal.h
+++ b/fencing/internal.h
@@ -151,11 +151,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/fencing/main.c b/fencing/main.c
index 82bee8608..624937efa 100644
--- a/fencing/main.c
+++ b/fencing/main.c
@@ -301,6 +301,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/include/crm/stonith-ng.h b/include/crm/stonith-ng.h
index 045521ab3..23f879b80 100644
--- a/include/crm/stonith-ng.h
+++ b/include/crm/stonith-ng.h
@@ -35,6 +35,7 @@
 #  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