pacemaker/bug-728579_pacemaker-stonith-dev-id.patch
Yan Gao a37d6b83b1 Accepting request 746348 from home:yan_gao:branches:network:ha-clustering:Factory
- Update to version 2.0.2+20191106.eef56dcd6:
- libcrmcommon: Make sure to free the --output-as description.
- libcrmcommon: Rename formatted output cmdline options.
- libcrmcommon: Group all output options together.

- Update to version 2.0.2+20191031.1d695899e:
- scheduler: clarify message about when watchdog will be used
- scheduler: properly detect whether guest node is fenceable
- scheduler: initialize unfencing digests to null
- scheduler: improve graph synapse logging

- Update to version 2.0.2+20191023.7a12ccbe4:
- tools: Explain TIMESPEC in crm_mon help output.
- tools: crm_mon --interval should understand more formats.
- libcrmservice: don't close descriptors above current limit
- rpm: pacemaker-cts requires pacemaker
- tools: restore ability to show groups in crm_mon console mode
- tools: Deprecated old-style output options in crm_mon.
- cts-scheduler: test "year-2038" only runs for 64bit systems
- fencer: clarify more messages
- tools: don't ignore cib_new() errors in crm_mon
- tools: avoid memory leak in crm_mon when displaying nodes
- libpe_status: avoid memory leak when outputting resources
- libcrmcommon: avoid memory leak when IPC compression fails
- Security: introduce restrictive usage libxslt's security framework
- libcrmservice: try not to spam close() file descriptors
- tools: Support "crm_mon --as-html=<filename>".
- tools: Don't output nodes if they don't have failures.
- tools: Update checks around crm_mon --daemonize.
- libpe_status: Use CSS to style messages.

OBS-URL: https://build.opensuse.org/request/show/746348
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=331
2019-11-07 16:09:29 +00:00

101 lines
3.6 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.0.2+20191014.81d51216d/daemons/fenced/fenced_commands.c
===================================================================
--- pacemaker-2.0.2+20191014.81d51216d.orig/daemons/fenced/fenced_commands.c
+++ pacemaker-2.0.2+20191014.81d51216d/daemons/fenced/fenced_commands.c
@@ -905,6 +905,7 @@ build_device_from_xml(xmlNode * msg)
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.0.2+20191014.81d51216d/lib/fencing/st_client.c
===================================================================
--- pacemaker-2.0.2+20191014.81d51216d.orig/lib/fencing/st_client.c
+++ pacemaker-2.0.2+20191014.81d51216d/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;
@@ -600,6 +601,7 @@ stonith__destroy_action(stonith_action_t
}
free(action->output);
free(action->error);
+ free(action->dev_id);
free(action);
}
}
@@ -669,6 +671,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);
@@ -676,6 +680,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;
@@ -813,6 +822,10 @@ internal_stonith_action_execute(stonith_
svc_action->cb_data = (void *) action;
set_bit(svc_action->flags, 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.0.2+20191014.81d51216d/lib/services/services_linux.c
===================================================================
--- pacemaker-2.0.2+20191014.81d51216d.orig/lib/services/services_linux.c
+++ pacemaker-2.0.2+20191014.81d51216d/lib/services/services_linux.c
@@ -30,6 +30,9 @@
#include "crm/common/mainloop.h"
#include "crm/services.h"
+#include "crm/stonith-ng.h"
+#include "crm/fencing/internal.h"
+
#include "services_private.h"
#if SUPPORT_CIBSECRETS
@@ -189,6 +192,15 @@ static void
add_action_env_vars(const svc_action_t *op)
{
void (*env_setter)(gpointer, gpointer, gpointer) = NULL;
+
+ if (safe_str_eq(op->standard, PCMK_RESOURCE_CLASS_STONITH)
+ && safe_str_eq(op->agent, "fence_legacy")
+ && 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 */