Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
pacemaker.34780
pacemaker#3413-0001-Low-libpacemaker-pcmk__inje...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker#3413-0001-Low-libpacemaker-pcmk__inject_failcount-should-set-a.patch of Package pacemaker.34780
From ce3a9863dfbf5d20eedccab45da877feffac1470 Mon Sep 17 00:00:00 2001 From: Reid Wahl <nrwahl@protonmail.com> Date: Wed, 3 Apr 2024 16:43:43 -0700 Subject: [PATCH 1/3] Low: libpacemaker: pcmk__inject_failcount should set an integer value Currently it sets the new failcount value to "value++". The idea was that this should increment the existing value. In practice, it always sets the value to 1. This is due to a bug in fix_plus_plus_recursive that will be fixed in an upcoming commit. To summarize, fix_plus_plus_recursive() doesn't have access to the initial value, so it treats the initial value as zero when incrementing it. Signed-off-by: Reid Wahl <nrwahl@protonmail.com> --- lib/pacemaker/libpacemaker_private.h | 6 +-- lib/pacemaker/pcmk_sched_transition.c | 59 +++++++++++++++++++--------- lib/pacemaker/pcmk_simulate.c | 2 +- 3 files changed, 44 insertions(+), 23 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 @@ -66,28 +66,48 @@ inject_transient_attr(xmlNode * cib_node } static void -update_failcounts(xmlNode * cib_node, const char *resource, const char *task, - guint interval_ms, int rc) +update_failcounts(cib_t *cib_conn, xmlNode *cib_node, + const char *resource, const char *task, + guint interval_ms, int exit_status) { - if (rc == 0) { - return; + char *name = NULL; + char *value = NULL; + + int failcount = 0; + + CRM_CHECK((cib_conn != NULL) && (cib_node != NULL) + && (resource != NULL) && (task != NULL), return); - } else if ((rc == 7) && (interval_ms == 0)) { + if ((exit_status == PCMK_OCF_OK) + || ((exit_status == PCMK_OCF_NOT_RUNNING) && (interval_ms == 0))) { return; + } - } else { - char *name = NULL; - char *now = pcmk__ttoa(time(NULL)); + // Get current failcount and increment it + name = pcmk__failcount_name(resource, task, interval_ms); + + if (read_attr_delegate(cib_conn, XML_CIB_TAG_STATUS, + ID(cib_node), NULL, NULL, NULL, name, + &value, TRUE, NULL) == pcmk_rc_ok) { - name = pcmk__failcount_name(resource, task, interval_ms); - inject_transient_attr(cib_node, name, "value++"); - free(name); - - name = pcmk__lastfailure_name(resource, task, interval_ms); - inject_transient_attr(cib_node, name, now); - free(name); - free(now); + if (pcmk__scan_min_int(value, &failcount, 0) != pcmk_rc_ok) { + failcount = 0; + } } + free(value); + + value = pcmk__itoa(failcount + 1); + inject_transient_attr(cib_node, name, value); + + free(name); + free(value); + + name = pcmk__lastfailure_name(resource, task, interval_ms); + value = pcmk__ttoa(time(NULL)); + inject_transient_attr(cib_node, name, value); + + free(name); + free(value); } static void @@ -596,7 +616,8 @@ modify_configuration(pe_working_set_t * cib_node = inject_node_state(cib, node, NULL); CRM_ASSERT(cib_node != NULL); - update_failcounts(cib_node, resource, task, interval_ms, outcome); + update_failcounts(cib, cib_node, resource, task, interval_ms, + outcome); cib_resource = inject_resource(cib_node, resource, resource, rclass, rtype, rprovider); @@ -753,7 +774,7 @@ exec_rsc_action(crm_graph_t * graph, crm crm__set_graph_action_flags(action, pcmk__graph_action_failed); graph->abort_priority = INFINITY; out->info(out, "Pretending action %d failed with rc=%d", action->id, op->rc); - update_failcounts(cib_node, match_name, op->op_type, + update_failcounts(fake_cib, cib_node, match_name, op->op_type, op->interval_ms, op->rc); break; }
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