527a76dc73
types for ABI compliance - stonith: Default to 20s timeout for start and monitor operations of stonith resources which is same as "default-action-timeout" (bnc#733337) - Tools: ptest - Fix "-X, --xml-text" option to handle a XML string as its argument (bnc#736212) - cib: Fix segfault caused by destroying an already freed hash table (cl#5023) - stonith: Expose IDs of stonith resources to stonith agents through "$CRM_meta_st_device_id" environment variable (bnc#728579) OBS-URL: https://build.opensuse.org/package/show/network:ha-clustering:Factory/pacemaker?expand=0&rev=31
45 lines
1.7 KiB
Diff
45 lines
1.7 KiB
Diff
commit 543b4337b42f64fa46e2c01b7eb466dc4bd7665b
|
|
Author: Gao,Yan <ygao@suse.com>
|
|
Date: Fri Nov 11 14:03:56 2011 +0800
|
|
|
|
Medium: stonith: Expose IDs of stonith resources to stonith agents through "$CRM_meta_st_device_id" environment variable
|
|
|
|
diff --git a/fencing/commands.c b/fencing/commands.c
|
|
index 8269d30..103389f 100644
|
|
--- a/fencing/commands.c
|
|
+++ b/fencing/commands.c
|
|
@@ -368,6 +368,8 @@ static stonith_device_t *build_device_from_xml(xmlNode *msg)
|
|
device->agent = crm_element_value_copy(dev, "agent");
|
|
device->namespace = crm_element_value_copy(dev, "namespace");
|
|
device->params = xml2list(dev);
|
|
+
|
|
+ g_hash_table_insert(device->params, crm_strdup(CRM_META "_" F_STONITH_DEVICE), crm_strdup(device->id));
|
|
device->work = mainloop_add_trigger(G_PRIORITY_HIGH, stonith_device_dispatch, device);
|
|
/* TODO: Hook up priority */
|
|
|
|
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
|
|
index 205bda8..a16fab9 100644
|
|
--- a/lib/fencing/st_client.c
|
|
+++ b/lib/fencing/st_client.c
|
|
@@ -483,6 +483,8 @@ run_stonith_agent(const char *agent, const char *action, const char *victim,
|
|
|
|
} else {
|
|
/* child */
|
|
+ const char *st_dev_id_key = CRM_META "_" F_STONITH_DEVICE;
|
|
+ const char *st_dev_id_value = NULL;
|
|
|
|
close(1);
|
|
if (dup(c_write_fd) < 0)
|
|
@@ -499,6 +501,11 @@ run_stonith_agent(const char *agent, const char *action, const char *victim,
|
|
close(p_read_fd);
|
|
close(p_write_fd);
|
|
|
|
+ st_dev_id_value = g_hash_table_lookup(device_args, st_dev_id_key);
|
|
+ if (st_dev_id_value) {
|
|
+ setenv(st_dev_id_key, st_dev_id_value, 1);
|
|
+ }
|
|
+
|
|
execlp(agent, agent, NULL);
|
|
exit(EXIT_FAILURE);
|
|
}
|