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
|
|
|
|
|
2011-12-16 05:55:14 +01:00
|
|
|
diff --git a/fencing/commands.c b/fencing/commands.c
|
2012-02-14 04:25:00 +01:00
|
|
|
index 8269d30..103389f 100644
|
2011-12-16 05:55:14 +01:00
|
|
|
--- a/fencing/commands.c
|
|
|
|
+++ b/fencing/commands.c
|
2012-02-14 04:25:00 +01:00
|
|
|
@@ -368,6 +368,8 @@ static stonith_device_t *build_device_from_xml(xmlNode *msg)
|
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-02-14 04:25:00 +01:00
|
|
|
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);
|
|
|
|
}
|