Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2: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_constraints.c | 3 +-- lib/pengine/rules.c | 11 +++++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) Index: pacemaker-2.0.4+20200616.2deceaa3a/lib/common/xml.c =================================================================== --- pacemaker-2.0.4+20200616.2deceaa3a.orig/lib/common/xml.c +++ pacemaker-2.0.4+20200616.2deceaa3a/lib/common/xml.c @@ -4488,12 +4488,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.0.4+20200616.2deceaa3a/lib/pengine/rules.c =================================================================== --- pacemaker-2.0.4+20200616.2deceaa3a.orig/lib/pengine/rules.c +++ pacemaker-2.0.4+20200616.2deceaa3a/lib/pengine/rules.c @@ -72,6 +72,10 @@ pe_test_rule(xmlNode *rule, GHashTable * 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 (safe_str_eq(value, "or")) { do_and = FALSE; @@ -756,6 +760,10 @@ populate_hash(xmlNode * nvpair_list, GHa if (crm_str_eq((const char *)an_attr->name, XML_CIB_TAG_NVPAIR, TRUE)) { 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); @@ -932,7 +940,7 @@ make_pairs(xmlNode *top, xmlNode *xml_ob pair = NULL; attr_set = expand_idref(attr_set, top); if (attr_set == NULL) { - continue; + continue; // Not possible with schema validation enabled } pair = calloc(1, sizeof(sorted_set_t));
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