Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:GA
pacemaker.34780
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.34780
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.2+20211124.ada5c3b36/lib/common/xml.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/lib/common/xml.c +++ pacemaker-2.1.2+20211124.ada5c3b36/lib/common/xml.c @@ -2879,12 +2879,13 @@ expand_idref(xmlNode * input, xmlNode * if (ref != NULL) { char *xpath_string = crm_strdup_printf("//%s[@id='%s']", tag, 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, - crm_str(nodePath)); + 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.2+20211124.ada5c3b36/lib/pacemaker/pcmk_sched_location.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/lib/pacemaker/pcmk_sched_location.c +++ pacemaker-2.1.2+20211124.ada5c3b36/lib/pacemaker/pcmk_sched_location.c @@ -70,7 +70,7 @@ generate_location_rule(pe_resource_t *rs rule_xml = expand_idref(rule_xml, data_set->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.2+20211124.ada5c3b36/lib/pengine/rules.c =================================================================== --- pacemaker-2.1.2+20211124.ada5c3b36.orig/lib/pengine/rules.c +++ pacemaker-2.1.2+20211124.ada5c3b36/lib/pengine/rules.c @@ -372,6 +372,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); @@ -547,8 +551,7 @@ make_pairs(xmlNode *top, xmlNode *xml_ob 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)); @@ -771,6 +774,10 @@ pe_eval_expr(xmlNode *rule, pe_rule_eval 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