pacemaker/bug-728579_pacemaker-stonith-dev-id.patch
Yan Gao bfc9fbf386 Accepting request 942220 from home:yan_gao:branches:network:ha-clustering:Factory
- fencer: get current time correctly
  * 0001-Fix-fencer-get-current-time-correctly.patch

- Update to version 2.1.2+20211124.ada5c3b36 (Pacemaker-2.1.2):
- fencer: add missing space to topology message
- controller: handle remote connection start timeouts correctly

- Update to version 2.1.1+20211116.8db4569e4 (Pacemaker-2.1.2-rc2):
- fencing: mark state as done if remapped "on" times out
- Fix OCF_RA_INSTALL_DIR Autoconf variable name in pkg-config files
- daemons: Free memory at the end of fail_pending_op.

- Update to version 2.1.1+20211104.62c36e2b1 (Pacemaker-2.1.2-rc1):
- Use user_include_exclude_cb in crm_mon more. (clbz#5485)
- Only set default sections in crm_mon once. (clbz#5485)
- fencer: improve messages for dynamic target queries (rh#1470834)
- fencer: consolidate messages for asynchronous results (rh#1470834)
- fencer: log a message when out of memory for dynamic target search (rh#1470834)
- libcrmservice: distinguish local and global configuration errors (rh#1470834)
- libcrmservice: improve messages for pre-execution failures in child (rh#1470834)

- Update to version 2.1.1+20211028.70f82d2c0:
- attrd: check election status upon loss of a voter to prevent unexpected pending (bsc#1191676)

- Update to version 2.1.1+20211028.7ee8b5bdd:
- tools: select technical or human-friendly output of failed actions (rh#1470834)
- controller,executor: tweak action result messages (rh#1470834)
- install init scripts only if not using systemd
- executor: log execution status and exit reason with results (rh#1470834)
- executor: improve result message (rh#1470834)

OBS-URL: https://build.opensuse.org/request/show/942220
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=354
2021-12-23 10:19:25 +00:00

101 lines
3.7 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.1+20211028.7ee8b5bdd/daemons/fenced/fenced_commands.c
===================================================================
--- pacemaker-2.1.1+20211028.7ee8b5bdd.orig/daemons/fenced/fenced_commands.c
+++ pacemaker-2.1.1+20211028.7ee8b5bdd/daemons/fenced/fenced_commands.c
@@ -1068,6 +1068,7 @@ build_device_from_xml(xmlNode * msg)
"on target", device->id, device->on_target_actions);
}
+ 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 */
Index: pacemaker-2.1.1+20211028.7ee8b5bdd/lib/fencing/st_client.c
===================================================================
--- pacemaker-2.1.1+20211028.7ee8b5bdd.orig/lib/fencing/st_client.c
+++ pacemaker-2.1.1+20211028.7ee8b5bdd/lib/fencing/st_client.c
@@ -42,6 +42,7 @@ struct stonith_action_s {
char *action;
char *victim;
GHashTable *args;
+ char *dev_id;
int timeout;
int async;
void *userdata;
@@ -647,6 +648,7 @@ stonith__destroy_action(stonith_action_t
}
free(action->output);
free(action->error);
+ free(action->dev_id);
free(action);
}
}
@@ -718,6 +720,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 "_" F_STONITH_DEVICE;
+ const char *st_dev_id_value = NULL;
snprintf(buffer, sizeof(buffer), "pcmk_%s_retries", _action);
value = g_hash_table_lookup(device_args, buffer);
@@ -725,6 +729,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;
@@ -875,6 +884,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) {
free(action->output);
Index: pacemaker-2.1.1+20211028.7ee8b5bdd/lib/services/services_linux.c
===================================================================
--- pacemaker-2.1.1+20211028.7ee8b5bdd.orig/lib/services/services_linux.c
+++ pacemaker-2.1.1+20211028.7ee8b5bdd/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 "_" 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 */