ae2abe019b
- Rebase: bug-728579_pacemaker-stonith-dev-id.patch - Revert "use common service interface for fence-agents and RAs" (bsc#1132123) * 0002-Revert-use-common-service-interface-for-fence-agents.patch - Revert "service-lib: avoid call-pattern leading to use-after-free" * 0001-Revert-Fix-service-lib-avoid-call-pattern-leading-to.patch - Update to version 2.0.1+20190408.1b68da8e8: - scheduler: avoid error log in harmless situation - libcrmcommon: use INT_MIN/INT_MAX instead of -1 for out-of-range integers - service-lib: avoid call-pattern leading to use-after-free - libp-i: Renamed to libpacemaker. - crmd: delete resource from lrmd when appropriate (bsc#1117381) OBS-URL: https://build.opensuse.org/request/show/693679 OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=326
80 lines
2.8 KiB
Diff
80 lines
2.8 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.0+20180726.3d81c89b8/daemons/fenced/fenced_commands.c
|
|
===================================================================
|
|
--- pacemaker-2.0.0+20180726.3d81c89b8.orig/daemons/fenced/fenced_commands.c
|
|
+++ pacemaker-2.0.0+20180726.3d81c89b8/daemons/fenced/fenced_commands.c
|
|
@@ -940,6 +940,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.0+20180726.3d81c89b8/lib/fencing/st_client.c
|
|
===================================================================
|
|
--- pacemaker-2.0.0+20180726.3d81c89b8.orig/lib/fencing/st_client.c
|
|
+++ pacemaker-2.0.0+20180726.3d81c89b8/lib/fencing/st_client.c
|
|
@@ -38,6 +38,7 @@ struct stonith_action_s {
|
|
char *action;
|
|
char *victim;
|
|
char *args;
|
|
+ char *dev_id;
|
|
int timeout;
|
|
int async;
|
|
void *userdata;
|
|
@@ -621,6 +622,7 @@ stonith__destroy_action(stonith_action_t
|
|
free(action->args);
|
|
free(action->action);
|
|
free(action->victim);
|
|
+ free(action->dev_id);
|
|
free(action);
|
|
}
|
|
}
|
|
@@ -690,6 +692,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);
|
|
@@ -697,6 +701,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;
|
|
@@ -878,6 +887,8 @@ internal_stonith_action_execute(stonith_
|
|
|
|
if (!pid) {
|
|
/* child */
|
|
+ const char *st_dev_id_key = CRM_META "_" F_STONITH_DEVICE;
|
|
+
|
|
setpgid(0, 0);
|
|
|
|
close(1);
|
|
@@ -900,6 +911,10 @@ internal_stonith_action_execute(stonith_
|
|
close(p_write_fd);
|
|
close(p_stderr_fd);
|
|
|
|
+ if (action->dev_id) {
|
|
+ setenv(st_dev_id_key, action->dev_id, 1);
|
|
+ }
|
|
+
|
|
/* keep retries from executing out of control */
|
|
if (is_retry) {
|
|
sleep(1);
|