2013-05-21 14:29:04 +02: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
|
|
|
|
|
2022-02-09 13:32:34 +01:00
|
|
|
Index: pacemaker-2.1.2+20211124.91f4bad83/daemons/fenced/fenced_commands.c
|
2013-05-21 14:29:04 +02:00
|
|
|
===================================================================
|
2022-02-09 13:32:34 +01:00
|
|
|
--- pacemaker-2.1.2+20211124.91f4bad83.orig/daemons/fenced/fenced_commands.c
|
|
|
|
+++ pacemaker-2.1.2+20211124.91f4bad83/daemons/fenced/fenced_commands.c
|
|
|
|
@@ -1071,6 +1071,7 @@ build_device_from_xml(xmlNode * msg)
|
2021-02-01 11:34:27 +01:00
|
|
|
"on target", device->id, device->on_target_actions);
|
2013-05-21 14:29:04 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
+ g_hash_table_insert(device->params, strdup(CRM_META "_" F_STONITH_DEVICE), strdup(device->id));
|
|
|
|
device->work = mainloop_add_trigger(G_PRIORITY_HIGH, stonith_device_dispatch, device);
|
|
|
|
/* TODO: Hook up priority */
|
|
|
|
|
2022-02-09 13:32:34 +01:00
|
|
|
Index: pacemaker-2.1.2+20211124.91f4bad83/lib/fencing/st_actions.c
|
2013-05-21 14:29:04 +02:00
|
|
|
===================================================================
|
2022-02-09 13:32:34 +01:00
|
|
|
--- pacemaker-2.1.2+20211124.91f4bad83.orig/lib/fencing/st_actions.c
|
|
|
|
+++ pacemaker-2.1.2+20211124.91f4bad83/lib/fencing/st_actions.c
|
|
|
|
@@ -31,6 +31,7 @@ struct stonith_action_s {
|
2013-05-21 14:29:04 +02:00
|
|
|
char *action;
|
|
|
|
char *victim;
|
2019-08-08 18:13:22 +02:00
|
|
|
GHashTable *args;
|
2013-05-21 14:29:04 +02:00
|
|
|
+ char *dev_id;
|
|
|
|
int timeout;
|
|
|
|
int async;
|
|
|
|
void *userdata;
|
2022-02-09 13:32:34 +01:00
|
|
|
@@ -213,6 +214,7 @@ stonith__destroy_action(stonith_action_t
|
|
|
|
services_action_free(action->svc_action);
|
2019-08-08 18:13:22 +02:00
|
|
|
}
|
2022-02-09 13:32:34 +01:00
|
|
|
pcmk__reset_result(&(action->result));
|
2018-07-27 17:42:24 +02:00
|
|
|
+ free(action->dev_id);
|
|
|
|
free(action);
|
|
|
|
}
|
2013-05-21 14:29:04 +02:00
|
|
|
}
|
2022-02-09 13:32:34 +01:00
|
|
|
@@ -261,6 +263,8 @@ stonith_action_create(const char *agent,
|
2013-05-21 14:29:04 +02:00
|
|
|
if (device_args) {
|
|
|
|
char buffer[512];
|
|
|
|
const char *value = NULL;
|
|
|
|
+ const char *st_dev_id_key = CRM_META "_" F_STONITH_DEVICE;
|
|
|
|
+ const char *st_dev_id_value = NULL;
|
|
|
|
|
2017-10-06 15:22:51 +02:00
|
|
|
snprintf(buffer, sizeof(buffer), "pcmk_%s_retries", _action);
|
2013-05-21 14:29:04 +02:00
|
|
|
value = g_hash_table_lookup(device_args, buffer);
|
2022-02-09 13:32:34 +01:00
|
|
|
@@ -268,6 +272,11 @@ stonith_action_create(const char *agent,
|
2013-05-21 14:29:04 +02:00
|
|
|
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;
|
2022-02-09 13:32:34 +01:00
|
|
|
@@ -605,6 +614,10 @@ internal_stonith_action_execute(stonith_
|
2020-12-07 10:07:23 +01:00
|
|
|
SVC_ACTION_NON_BLOCKED,
|
|
|
|
"SVC_ACTION_NON_BLOCKED");
|
2013-05-21 14:29:04 +02:00
|
|
|
|
2019-08-08 18:13:22 +02:00
|
|
|
+ if (action->dev_id) {
|
|
|
|
+ svc_action->rsc = strdup(action->dev_id);
|
|
|
|
+ }
|
2013-08-05 08:38:03 +02:00
|
|
|
+
|
2019-08-08 18:13:22 +02:00
|
|
|
/* keep retries from executing out of control and free previous results */
|
|
|
|
if (is_retry) {
|
2022-02-09 13:32:34 +01:00
|
|
|
pcmk__reset_result(&(action->result));
|
|
|
|
Index: pacemaker-2.1.2+20211124.91f4bad83/lib/services/services_linux.c
|
2019-08-08 18:13:22 +02:00
|
|
|
===================================================================
|
2022-02-09 13:32:34 +01:00
|
|
|
--- pacemaker-2.1.2+20211124.91f4bad83.orig/lib/services/services_linux.c
|
|
|
|
+++ pacemaker-2.1.2+20211124.91f4bad83/lib/services/services_linux.c
|
2021-12-23 11:19:25 +01:00
|
|
|
@@ -29,6 +29,9 @@
|
2019-08-08 18:13:22 +02:00
|
|
|
#include "crm/services.h"
|
2021-12-23 11:19:25 +01:00
|
|
|
#include "crm/services_internal.h"
|
2013-05-21 14:29:04 +02:00
|
|
|
|
2019-08-08 18:13:22 +02:00
|
|
|
+#include "crm/stonith-ng.h"
|
|
|
|
+#include "crm/fencing/internal.h"
|
|
|
|
+
|
|
|
|
#include "services_private.h"
|
2013-05-21 14:29:04 +02:00
|
|
|
|
2020-01-31 16:54:26 +01:00
|
|
|
static void close_pipe(int fildes[]);
|
2021-12-23 11:19:25 +01:00
|
|
|
@@ -406,6 +409,15 @@ static void
|
2019-08-08 18:13:22 +02:00
|
|
|
add_action_env_vars(const svc_action_t *op)
|
|
|
|
{
|
|
|
|
void (*env_setter)(gpointer, gpointer, gpointer) = NULL;
|
2019-04-04 15:06:34 +02:00
|
|
|
+
|
2020-12-07 10:07:23 +01:00
|
|
|
+ if (pcmk__str_eq(op->standard, PCMK_RESOURCE_CLASS_STONITH, pcmk__str_casei)
|
|
|
|
+ && pcmk__str_eq(op->agent, "fence_legacy", pcmk__str_casei)
|
2019-08-08 18:13:22 +02:00
|
|
|
+ && op->rsc != NULL) {
|
|
|
|
+ const char *st_dev_id_key = CRM_META "_" F_STONITH_DEVICE;
|
|
|
|
+
|
|
|
|
+ setenv(st_dev_id_key, op->rsc, 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (op->agent == NULL) {
|
|
|
|
env_setter = set_alert_env; /* we deal with alert handler */
|
|
|
|
|