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