|
|
af918f |
From ba17007f04d2fdbd2147c14c7eedb0de137ff448 Mon Sep 17 00:00:00 2001
|
|
|
af918f |
From: Ken Gaillot <kgaillot@redhat.com>
|
|
|
af918f |
Date: Fri, 13 Dec 2019 11:38:49 -0600
|
|
|
af918f |
Subject: [PATCH 05/10] Low: controller: don't clear shutdown locks when node
|
|
|
af918f |
rejoins
|
|
|
af918f |
|
|
|
af918f |
Add new controld_delete_node_state() values for clearing resource history
|
|
|
af918f |
while preserving shutdown locks. This is accomplished by deleting all
|
|
|
af918f |
unlocked lrm_resource entries and all lrm_rsc_op entries, instead of the entire
|
|
|
af918f |
lrm subsection.
|
|
|
af918f |
---
|
|
|
af918f |
crmd/cib.c | 22 +++++++++++++++++++++-
|
|
|
af918f |
crmd/crmd_utils.h | 2 ++
|
|
|
af918f |
crmd/join_dc.c | 7 +++++--
|
|
|
af918f |
crmd/remote_lrmd_ra.c | 18 +++++++++++-------
|
|
|
af918f |
4 files changed, 39 insertions(+), 10 deletions(-)
|
|
|
af918f |
|
|
|
af918f |
diff --git a/crmd/cib.c b/crmd/cib.c
|
|
|
af918f |
index e8c6376..a9e4ed3 100644
|
|
|
af918f |
--- a/crmd/cib.c
|
|
|
af918f |
+++ b/crmd/cib.c
|
|
|
af918f |
@@ -247,12 +247,21 @@ cib_delete_callback(xmlNode *msg, int call_id, int rc, xmlNode *output,
|
|
|
af918f |
// Node's lrm section (name 1x)
|
|
|
af918f |
#define XPATH_NODE_LRM XPATH_NODE_STATE "/" XML_CIB_TAG_LRM
|
|
|
af918f |
|
|
|
af918f |
+// Node's lrm_rsc_op entries and lrm_resource entries without lock (name 2x)
|
|
|
af918f |
+#define XPATH_NODE_LRM_UNLOCKED XPATH_NODE_STATE "//" XML_LRM_TAG_RSC_OP \
|
|
|
af918f |
+ "|" XPATH_NODE_STATE \
|
|
|
af918f |
+ "//" XML_LRM_TAG_RESOURCE \
|
|
|
af918f |
+ "[not(@" XML_CONFIG_ATTR_SHUTDOWN_LOCK ")]"
|
|
|
af918f |
+
|
|
|
af918f |
// Node's transient_attributes section (name 1x)
|
|
|
af918f |
#define XPATH_NODE_ATTRS XPATH_NODE_STATE "/" XML_TAG_TRANSIENT_NODEATTRS
|
|
|
af918f |
|
|
|
af918f |
// Everything under node_state (name 1x)
|
|
|
af918f |
#define XPATH_NODE_ALL XPATH_NODE_STATE "/*"
|
|
|
af918f |
|
|
|
af918f |
+// Unlocked history + transient attributes (name 3x)
|
|
|
af918f |
+#define XPATH_NODE_ALL_UNLOCKED XPATH_NODE_LRM_UNLOCKED "|" XPATH_NODE_ATTRS
|
|
|
af918f |
+
|
|
|
af918f |
/*!
|
|
|
af918f |
* \internal
|
|
|
af918f |
* \brief Delete subsection of a node's CIB node_state
|
|
|
af918f |
@@ -274,6 +283,11 @@ controld_delete_node_state(const char *uname, enum controld_section_e section,
|
|
|
af918f |
xpath = crm_strdup_printf(XPATH_NODE_LRM, uname);
|
|
|
af918f |
desc = crm_strdup_printf("resource history for node %s", uname);
|
|
|
af918f |
break;
|
|
|
af918f |
+ case controld_section_lrm_unlocked:
|
|
|
af918f |
+ xpath = crm_strdup_printf(XPATH_NODE_LRM_UNLOCKED, uname, uname);
|
|
|
af918f |
+ desc = crm_strdup_printf("resource history (other than shutdown "
|
|
|
af918f |
+ "locks) for node %s", uname);
|
|
|
af918f |
+ break;
|
|
|
af918f |
case controld_section_attrs:
|
|
|
af918f |
xpath = crm_strdup_printf(XPATH_NODE_ATTRS, uname);
|
|
|
af918f |
desc = crm_strdup_printf("transient attributes for node %s", uname);
|
|
|
af918f |
@@ -282,6 +296,12 @@ controld_delete_node_state(const char *uname, enum controld_section_e section,
|
|
|
af918f |
xpath = crm_strdup_printf(XPATH_NODE_ALL, uname);
|
|
|
af918f |
desc = crm_strdup_printf("all state for node %s", uname);
|
|
|
af918f |
break;
|
|
|
af918f |
+ case controld_section_all_unlocked:
|
|
|
af918f |
+ xpath = crm_strdup_printf(XPATH_NODE_ALL_UNLOCKED,
|
|
|
af918f |
+ uname, uname, uname);
|
|
|
af918f |
+ desc = crm_strdup_printf("all state (other than shutdown locks) "
|
|
|
af918f |
+ "for node %s", uname);
|
|
|
af918f |
+ break;
|
|
|
af918f |
}
|
|
|
af918f |
|
|
|
af918f |
if (fsa_cib_conn == NULL) {
|
|
|
af918f |
@@ -290,7 +310,7 @@ controld_delete_node_state(const char *uname, enum controld_section_e section,
|
|
|
af918f |
} else {
|
|
|
af918f |
int call_id;
|
|
|
af918f |
|
|
|
af918f |
- options |= cib_quorum_override|cib_xpath;
|
|
|
af918f |
+ options |= cib_quorum_override|cib_xpath|cib_multiple;
|
|
|
af918f |
call_id = fsa_cib_conn->cmds->delete(fsa_cib_conn, xpath, NULL, options);
|
|
|
af918f |
crm_info("Deleting %s (via CIB call %d) " CRM_XS " xpath=%s",
|
|
|
af918f |
desc, call_id, xpath);
|
|
|
af918f |
diff --git a/crmd/crmd_utils.h b/crmd/crmd_utils.h
|
|
|
af918f |
index 9ecce88..77dcfc2 100644
|
|
|
af918f |
--- a/crmd/crmd_utils.h
|
|
|
af918f |
+++ b/crmd/crmd_utils.h
|
|
|
af918f |
@@ -120,8 +120,10 @@ bool controld_action_is_recordable(const char *action);
|
|
|
af918f |
// Subsections of node_state
|
|
|
af918f |
enum controld_section_e {
|
|
|
af918f |
controld_section_lrm,
|
|
|
af918f |
+ controld_section_lrm_unlocked,
|
|
|
af918f |
controld_section_attrs,
|
|
|
af918f |
controld_section_all,
|
|
|
af918f |
+ controld_section_all_unlocked
|
|
|
af918f |
};
|
|
|
af918f |
|
|
|
af918f |
void controld_delete_node_state(const char *uname,
|
|
|
af918f |
diff --git a/crmd/join_dc.c b/crmd/join_dc.c
|
|
|
af918f |
index 8284695..1553078 100644
|
|
|
af918f |
--- a/crmd/join_dc.c
|
|
|
af918f |
+++ b/crmd/join_dc.c
|
|
|
af918f |
@@ -534,6 +534,7 @@ do_dc_join_ack(long long action,
|
|
|
af918f |
int join_id = -1;
|
|
|
af918f |
int call_id = 0;
|
|
|
af918f |
ha_msg_input_t *join_ack = fsa_typed_data(fsa_dt_ha_msg);
|
|
|
af918f |
+ enum controld_section_e section = controld_section_lrm;
|
|
|
af918f |
|
|
|
af918f |
const char *op = crm_element_value(join_ack->msg, F_CRM_TASK);
|
|
|
af918f |
const char *join_from = crm_element_value(join_ack->msg, F_CRM_HOST_FROM);
|
|
|
af918f |
@@ -583,8 +584,10 @@ do_dc_join_ack(long long action,
|
|
|
af918f |
/* Update CIB with node's current LRM state. A new transition will be
|
|
|
af918f |
* triggered later, when the CIB notifies us of the change.
|
|
|
af918f |
*/
|
|
|
af918f |
- controld_delete_node_state(join_from, controld_section_lrm,
|
|
|
af918f |
- cib_scope_local);
|
|
|
af918f |
+ if (controld_shutdown_lock_enabled) {
|
|
|
af918f |
+ section = controld_section_lrm_unlocked;
|
|
|
af918f |
+ }
|
|
|
af918f |
+ controld_delete_node_state(join_from, section, cib_scope_local);
|
|
|
af918f |
if (safe_str_eq(join_from, fsa_our_uname)) {
|
|
|
af918f |
xmlNode *now_dc_lrmd_state = controld_query_executor_state(fsa_our_uname);
|
|
|
af918f |
|
|
|
af918f |
diff --git a/crmd/remote_lrmd_ra.c b/crmd/remote_lrmd_ra.c
|
|
|
af918f |
index c4f58d6..3870431 100644
|
|
|
af918f |
--- a/crmd/remote_lrmd_ra.c
|
|
|
af918f |
+++ b/crmd/remote_lrmd_ra.c
|
|
|
af918f |
@@ -1,5 +1,5 @@
|
|
|
af918f |
-/*
|
|
|
af918f |
- * Copyright 2013-2019 the Pacemaker project contributors
|
|
|
af918f |
+/*
|
|
|
af918f |
+ * Copyright 2013-2020 the Pacemaker project contributors
|
|
|
af918f |
*
|
|
|
af918f |
* The version control history for this file may have further details.
|
|
|
af918f |
*
|
|
|
af918f |
@@ -191,17 +191,21 @@ remote_node_up(const char *node_name)
|
|
|
af918f |
int call_opt, call_id = 0;
|
|
|
af918f |
xmlNode *update, *state;
|
|
|
af918f |
crm_node_t *node;
|
|
|
af918f |
+ enum controld_section_e section = controld_section_all;
|
|
|
af918f |
|
|
|
af918f |
CRM_CHECK(node_name != NULL, return);
|
|
|
af918f |
crm_info("Announcing pacemaker_remote node %s", node_name);
|
|
|
af918f |
|
|
|
af918f |
- /* Clear node's entire state (resource history and transient attributes).
|
|
|
af918f |
- * The transient attributes should and normally will be cleared when the
|
|
|
af918f |
- * node leaves, but since remote node state has a number of corner cases,
|
|
|
af918f |
- * clear them here as well, to be sure.
|
|
|
af918f |
+ /* Clear node's entire state (resource history and transient attributes)
|
|
|
af918f |
+ * other than shutdown locks. The transient attributes should and normally
|
|
|
af918f |
+ * will be cleared when the node leaves, but since remote node state has a
|
|
|
af918f |
+ * number of corner cases, clear them here as well, to be sure.
|
|
|
af918f |
*/
|
|
|
af918f |
call_opt = crmd_cib_smart_opt();
|
|
|
af918f |
- controld_delete_node_state(node_name, controld_section_all, call_opt);
|
|
|
af918f |
+ if (controld_shutdown_lock_enabled) {
|
|
|
af918f |
+ section = controld_section_all_unlocked;
|
|
|
af918f |
+ }
|
|
|
af918f |
+ controld_delete_node_state(node_name, section, call_opt);
|
|
|
af918f |
|
|
|
af918f |
/* Clear node's probed attribute */
|
|
|
af918f |
update_attrd(node_name, CRM_OP_PROBED, NULL, NULL, TRUE);
|
|
|
af918f |
--
|
|
|
af918f |
1.8.3.1
|
|
|
af918f |
|