Blob Blame History Raw
From 457e231256feb0bdcf206209e03f0875f50d03b3 Mon Sep 17 00:00:00 2001
From: Ken Gaillot <kgaillot@redhat.com>
Date: Tue, 14 Jan 2020 16:24:08 -0600
Subject: [PATCH 14/18] Low: tools: for down nodes, crm_resource --refresh
 should clear CIB only

This provides a mechanism to manually clear shutdown locks.
---
 tools/crm_resource_runtime.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
index ed5fb03..e89b572 100644
--- a/tools/crm_resource_runtime.c
+++ b/tools/crm_resource_runtime.c
@@ -473,6 +473,7 @@ send_lrm_rsc_op(crm_ipc_t * crmd_channel, const char *op,
     const char *rsc_type = NULL;
     xmlNode *params = NULL;
     xmlNode *msg_data = NULL;
+    bool cib_only = false;
     resource_t *rsc = pe_find_resource(data_set->resources, rsc_id);
 
     if (rsc == NULL) {
@@ -504,10 +505,14 @@ send_lrm_rsc_op(crm_ipc_t * crmd_channel, const char *op,
         }
 
         if (!(node->details->online)) {
-            CMD_ERR("Node %s is not online", host_uname);
-            return -ENOTCONN;
+            if (strcmp(op, CRM_OP_LRM_DELETE) == 0) {
+                cib_only = true;
+            } else {
+                CMD_ERR("Node %s is not online", host_uname);
+                return -ENOTCONN;
+            }
         }
-        if (pe__is_guest_or_remote_node(node)) {
+        if (!cib_only && pe__is_guest_or_remote_node(node)) {
             node = pe__current_node(node->details->remote_rsc);
             if (node == NULL) {
                 CMD_ERR("No cluster connection to Pacemaker Remote node %s detected",
@@ -533,6 +538,11 @@ send_lrm_rsc_op(crm_ipc_t * crmd_channel, const char *op,
         crm_xml_add(msg_data, XML_LRM_ATTR_ROUTER_NODE, router_node);
     }
 
+    if (cib_only) {
+        // Indicate that only the CIB needs to be cleaned
+        crm_xml_add(msg_data, PCMK__XA_MODE, XML_TAG_CIB);
+    }
+
     xml_rsc = create_xml_node(msg_data, XML_CIB_TAG_RESOURCE);
     if (rsc->clone_name) {
         crm_xml_add(xml_rsc, XML_ATTR_ID, rsc->clone_name);
-- 
1.8.3.1