Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.6:Update
pacemaker
pacemaker#3292-0001-Log-scheduler-improve-logs-...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker#3292-0001-Log-scheduler-improve-logs-for-invalid-id-ref-s.patch of Package pacemaker
From a183dff646d40103f8a852a226abc7d32bcfd946 Mon Sep 17 00:00:00 2001 From: Ken Gaillot <kgaillot@redhat.com> Date: Tue, 23 May 2023 11:00:27 -0500 Subject: [PATCH] Log: scheduler: improve logs for invalid id-ref's Always treat as configuration error --- lib/common/xml.c | 9 +++++---- lib/pacemaker/pcmk_sched_location.c | 3 +-- lib/pengine/rules.c | 11 +++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) Index: pacemaker-2.1.7+20231219.0f7f88312/lib/common/xml.c =================================================================== --- pacemaker-2.1.7+20231219.0f7f88312.orig/lib/common/xml.c +++ pacemaker-2.1.7+20231219.0f7f88312/lib/common/xml.c @@ -2569,12 +2569,13 @@ expand_idref(xmlNode * input, xmlNode * char *xpath_string = crm_strdup_printf("//%s[@" XML_ATTR_ID "='%s']", result->name, ref); - result = get_xpath_object(xpath_string, top, LOG_ERR); - if (result == NULL) { + result = get_xpath_object(xpath_string, top, LOG_DEBUG); + if (result == NULL) { // Not possible with schema validation enabled char *nodePath = (char *)xmlGetNodePath(top); - crm_err("No match for %s found in %s: Invalid configuration", - xpath_string, pcmk__s(nodePath, "unrecognizable path")); + pcmk__config_err("Ignoring invalid %s configuration: " + XML_ATTR_IDREF " '%s' does not reference " + "a valid object", result->name, ref); free(nodePath); } free(xpath_string); Index: pacemaker-2.1.7+20231219.0f7f88312/lib/pacemaker/pcmk_sched_location.c =================================================================== --- pacemaker-2.1.7+20231219.0f7f88312.orig/lib/pacemaker/pcmk_sched_location.c +++ pacemaker-2.1.7+20231219.0f7f88312/lib/pacemaker/pcmk_sched_location.c @@ -74,7 +74,7 @@ generate_location_rule(pcmk_resource_t * rule_xml = expand_idref(rule_xml, rsc->cluster->input); if (rule_xml == NULL) { - return NULL; + return NULL; // Error already logged } rule_id = crm_element_value(rule_xml, XML_ATTR_ID); Index: pacemaker-2.1.7+20231219.0f7f88312/lib/pengine/rules.c =================================================================== --- pacemaker-2.1.7+20231219.0f7f88312.orig/lib/pengine/rules.c +++ pacemaker-2.1.7+20231219.0f7f88312/lib/pengine/rules.c @@ -373,6 +373,10 @@ populate_hash(xmlNode * nvpair_list, GHa if (pcmk__str_eq((const char *)an_attr->name, XML_CIB_TAG_NVPAIR, pcmk__str_none)) { xmlNode *ref_nvpair = expand_idref(an_attr, top); + if (ref_nvpair == NULL) { + continue; // Not possible with schema validation enabled + } + name = crm_element_value(an_attr, XML_NVPAIR_ATTR_NAME); if (name == NULL) { name = crm_element_value(ref_nvpair, XML_NVPAIR_ATTR_NAME); @@ -465,8 +469,7 @@ make_pairs(xmlNode *top, const xmlNode * xmlNode *expanded_attr_set = expand_idref(attr_set, top); if (expanded_attr_set == NULL) { - // Schema (if not "none") prevents this - continue; + continue; // Not possible with schema validation enabled } pair = calloc(1, sizeof(sorted_set_t)); @@ -671,6 +674,10 @@ pe_eval_expr(xmlNode *rule, const pe_rul const char *value = NULL; rule = expand_idref(rule, NULL); + if (rule == NULL) { + return FALSE; // Not possible with schema validation enabled + } + value = crm_element_value(rule, XML_RULE_ATTR_BOOLEAN_OP); if (pcmk__str_eq(value, "or", pcmk__str_casei)) { do_and = FALSE;
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