File pacemaker-crmd-eliminate-size-restriction-on-node-state-xpath.patch of Package pacemaker.14737
commit bb688a51e787c556f918dfc83a477dad3c292f38
Author: Ken Gaillot <kgaillot@redhat.com>
Date: Mon Aug 21 17:05:50 2017 -0500
Low: crmd: eliminate size restriction on node state xpath
This refactor also improves the log message
diff --git a/crmd/utils.c b/crmd/utils.c
index 2d7bdaad7..765aa4d16 100644
--- a/crmd/utils.c
+++ b/crmd/utils.c
@@ -993,18 +993,21 @@ erase_xpath_callback(xmlNode * msg, int call_id, int rc, xmlNode * output, void
"Deletion of \"%s\": %s (rc=%d)", xpath, pcmk_strerror(rc), rc);
}
+#define XPATH_STATUS_TAG "//node_state[@uname='%s']/%s"
+
void
erase_status_tag(const char *uname, const char *tag, int options)
{
- int rc = pcmk_ok;
- char xpath[STATUS_PATH_MAX];
- int cib_opts = cib_quorum_override | cib_xpath | options;
-
if (fsa_cib_conn && uname) {
- snprintf(xpath, STATUS_PATH_MAX, "//node_state[@uname='%s']/%s", uname, tag);
- crm_info("Deleting xpath: %s", xpath);
- rc = fsa_cib_conn->cmds->delete(fsa_cib_conn, xpath, NULL, cib_opts);
- fsa_register_cib_callback(rc, FALSE, strdup(xpath), erase_xpath_callback);
+ int call_id;
+ char *xpath = crm_strdup_printf(XPATH_STATUS_TAG, uname, tag);
+
+ crm_info("Deleting %s status entries for %s " CRM_XS " xpath=%s",
+ tag, uname, xpath);
+ call_id = fsa_cib_conn->cmds->delete(fsa_cib_conn, xpath, NULL,
+ cib_quorum_override | cib_xpath | options);
+ fsa_register_cib_callback(call_id, FALSE, xpath, erase_xpath_callback);
+ // CIB library handles freeing xpath
}
}