pacemaker/bug-728579_pacemaker-stonith-dev-id.patch
Yan Gao d854adba09 - Update to version 2.1.9+20241107.c3b66b02d0:
- CTS: Fix cts-lab --list. (gh#ClusterLabs/pacemaker#3723)

- Update to version 2.1.9+20241105.e043e6816a:
- executor: avoid use-after-free upon shutdown (bsc#1232613, gh#ClusterLabs/pacemaker#3719)

- Update to version 2.1.9+20241031.49aab99839 (Pacemaker-2.1.9):
- includes: Bump CRM_FEATURE_SET for iso8601 formatted output.
- schemas: Add an XML schema for iso8601 output.
- tools: Convert iso8601 to formatted output.

- Update to version 2.1.8+20241021.40d69ff424 (Pacemaker-2.1.9-rc3):
- tools: restore crmadmin default timeout to 30 seconds (bsc#1217259, bsc#1228781, jsc#PED-8311, gh#ClusterLabs/pacemaker#3703)
- libcrmcommon: any negative interval is an error
- agents: always allow attribute agent to show metadata
- agents: use RESOURCENAME in attribute agent metadata
- agents: use configured run directory in attribute agent
- controld: leave xml-src attribute empty when no DC selected #2902 (bsc#1217259, bsc#1228781, jsc#PED-8311, gh#ClusterLabs/pacemaker#3702)

- Update to version 2.1.8+20241015.33f3052b89 (Pacemaker-2.1.9-rc2):
- pacemakerd: combine subdaemon start-up logs
- libcrmcommon: avoid potential overflow when adding seconds
- libcib: Perform server-side remote CIB reads asynchronously.
- libcib: Perform client-side remote CIB reads asynchronously.
- tools: crm_resource returns error on failed schema upgrade
- libcrmcommon: Don't assert on failure to write errors. (gh#ClusterLabs/pacemaker#3684)

- Update to version 2.1.8+20241003.95cef6b307 (Pacemaker-2.1.9-rc1):
- NLS: update translations for current code base
- scheduler: Fixed memory leak when searching for unfencing devices. (gh#ClusterLabs/pacemaker#3678)

OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=405
2024-12-06 08:32:13 +00:00

101 lines
3.8 KiB
Diff

commit 1e01228825eb8d4449edfbb1a1fa0c38fab4d5e6
Author: Gao,Yan <ygao@suse.com>
Date: Thu Sep 6 15:14:58 2012 +0800
Medium: stonith: Expose IDs of stonith resources to stonith agents through "$CRM_meta_st_device_id" environment variable
Index: pacemaker-2.1.7+20240208.bc5596299/daemons/fenced/fenced_commands.c
===================================================================
--- pacemaker-2.1.7+20240208.bc5596299.orig/daemons/fenced/fenced_commands.c
+++ pacemaker-2.1.7+20240208.bc5596299/daemons/fenced/fenced_commands.c
@@ -1151,6 +1151,7 @@ build_device_from_xml(xmlNode *dev)
(const char *) device->on_target_actions->str);
}
+ g_hash_table_insert(device->params, strdup(CRM_META "_" PCMK__XE_ST_DEVICE_ID), strdup(device->id));
device->work = mainloop_add_trigger(G_PRIORITY_HIGH, stonith_device_dispatch, device);
/* TODO: Hook up priority */
Index: pacemaker-2.1.7+20240208.bc5596299/lib/fencing/st_actions.c
===================================================================
--- pacemaker-2.1.7+20240208.bc5596299.orig/lib/fencing/st_actions.c
+++ pacemaker-2.1.7+20240208.bc5596299/lib/fencing/st_actions.c
@@ -31,6 +31,7 @@ struct stonith_action_s {
char *agent;
char *action;
GHashTable *args;
+ char *dev_id;
int timeout;
bool async;
void *userdata;
@@ -224,6 +225,7 @@ stonith__destroy_action(stonith_action_t
services_action_free(action->svc_action);
}
pcmk__reset_result(&(action->result));
+ free(action->dev_id);
free(action);
}
}
@@ -284,6 +286,8 @@ stonith__action_create(const char *agent
if (device_args) {
char buffer[512];
const char *value = NULL;
+ const char *st_dev_id_key = CRM_META "_" PCMK__XE_ST_DEVICE_ID;
+ const char *st_dev_id_value = NULL;
snprintf(buffer, sizeof(buffer), "pcmk_%s_retries", action_name);
value = g_hash_table_lookup(device_args, buffer);
@@ -291,6 +295,11 @@ stonith__action_create(const char *agent
if (value) {
action->max_retries = atoi(value);
}
+
+ st_dev_id_value = g_hash_table_lookup(device_args, st_dev_id_key);
+ if (st_dev_id_value) {
+ action->dev_id = strdup(st_dev_id_value);
+ }
}
return action;
@@ -628,6 +637,10 @@ internal_stonith_action_execute(stonith_
SVC_ACTION_NON_BLOCKED,
"SVC_ACTION_NON_BLOCKED");
+ if (action->dev_id) {
+ svc_action->rsc = strdup(action->dev_id);
+ }
+
/* keep retries from executing out of control and free previous results */
if (is_retry) {
pcmk__reset_result(&(action->result));
Index: pacemaker-2.1.7+20240208.bc5596299/lib/services/services_linux.c
===================================================================
--- pacemaker-2.1.7+20240208.bc5596299.orig/lib/services/services_linux.c
+++ pacemaker-2.1.7+20240208.bc5596299/lib/services/services_linux.c
@@ -29,6 +29,9 @@
#include "crm/services.h"
#include "crm/services_internal.h"
+#include "crm/stonith-ng.h"
+#include "crm/fencing/internal.h"
+
#include "services_private.h"
static void close_pipe(int fildes[]);
@@ -406,6 +409,15 @@ static void
add_action_env_vars(const svc_action_t *op)
{
void (*env_setter)(gpointer, gpointer, gpointer) = NULL;
+
+ if (pcmk__str_eq(op->standard, PCMK_RESOURCE_CLASS_STONITH, pcmk__str_casei)
+ && pcmk__str_eq(op->agent, "fence_legacy", pcmk__str_casei)
+ && op->rsc != NULL) {
+ const char *st_dev_id_key = CRM_META "_" PCMK__XE_ST_DEVICE_ID;
+
+ setenv(st_dev_id_key, op->rsc, 1);
+ }
+
if (op->agent == NULL) {
env_setter = set_alert_env; /* we deal with alert handler */