Blob Blame History Raw
commit e40eaf4a1ba1787696a2fea3043e2620a5d98e3c
Author: Andrew Beekhof <andrew@beekhof.net>
Date:   Thu Apr 10 11:50:46 2014 +1000

    Fix: Fencing: Correctly record which peer performed the fencing operation
    
    (cherry picked from commit a932361589964545f76376009d7ff7a61f03cab3)

diff --git a/fencing/commands.c b/fencing/commands.c
index abbb1ad..41690f7 100644
--- a/fencing/commands.c
+++ b/fencing/commands.c
@@ -1405,7 +1405,8 @@ stonith_send_async_reply(async_command_t * cmd, const char *output, int rc, GPid
         crm_xml_add_int(notify_data, F_STONITH_RC, rc);
         crm_xml_add(notify_data, F_STONITH_TARGET, cmd->victim);
         crm_xml_add(notify_data, F_STONITH_OPERATION, cmd->op);
-        crm_xml_add(notify_data, F_STONITH_DELEGATE, cmd->device);
+        crm_xml_add(notify_data, F_STONITH_DELEGATE, "localhost");
+        crm_xml_add(notify_data, F_STONITH_DEVICE, cmd->device);
         crm_xml_add(notify_data, F_STONITH_REMOTE_OP_ID, cmd->remote_op_id);
         crm_xml_add(notify_data, F_STONITH_ORIGIN, cmd->client);
 
diff --git a/fencing/remote.c b/fencing/remote.c
index 399dce5..fd25025 100644
--- a/fencing/remote.c
+++ b/fencing/remote.c
@@ -267,7 +267,12 @@ remote_op_done(remote_fencing_op_t * op, xmlNode * data, int rc, int dup)
     }
 
     if (!op->delegate && data) {
-        op->delegate = crm_element_value_copy(data, F_ORIG);
+        xmlNode *ndata = get_xpath_object("//@" F_STONITH_DELEGATE, data, LOG_WARNING);
+        if(ndata) {
+            op->delegate = crm_element_value_copy(ndata, F_STONITH_DELEGATE);
+        } else {
+            op->delegate = crm_element_value_copy(data, F_ORIG);
+        }
     }
 
     if (data == NULL) {
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
index 95ea0f7..2be854f 100644
--- a/lib/fencing/st_client.c
+++ b/lib/fencing/st_client.c
@@ -1981,6 +1981,8 @@ xml_to_event(xmlNode * msg)
             event->executioner = crm_element_value_copy(data, F_STONITH_DELEGATE);
             event->id = crm_element_value_copy(data, F_STONITH_REMOTE_OP_ID);
             event->client_origin = crm_element_value_copy(data, F_STONITH_CLIENTNAME);
+            event->device = crm_element_value_copy(data, F_STONITH_DEVICE);
+
         } else {
             crm_err("No data for %s event", ntype);
             crm_log_xml_notice(msg, "BadEvent");