Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
pacemaker.34782
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.34782
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.0.5+20201202.ba59be712/lib/pacemaker/pcmk_sched_transition.c =================================================================== --- pacemaker-2.0.5+20201202.ba59be712.orig/lib/pacemaker/pcmk_sched_transition.c +++ pacemaker-2.0.5+20201202.ba59be712/lib/pacemaker/pcmk_sched_transition.c @@ -77,28 +77,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 = crm_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 ((failcount = crm_parse_int(value, "0")) < 0) { + failcount = 0; + } } + free(value); + + value = crm_itoa(failcount + 1); + inject_transient_attr(cib_node, name, value); + + free(name); + free(value); + + name = pcmk__lastfailure_name(resource, task, interval_ms); + value = crm_ttoa(time(NULL)); + inject_transient_attr(cib_node, name, value); + + free(name); + free(value); } static void @@ -603,7 +623,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); @@ -761,7 +782,7 @@ exec_rsc_action(crm_graph_t * graph, crm action->failed = TRUE; graph->abort_priority = INFINITY; printf("\tPretending action %d failed with rc=%d\n", 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