pacemaker/bug-728579_pacemaker-stonith-dev-id.patch

101 lines
3.7 KiB
Diff
Raw Normal View History

- Update to version 3.0.0+20250218.3d0ffefd9e: - build: Fix default pacemaker-remoted path - Update to version 3.0.0+20250210.af3642fbf6: - libcrmcluster: prevent external callers from triggering assertion when connecting to cluster (gh#ClusterLabs/pacemaker#3821) - Update to version 3.0.0+20250207.d06c888ba7: - libpacemaker: Reset scheduler object in pcmk_simulate() - libpe_status: Make cluster_status() idempotent - tools: Fix overflow in crm_simulate --repeat - libpacemaker: Handle scandir() error in pcmk__profile_dir() - libpacemaker: Fix mem leak in pcmk__profile_dir() - tools: Avoid crash in crm_simulate --profile - Update to version 3.0.0+20250205.88e9ec1325: - libcrmservices: Unref the dbus connection... (gh#ClusterLabs/pacemaker#3816) - libcrmservices: Don't leak msg if systemd_proxy is NULL. (gh#ClusterLabs/pacemaker#3816) - Update to version 3.0.0+20250203.f950b1d05d: - python: Add python value for new CRM_EX_NO_DC exit code. (gh#ClusterLabs/pacemaker#3815) - libcrmcommon: Fix memory leak in text_end_list()/curses_end_list() (gh#ClusterLabs/pacemaker#3814) - crmadmin: return error if DC is not elected #2902 #3606 (gh#ClusterLabs/pacemaker#3716) - Update to version 3.0.0+20250128.0de22e5f75: - libraries: Update version numbers in so names - Rebase: * bug-995365_pacemaker-cts-restart-systemd-journald.patch - Update to version 3.0.0+20250114.7dc494a96f: - controller: best practices for send_stonith_update() (gh#ClusterLabs/pacemaker#3796) OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=409
2025-02-24 08:21:45 +00:00
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-3.0.0+20250114.9931db7727/daemons/fenced/fenced_commands.c
===================================================================
--- pacemaker-3.0.0+20250114.9931db7727.orig/daemons/fenced/fenced_commands.c
+++ pacemaker-3.0.0+20250114.9931db7727/daemons/fenced/fenced_commands.c
@@ -1085,6 +1085,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-3.0.0+20250114.9931db7727/lib/fencing/st_actions.c
===================================================================
--- pacemaker-3.0.0+20250114.9931db7727.orig/lib/fencing/st_actions.c
+++ pacemaker-3.0.0+20250114.9931db7727/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;
@@ -225,6 +226,7 @@ stonith__destroy_action(stonith_action_t
services_action_free(action->svc_action);
}
pcmk__reset_result(&(action->result));
+ free(action->dev_id);
free(action);
}
}
@@ -283,6 +285,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);
@@ -290,6 +294,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;
@@ -648,6 +657,10 @@ internal_stonith_action_execute(stonith_
return -E2BIG;
}
+ 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-3.0.0+20250114.9931db7727/lib/services/services_linux.c
===================================================================
--- pacemaker-3.0.0+20250114.9931db7727.orig/lib/services/services_linux.c
+++ pacemaker-3.0.0+20250114.9931db7727/lib/services/services_linux.c
@@ -25,6 +25,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[]);
@@ -446,6 +449,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 */