Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP2:Update
pacemaker
pacemaker#3286-0001-Low-libcrmcommon-Check-corr...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File pacemaker#3286-0001-Low-libcrmcommon-Check-correct-env-vars-in-pcmk__nod.patch of Package pacemaker
From ff6109075c4c73f718d74fc449e8973917da0d20 Mon Sep 17 00:00:00 2001 From: Reid Wahl <nrwahl@protonmail.com> Date: Sat, 9 Dec 2023 12:09:57 -0800 Subject: [PATCH] Low: libcrmcommon: Check correct env vars in pcmk__node_attr_target() All CRM_meta environment variables begin with OCF_RESKEY_. Here we add the prefix. Previously, we were checking variables that never existed. It's likely that pcmk__node_attr_target() has never worked correctly with container-attribute-target=host. Resource agents have worked around this by calling ocf_attribute_target() from the resource-agents repo. Note that this fix only applies to container images built using a version of Pacemaker that includes the fix. Resource agents should continue using ocf_attribute_target() for a while, in case they're run by an older container. (The resource agents inside the Pacemaker source tree are obviously exempt.) Ref T733 Signed-off-by: Reid Wahl <nrwahl@protonmail.com> --- lib/common/attrd_client.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) Index: pacemaker-2.0.4+20200616.2deceaa3a/lib/common/attrd_client.c =================================================================== --- pacemaker-2.0.4+20200616.2deceaa3a.orig/lib/common/attrd_client.c +++ pacemaker-2.0.4+20200616.2deceaa3a/lib/common/attrd_client.c @@ -1,5 +1,5 @@ /* - * Copyright 2011-2020 the Pacemaker project contributors + * Copyright 2011-2023 the Pacemaker project contributors * * The version control history for this file may have further details. * @@ -272,7 +272,8 @@ pcmk__node_attr_request_clear(crm_ipc_t return rc; } -#define LRM_TARGET_ENV "OCF_RESKEY_" CRM_META "_" XML_LRM_ATTR_TARGET +#define OCF_RESKEY_PREFIX "OCF_RESKEY_" +#define LRM_TARGET_ENV OCF_RESKEY_PREFIX CRM_META "_" XML_LRM_ATTR_TARGET /*! * \internal @@ -288,10 +289,18 @@ pcmk__node_attr_target(const char *name) return name; } else { + char buf[128] = OCF_RESKEY_PREFIX; + size_t offset = sizeof(OCF_RESKEY_PREFIX) - 1; char *target_var = crm_meta_name(XML_RSC_ATTR_TARGET); char *phys_var = crm_meta_name(PCMK__ENV_PHYSICAL_HOST); - const char *target = getenv(target_var); - const char *host_physical = getenv(phys_var); + const char *target = NULL; + const char *host_physical = NULL; + + snprintf(buf + offset, sizeof(buf) - offset, "%s", target_var); + target = getenv(buf); + + snprintf(buf + offset, sizeof(buf) - offset, "%s", phys_var); + host_physical = getenv(buf); // It is important to use the name by which the scheduler knows us if (host_physical && safe_str_eq(target, "host")) {
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