Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
pacemaker.34783
bsc#1207319-0002-Fix-libpacemaker-avoid-asserti...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1207319-0002-Fix-libpacemaker-avoid-assertion-failure-if-a-node_s.patch of Package pacemaker.34783
From e46bd496da15932f697b23d7a6e2441575e450ba Mon Sep 17 00:00:00 2001 From: "Gao,Yan" <ygao@suse.com> Date: Wed, 25 Jan 2023 12:36:37 +0100 Subject: [PATCH 2/2] Fix: libpacemaker: avoid assertion failure if a node_state entry doesn't have an uname yet It's possible that a node_state entry doesn't have an uname yet. Previously in that case upon simulate_fencing_action(), crm_simulate would encounter an assertion failure in pcmk__inject_node() at: CRM_ASSERT(rc == pcmk_ok); , since a query by uname wouldn't find the existing node_state entry, then the unnecessary creation of a new entry would conflict with the existing one and a new query by uname would still get nothing. This commit fixes it by finding the existing node_state entry by node id and adding its uname to the entry rather than creating a new entry. --- lib/pacemaker/pcmk_sched_transition.c | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) Index: pacemaker-2.1.2+20211124.ada5c3b36/lib/pacemaker/pcmk_sched_transition.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/lib/pacemaker/pcmk_sched_transition.c +++ pacemaker-2.1.2+20211124.ada5c3b36/lib/pacemaker/pcmk_sched_transition.c @@ -158,6 +158,7 @@ inject_node_state(cib_t * cib_conn, cons xmlNode *cib_object = NULL; char *xpath = crm_strdup_printf(NODE_TEMPLATE, node); bool duplicate = false; + char *found_uuid = NULL; if (bringing_nodes_online) { create_node_entry(cib_conn, node); @@ -173,21 +174,45 @@ inject_node_state(cib_t * cib_conn, cons } if (rc == -ENXIO) { - char *found_uuid = NULL; - if (uuid == NULL) { query_node_uuid(cib_conn, node, &found_uuid, NULL); } else { found_uuid = strdup(uuid); } + if (found_uuid) { + char *xpath_by_uuid = crm_strdup_printf("//" XML_CIB_TAG_STATE "[@" XML_ATTR_ID "='%s']", + found_uuid); + + // It's possible that a node_state entry doesn't have an uname yet. + rc = cib_conn->cmds->query(cib_conn, xpath_by_uuid, &cib_object, + cib_xpath|cib_sync_call|cib_scope_local); + + if ((cib_object != NULL) && (ID(cib_object) == NULL)) { + crm_err("Detected multiple node_state entries for xpath=%s, bailing", + xpath_by_uuid); + duplicate = true; + free(xpath_by_uuid); + goto done; + + } else if (cib_object != NULL) { + crm_xml_add(cib_object, XML_ATTR_UNAME, node); + + rc = cib_conn->cmds->modify(cib_conn, XML_CIB_TAG_STATUS, cib_object, + cib_sync_call|cib_scope_local); + } + + free(xpath_by_uuid); + } + } + + if (rc == -ENXIO) { cib_object = create_xml_node(NULL, XML_CIB_TAG_STATE); crm_xml_add(cib_object, XML_ATTR_UUID, found_uuid); crm_xml_add(cib_object, XML_ATTR_UNAME, node); cib_conn->cmds->create(cib_conn, XML_CIB_TAG_STATUS, cib_object, cib_sync_call | cib_scope_local); free_xml(cib_object); - free(found_uuid); rc = cib_conn->cmds->query(cib_conn, xpath, &cib_object, cib_xpath | cib_sync_call | cib_scope_local); @@ -195,6 +220,7 @@ inject_node_state(cib_t * cib_conn, cons } done: + free(found_uuid); free(xpath); if (duplicate) {
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor