Blame SOURCES/bz1078078-pcmk-default_to_off_when_agent_does_not_advertise_reboot_in_metadata.patch

7ebc05
commit ad224d149d03351fd5ff63011697b117ad661aaf
7ebc05
Author: David Vossel <dvossel@redhat.com>
7ebc05
Date:   Thu Apr 17 11:37:50 2014 -0500
7ebc05
7ebc05
    High: fencing: default to 'off' when agent does not advertise 'reboot' in metadata
7ebc05
    
7ebc05
    (cherry picked from commit 8383a38a478ed6473ff2179596335ed4de583cfa)
7ebc05
7ebc05
diff --git a/fencing/commands.c b/fencing/commands.c
7ebc05
index b4cd862..fbbee1a 100644
7ebc05
--- a/fencing/commands.c
7ebc05
+++ b/fencing/commands.c
7ebc05
@@ -206,6 +206,7 @@ static gboolean
7ebc05
 stonith_device_execute(stonith_device_t * device)
7ebc05
 {
7ebc05
     int exec_rc = 0;
7ebc05
+    const char *action_str = NULL;
7ebc05
     async_command_t *cmd = NULL;
7ebc05
     stonith_action_t *action = NULL;
7ebc05
 
7ebc05
@@ -246,8 +247,14 @@ stonith_device_execute(stonith_device_t * device)
7ebc05
     }
7ebc05
 #endif
7ebc05
 
7ebc05
+    action_str = cmd->action;
7ebc05
+    if (safe_str_eq(cmd->action, "reboot") && is_not_set(device->flags, st_device_supports_reboot)) {
7ebc05
+        crm_warn("Agent '%s' does not advertise support for 'reboot', performing 'off' action instead", device->agent);
7ebc05
+        action_str = "off";
7ebc05
+    }
7ebc05
+
7ebc05
     action = stonith_action_create(device->agent,
7ebc05
-                                   cmd->action,
7ebc05
+                                   action_str,
7ebc05
                                    cmd->victim,
7ebc05
                                    cmd->victim_nodeid,
7ebc05
                                    cmd->timeout, device->params, device->aliases);
7ebc05
@@ -592,6 +599,8 @@ read_action_metadata(stonith_device_t *device)
7ebc05
             set_bit(device->flags, st_device_supports_list);
7ebc05
         } else if(safe_str_eq(action, "status")) {
7ebc05
             set_bit(device->flags, st_device_supports_status);
7ebc05
+        } else if(safe_str_eq(action, "reboot")) {
7ebc05
+            set_bit(device->flags, st_device_supports_reboot);
7ebc05
         } else if(safe_str_eq(action, "on") && (crm_is_true(automatic))) {
7ebc05
             /* this setting implies required=true for unfencing */
7ebc05
             required = "true";
7ebc05
diff --git a/fencing/internal.h b/fencing/internal.h
7ebc05
index 3fcad20..d94e2d6 100644
7ebc05
--- a/fencing/internal.h
7ebc05
+++ b/fencing/internal.h
7ebc05
@@ -16,6 +16,7 @@ enum st_device_flags
7ebc05
 {
7ebc05
     st_device_supports_list   = 0x0001,
7ebc05
     st_device_supports_status = 0x0002,
7ebc05
+    st_device_supports_reboot = 0x0004,
7ebc05
 };
7ebc05
 
7ebc05
 typedef struct stonith_device_s {