pacemaker/bug-728579_pacemaker-stonith-dev-id.patch
Yan Gao 68aa3f89d0 Accepting request 691523 from home:yan_gao:branches:network:ha-clustering:Factory
- spec: no need to explicitly require the virtual dependency on libqb

- Rebase:
  * bug-728579_pacemaker-stonith-dev-id.patch
- Update to version 2.0.1+20190402.e091f4f0c:
- scheduler: one group stop shouldn't make another required
- libcrmcommon: compare_version: drop superfluous heap allocation
- libfencing: enumerate installed RHCS-style agents alpha-sorted
- xml diff'ing: prevent 'id' attribute reordering in "diff-removed"
- libcrmcommon: downplay "Creating RNG parser context" as debug prio
- controller: improve failed recurring action messages
- controller: improve lost action logs
- use common service interface for fence-agents and RAs
- libcrmcommon: allow whitespace in name/value pairs
- libcrmcommon: pcmk_nvpair_t should handle NULL values

- Update to version 2.0.1+20190312.059e2e26b:
- spec: move stonith_admin to -cli where it belongs
- tools: Add crm_rule.

- Update to version 2.0.1+20190311.e91ee92e5:
- libfencing: Change return type on stonith_agent_exists.
- scheduler: cl#5301 - respect order constraints when relevant resources are being probed (bsc#1117934, bsc#1128374)

- Update to version 2.0.1+20190304.1ac166cd3:
- build: Update pkgconfig files for libpe.
- libp-i: Add a pkgconfig file for libp-i.
- libs: Rename libpengine to libpacemaker-internal.
- tools: Add new validate options to crm_resource.
- Add HealthIOWait provider which checks hosts's IOWait

OBS-URL: https://build.opensuse.org/request/show/691523
OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=323
2019-04-04 13:06:34 +00:00

100 lines
3.5 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.1+20190402.e091f4f0c/daemons/fenced/fenced_commands.c
===================================================================
--- pacemaker-2.0.1+20190402.e091f4f0c.orig/daemons/fenced/fenced_commands.c
+++ pacemaker-2.0.1+20190402.e091f4f0c/daemons/fenced/fenced_commands.c
@@ -946,6 +946,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.1+20190402.e091f4f0c/lib/fencing/st_client.c
===================================================================
--- pacemaker-2.0.1+20190402.e091f4f0c.orig/lib/fencing/st_client.c
+++ pacemaker-2.0.1+20190402.e091f4f0c/lib/fencing/st_client.c
@@ -39,6 +39,7 @@ struct stonith_action_s {
char *action;
char *victim;
GHashTable *args;
+ char *dev_id;
int timeout;
int async;
void *userdata;
@@ -559,6 +560,7 @@ stonith__destroy_action(stonith_action_t
}
free(action->output);
free(action->error);
+ free(action->dev_id);
free(action);
}
}
@@ -628,6 +630,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);
@@ -635,6 +639,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;
@@ -755,6 +764,10 @@ internal_stonith_action_execute(stonith_
svc_action->params = action->args;
svc_action->cb_data = (void *) action;
+ 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.1+20190402.e091f4f0c/lib/services/services_linux.c
===================================================================
--- pacemaker-2.0.1+20190402.e091f4f0c.orig/lib/services/services_linux.c
+++ pacemaker-2.0.1+20190402.e091f4f0c/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
@@ -169,6 +172,14 @@ set_ocf_env_with_prefix(gpointer key, gp
static void
add_action_env_vars(const svc_action_t *op)
{
+ if (safe_str_eq(op->standard, PCMK_RESOURCE_CLASS_STONITH)
+ && safe_str_eq(op->agent, "fence_legacy")
+ && op->rsc) {
+ const char *st_dev_id_key = CRM_META "_" F_STONITH_DEVICE;
+
+ setenv(st_dev_id_key, op->rsc, 1);
+ }
+
if (safe_str_eq(op->standard, PCMK_RESOURCE_CLASS_OCF) == FALSE) {
return;
}