2012-02-14 04:25:00 +01:00
|
|
|
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
|
|
|
|
|
2012-06-23 07:04:51 +02:00
|
|
|
Index: pacemaker/fencing/commands.c
|
|
|
|
===================================================================
|
|
|
|
--- pacemaker.orig/fencing/commands.c
|
|
|
|
+++ pacemaker/fencing/commands.c
|
|
|
|
@@ -376,6 +376,8 @@ static stonith_device_t *build_device_fr
|
2011-12-16 05:55:14 +01:00
|
|
|
device->agent = crm_element_value_copy(dev, "agent");
|
|
|
|
device->namespace = crm_element_value_copy(dev, "namespace");
|
|
|
|
device->params = xml2list(dev);
|
2012-02-14 04:25:00 +01:00
|
|
|
+
|
|
|
|
+ g_hash_table_insert(device->params, crm_strdup(CRM_META "_" F_STONITH_DEVICE), crm_strdup(device->id));
|
2011-12-16 05:55:14 +01:00
|
|
|
device->work = mainloop_add_trigger(G_PRIORITY_HIGH, stonith_device_dispatch, device);
|
|
|
|
/* TODO: Hook up priority */
|
|
|
|
|
2012-06-23 07:04:51 +02:00
|
|
|
Index: pacemaker/lib/fencing/st_client.c
|
|
|
|
===================================================================
|
|
|
|
--- pacemaker.orig/lib/fencing/st_client.c
|
|
|
|
+++ pacemaker/lib/fencing/st_client.c
|
|
|
|
@@ -558,6 +558,8 @@ run_stonith_agent(const char *agent, con
|
2012-02-14 04:25:00 +01:00
|
|
|
|
|
|
|
} else {
|
|
|
|
/* child */
|
|
|
|
+ const char *st_dev_id_key = CRM_META "_" F_STONITH_DEVICE;
|
|
|
|
+ const char *st_dev_id_value = NULL;
|
|
|
|
|
|
|
|
close(1);
|
2012-06-23 07:04:51 +02:00
|
|
|
/* coverity[leaked_handle] False positive */
|
|
|
|
@@ -577,6 +579,11 @@ run_stonith_agent(const char *agent, con
|
2012-02-14 04:25:00 +01:00
|
|
|
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);
|
|
|
|
}
|