Blame SOURCES/shutdown-lock-09.patch

af918f
From 8ab8d64976212207935bf165c26db32c1d79c344 Mon Sep 17 00:00:00 2001
af918f
From: Ken Gaillot <kgaillot@redhat.com>
af918f
Date: Tue, 14 Jan 2020 16:24:08 -0600
af918f
Subject: [PATCH 09/10] Low: tools: for down nodes, crm_resource --refresh
af918f
 should clear CIB only
af918f
af918f
This provides a mechanism to manually clear shutdown locks.
af918f
---
af918f
 tools/crm_resource_runtime.c | 16 +++++++++++++---
af918f
 1 file changed, 13 insertions(+), 3 deletions(-)
af918f
af918f
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
af918f
index 9b93928..acb9dbe 100644
af918f
--- a/tools/crm_resource_runtime.c
af918f
+++ b/tools/crm_resource_runtime.c
af918f
@@ -458,6 +458,7 @@ send_lrm_rsc_op(crm_ipc_t * crmd_channel, const char *op,
af918f
     const char *rsc_type = NULL;
af918f
     xmlNode *params = NULL;
af918f
     xmlNode *msg_data = NULL;
af918f
+    bool cib_only = false;
af918f
     resource_t *rsc = pe_find_resource(data_set->resources, rsc_id);
af918f
 
af918f
     if (rsc == NULL) {
af918f
@@ -489,10 +490,14 @@ send_lrm_rsc_op(crm_ipc_t * crmd_channel, const char *op,
af918f
         }
af918f
 
af918f
         if (!(node->details->online)) {
af918f
-            CMD_ERR("Node %s is not online", host_uname);
af918f
-            return -ENOTCONN;
af918f
+            if (strcmp(op, CRM_OP_LRM_DELETE) == 0) {
af918f
+                cib_only = true;
af918f
+            } else {
af918f
+                CMD_ERR("Node %s is not online", host_uname);
af918f
+                return -ENOTCONN;
af918f
+            }
af918f
         }
af918f
-        if (node && is_remote_node(node)) {
af918f
+        if (!cib_only && node && is_remote_node(node)) {
af918f
             node = pe__current_node(node->details->remote_rsc);
af918f
             if (node == NULL) {
af918f
                 CMD_ERR("No lrmd connection detected to remote node %s", host_uname);
af918f
@@ -517,6 +522,11 @@ send_lrm_rsc_op(crm_ipc_t * crmd_channel, const char *op,
af918f
         crm_xml_add(msg_data, XML_LRM_ATTR_ROUTER_NODE, router_node);
af918f
     }
af918f
 
af918f
+    if (cib_only) {
af918f
+        // Indicate that only the CIB needs to be cleaned
af918f
+        crm_xml_add(msg_data, PCMK__XA_MODE, XML_TAG_CIB);
af918f
+    }
af918f
+
af918f
     xml_rsc = create_xml_node(msg_data, XML_CIB_TAG_RESOURCE);
af918f
     if (rsc->clone_name) {
af918f
         crm_xml_add(xml_rsc, XML_ATTR_ID, rsc->clone_name);
af918f
-- 
af918f
1.8.3.1
af918f