Blob Blame History Raw
From 243139b2ec0f6b17877a4e7f651fc3f70f76b11a Mon Sep 17 00:00:00 2001
From: Christine Caulfield <ccaulfie@redhat.com>
Date: Fri, 6 May 2022 15:23:43 +0100
Subject: [PATCH 1/2] fenced: Don't ignore CIB updates if stonith-enabled=false

Fixes: T378
---
 daemons/fenced/pacemaker-fenced.c | 23 +++--------------------
 1 file changed, 3 insertions(+), 20 deletions(-)

diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c
index caab7de83..dadd187b6 100644
--- a/daemons/fenced/pacemaker-fenced.c
+++ b/daemons/fenced/pacemaker-fenced.c
@@ -1136,11 +1136,8 @@ static void
 update_cib_cache_cb(const char *event, xmlNode * msg)
 {
     int rc = pcmk_ok;
-    xmlNode *stonith_enabled_xml = NULL;
-    static gboolean stonith_enabled_saved = TRUE;
     long timeout_ms_saved = stonith_watchdog_timeout_ms;
     gboolean need_full_refresh = FALSE;
-    bool value = false;
 
     if(!have_cib_devices) {
         crm_trace("Skipping updates until we get a full dump");
@@ -1191,32 +1188,18 @@ update_cib_cache_cb(const char *event, xmlNode * msg)
             return;
         }
         CRM_ASSERT(local_cib != NULL);
-        stonith_enabled_saved = FALSE; /* Trigger a full refresh below */
+        need_full_refresh = TRUE;
     }
 
     pcmk__refresh_node_caches_from_cib(local_cib);
     update_stonith_watchdog_timeout_ms(local_cib);
 
-    stonith_enabled_xml = get_xpath_object("//nvpair[@name='stonith-enabled']",
-                                           local_cib, LOG_NEVER);
-    if (pcmk__xe_get_bool_attr(stonith_enabled_xml, XML_NVPAIR_ATTR_VALUE, &value) == pcmk_rc_ok && !value) {
-        crm_trace("Ignoring CIB updates while fencing is disabled");
-        stonith_enabled_saved = FALSE;
-
-    } else if (stonith_enabled_saved == FALSE) {
-        crm_info("Updating fencing device and topology lists "
-                 "now that fencing is enabled");
-        stonith_enabled_saved = TRUE;
-        need_full_refresh = TRUE;
-
-    } else {
-        if (timeout_ms_saved != stonith_watchdog_timeout_ms) {
+    if (timeout_ms_saved != stonith_watchdog_timeout_ms) {
             need_full_refresh = TRUE;
-        } else {
+    } else {
             update_fencing_topology(event, msg);
             update_cib_stonith_devices(event, msg);
             watchdog_device_update();
-        }
     }
 
     if (need_full_refresh) {
-- 
2.31.1


From c600ef49022e7473acbe121fae50a0c1aa2d7c03 Mon Sep 17 00:00:00 2001
From: Christine Caulfield <ccaulfie@redhat.com>
Date: Thu, 9 Jun 2022 11:08:43 +0100
Subject: [PATCH 2/2] Also don't check for stonith-disabled in
 update_stonith_watchdog_timeout_ms

---
 daemons/fenced/pacemaker-fenced.c | 34 +++++++++++--------------------
 1 file changed, 12 insertions(+), 22 deletions(-)

diff --git a/daemons/fenced/pacemaker-fenced.c b/daemons/fenced/pacemaker-fenced.c
index dadd187b6..ec42d5bc2 100644
--- a/daemons/fenced/pacemaker-fenced.c
+++ b/daemons/fenced/pacemaker-fenced.c
@@ -643,31 +643,21 @@ watchdog_device_update(void)
 static void
 update_stonith_watchdog_timeout_ms(xmlNode *cib)
 {
-    xmlNode *stonith_enabled_xml = NULL;
-    bool stonith_enabled = false;
-    int rc = pcmk_rc_ok;
     long timeout_ms = 0;
+    xmlNode *stonith_watchdog_xml = NULL;
+    const char *value = NULL;
 
-    stonith_enabled_xml = get_xpath_object("//nvpair[@name='stonith-enabled']",
-                                           cib, LOG_NEVER);
-    rc = pcmk__xe_get_bool_attr(stonith_enabled_xml, XML_NVPAIR_ATTR_VALUE, &stonith_enabled);
-
-    if (rc != pcmk_rc_ok || stonith_enabled) {
-        xmlNode *stonith_watchdog_xml = NULL;
-        const char *value = NULL;
-
-        stonith_watchdog_xml = get_xpath_object("//nvpair[@name='stonith-watchdog-timeout']",
-                                                cib, LOG_NEVER);
-        if (stonith_watchdog_xml) {
-            value = crm_element_value(stonith_watchdog_xml, XML_NVPAIR_ATTR_VALUE);
-        }
-        if (value) {
-            timeout_ms = crm_get_msec(value);
-        }
+    stonith_watchdog_xml = get_xpath_object("//nvpair[@name='stonith-watchdog-timeout']",
+					    cib, LOG_NEVER);
+    if (stonith_watchdog_xml) {
+        value = crm_element_value(stonith_watchdog_xml, XML_NVPAIR_ATTR_VALUE);
+    }
+    if (value) {
+        timeout_ms = crm_get_msec(value);
+    }
 
-        if (timeout_ms < 0) {
-            timeout_ms = pcmk__auto_watchdog_timeout();
-        }
+    if (timeout_ms < 0) {
+        timeout_ms = pcmk__auto_watchdog_timeout();
     }
 
     stonith_watchdog_timeout_ms = timeout_ms;
-- 
2.31.1