Blame SOURCES/001-stonith-enabled.patch

36923b
From 243139b2ec0f6b17877a4e7f651fc3f70f76b11a Mon Sep 17 00:00:00 2001
36923b
From: Christine Caulfield <ccaulfie@redhat.com>
36923b
Date: Fri, 6 May 2022 15:23:43 +0100
36923b
Subject: [PATCH 1/2] fenced: Don't ignore CIB updates if stonith-enabled=false
36923b
36923b
Fixes: T378
36923b
---
36923b
 daemons/fenced/pacemaker-fenced.c | 23 +++--------------------
36923b
 1 file changed, 3 insertions(+), 20 deletions(-)
36923b
36923b
diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c
36923b
index caab7de83..dadd187b6 100644
36923b
--- a/daemons/fenced/pacemaker-fenced.c
36923b
+++ b/daemons/fenced/pacemaker-fenced.c
36923b
@@ -1136,11 +1136,8 @@ static void
36923b
 update_cib_cache_cb(const char *event, xmlNode * msg)
36923b
 {
36923b
     int rc = pcmk_ok;
36923b
-    xmlNode *stonith_enabled_xml = NULL;
36923b
-    static gboolean stonith_enabled_saved = TRUE;
36923b
     long timeout_ms_saved = stonith_watchdog_timeout_ms;
36923b
     gboolean need_full_refresh = FALSE;
36923b
-    bool value = false;
36923b
 
36923b
     if(!have_cib_devices) {
36923b
         crm_trace("Skipping updates until we get a full dump");
36923b
@@ -1191,32 +1188,18 @@ update_cib_cache_cb(const char *event, xmlNode * msg)
36923b
             return;
36923b
         }
36923b
         CRM_ASSERT(local_cib != NULL);
36923b
-        stonith_enabled_saved = FALSE; /* Trigger a full refresh below */
36923b
+        need_full_refresh = TRUE;
36923b
     }
36923b
 
36923b
     pcmk__refresh_node_caches_from_cib(local_cib);
36923b
     update_stonith_watchdog_timeout_ms(local_cib);
36923b
 
36923b
-    stonith_enabled_xml = get_xpath_object("//nvpair[@name='stonith-enabled']",
36923b
-                                           local_cib, LOG_NEVER);
36923b
-    if (pcmk__xe_get_bool_attr(stonith_enabled_xml, XML_NVPAIR_ATTR_VALUE, &value) == pcmk_rc_ok && !value) {
36923b
-        crm_trace("Ignoring CIB updates while fencing is disabled");
36923b
-        stonith_enabled_saved = FALSE;
36923b
-
36923b
-    } else if (stonith_enabled_saved == FALSE) {
36923b
-        crm_info("Updating fencing device and topology lists "
36923b
-                 "now that fencing is enabled");
36923b
-        stonith_enabled_saved = TRUE;
36923b
-        need_full_refresh = TRUE;
36923b
-
36923b
-    } else {
36923b
-        if (timeout_ms_saved != stonith_watchdog_timeout_ms) {
36923b
+    if (timeout_ms_saved != stonith_watchdog_timeout_ms) {
36923b
             need_full_refresh = TRUE;
36923b
-        } else {
36923b
+    } else {
36923b
             update_fencing_topology(event, msg);
36923b
             update_cib_stonith_devices(event, msg);
36923b
             watchdog_device_update();
36923b
-        }
36923b
     }
36923b
 
36923b
     if (need_full_refresh) {
36923b
-- 
36923b
2.31.1
36923b
36923b
36923b
From c600ef49022e7473acbe121fae50a0c1aa2d7c03 Mon Sep 17 00:00:00 2001
36923b
From: Christine Caulfield <ccaulfie@redhat.com>
36923b
Date: Thu, 9 Jun 2022 11:08:43 +0100
36923b
Subject: [PATCH 2/2] Also don't check for stonith-disabled in
36923b
 update_stonith_watchdog_timeout_ms
36923b
36923b
---
36923b
 daemons/fenced/pacemaker-fenced.c | 34 +++++++++++--------------------
36923b
 1 file changed, 12 insertions(+), 22 deletions(-)
36923b
36923b
diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c
36923b
index dadd187b6..ec42d5bc2 100644
36923b
--- a/daemons/fenced/pacemaker-fenced.c
36923b
+++ b/daemons/fenced/pacemaker-fenced.c
36923b
@@ -643,31 +643,21 @@ watchdog_device_update(void)
36923b
 static void
36923b
 update_stonith_watchdog_timeout_ms(xmlNode *cib)
36923b
 {
36923b
-    xmlNode *stonith_enabled_xml = NULL;
36923b
-    bool stonith_enabled = false;
36923b
-    int rc = pcmk_rc_ok;
36923b
     long timeout_ms = 0;
36923b
+    xmlNode *stonith_watchdog_xml = NULL;
36923b
+    const char *value = NULL;
36923b
 
36923b
-    stonith_enabled_xml = get_xpath_object("//nvpair[@name='stonith-enabled']",
36923b
-                                           cib, LOG_NEVER);
36923b
-    rc = pcmk__xe_get_bool_attr(stonith_enabled_xml, XML_NVPAIR_ATTR_VALUE, &stonith_enabled);
36923b
-
36923b
-    if (rc != pcmk_rc_ok || stonith_enabled) {
36923b
-        xmlNode *stonith_watchdog_xml = NULL;
36923b
-        const char *value = NULL;
36923b
-
36923b
-        stonith_watchdog_xml = get_xpath_object("//nvpair[@name='stonith-watchdog-timeout']",
36923b
-                                                cib, LOG_NEVER);
36923b
-        if (stonith_watchdog_xml) {
36923b
-            value = crm_element_value(stonith_watchdog_xml, XML_NVPAIR_ATTR_VALUE);
36923b
-        }
36923b
-        if (value) {
36923b
-            timeout_ms = crm_get_msec(value);
36923b
-        }
36923b
+    stonith_watchdog_xml = get_xpath_object("//nvpair[@name='stonith-watchdog-timeout']",
36923b
+					    cib, LOG_NEVER);
36923b
+    if (stonith_watchdog_xml) {
36923b
+        value = crm_element_value(stonith_watchdog_xml, XML_NVPAIR_ATTR_VALUE);
36923b
+    }
36923b
+    if (value) {
36923b
+        timeout_ms = crm_get_msec(value);
36923b
+    }
36923b
 
36923b
-        if (timeout_ms < 0) {
36923b
-            timeout_ms = pcmk__auto_watchdog_timeout();
36923b
-        }
36923b
+    if (timeout_ms < 0) {
36923b
+        timeout_ms = pcmk__auto_watchdog_timeout();
36923b
     }
36923b
 
36923b
     stonith_watchdog_timeout_ms = timeout_ms;
36923b
-- 
36923b
2.31.1
36923b