pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
Data Structures | Macros | Functions
actions.h File Reference

APIs related to actions. More...

#include <stdbool.h>
#include <strings.h>
#include <glib.h>
#include <libxml/tree.h>
#include <crm/lrmd_events.h>
#include <crm/common/nodes.h>
#include <crm/common/resources.h>
#include <crm/common/scheduler_types.h>
Include dependency graph for actions.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  pe_action_wrapper_s
 
struct  pe_action_s
 

Macros

#define PCMK_DEFAULT_ACTION_TIMEOUT_MS   20000
 Default timeout (in milliseconds) for non-metadata actions. More...
 
#define PCMK_DEFAULT_METADATA_TIMEOUT_MS   30000
 
#define PCMK_ACTION_CANCEL   "cancel"
 
#define PCMK_ACTION_CLEAR_FAILCOUNT   "clear_failcount"
 
#define PCMK_ACTION_CLONE_ONE_OR_MORE   "clone-one-or-more"
 
#define PCMK_ACTION_DELETE   "delete"
 
#define PCMK_ACTION_DEMOTE   "demote"
 
#define PCMK_ACTION_DEMOTED   "demoted"
 
#define PCMK_ACTION_DO_SHUTDOWN   "do_shutdown"
 
#define PCMK_ACTION_LIST   "list"
 
#define PCMK_ACTION_LRM_DELETE   "lrm_delete"
 
#define PCMK_ACTION_LOAD_STOPPED   "load_stopped"
 
#define PCMK_ACTION_MAINTENANCE_NODES   "maintenance_nodes"
 
#define PCMK_ACTION_META_DATA   "meta-data"
 
#define PCMK_ACTION_METADATA   "metadata"
 
#define PCMK_ACTION_MIGRATE_FROM   "migrate_from"
 
#define PCMK_ACTION_MIGRATE_TO   "migrate_to"
 
#define PCMK_ACTION_MONITOR   "monitor"
 
#define PCMK_ACTION_NOTIFIED   "notified"
 
#define PCMK_ACTION_NOTIFY   "notify"
 
#define PCMK_ACTION_OFF   "off"
 
#define PCMK_ACTION_ON   "on"
 
#define PCMK_ACTION_ONE_OR_MORE   "one-or-more"
 
#define PCMK_ACTION_PROMOTE   "promote"
 
#define PCMK_ACTION_PROMOTED   "promoted"
 
#define PCMK_ACTION_REBOOT   "reboot"
 
#define PCMK_ACTION_RELOAD   "reload"
 
#define PCMK_ACTION_RELOAD_AGENT   "reload-agent"
 
#define PCMK_ACTION_RUNNING   "running"
 
#define PCMK_ACTION_START   "start"
 
#define PCMK_ACTION_STATUS   "status"
 
#define PCMK_ACTION_STONITH   "stonith"
 
#define PCMK_ACTION_STOP   "stop"
 
#define PCMK_ACTION_STOPPED   "stopped"
 
#define PCMK_ACTION_VALIDATE_ALL   "validate-all"
 

Enumerations

enum  action_tasks {
  pcmk_action_unspecified = 0, pcmk_action_monitor, pcmk_action_stop, pcmk_action_stopped,
  pcmk_action_start, pcmk_action_started, pcmk_action_notify, pcmk_action_notified,
  pcmk_action_promote, pcmk_action_promoted, pcmk_action_demote, pcmk_action_demoted,
  pcmk_action_shutdown, pcmk_action_fence, no_action = pcmk_action_unspecified, monitor_rsc = pcmk_action_monitor,
  stop_rsc = pcmk_action_stop, stopped_rsc = pcmk_action_stopped, start_rsc = pcmk_action_start, started_rsc = pcmk_action_started,
  action_notify = pcmk_action_notify, action_notified = pcmk_action_notified, action_promote = pcmk_action_promote, action_promoted = pcmk_action_promoted,
  action_demote = pcmk_action_demote, action_demoted = pcmk_action_demoted, shutdown_crm = pcmk_action_shutdown, stonith_node = pcmk_action_fence
}
 
enum  action_fail_response {
  pcmk_on_fail_ignore = 0, pcmk_on_fail_restart = 1, pcmk_on_fail_ban = 2, pcmk_on_fail_block = 3,
  pcmk_on_fail_stop = 4, pcmk_on_fail_standby_node = 5, pcmk_on_fail_fence_node = 6, pcmk_on_fail_restart_container = 7,
  pcmk_on_fail_reset_remote = 8, pcmk_on_fail_demote = 9, action_fail_ignore = pcmk_on_fail_ignore, action_fail_recover = pcmk_on_fail_restart,
  action_fail_migrate = pcmk_on_fail_ban, action_fail_block = pcmk_on_fail_block, action_fail_stop = pcmk_on_fail_stop, action_fail_standby = pcmk_on_fail_standby_node,
  action_fail_fence = pcmk_on_fail_fence_node, action_fail_restart_container = pcmk_on_fail_restart_container, action_fail_reset_remote = pcmk_on_fail_reset_remote, action_fail_demote = pcmk_on_fail_demote
}
 
enum  pe_action_flags {
  pcmk_no_action_flags = 0, pcmk_action_pseudo = (1 << 0), pcmk_action_runnable = (1 << 1), pcmk_action_optional = (1 << 2),
  pcmk_action_always_in_graph = (1 << 3), pcmk_action_attrs_evaluated = (1 << 4), pcmk_action_migratable = (1 << 7), pcmk_action_added_to_graph = (1 << 8),
  pcmk_action_migration_abort = (1 << 11), pcmk_action_min_runnable = (1 << 12), pcmk_action_reschedule = (1 << 13), pcmk_action_detect_loop = (1 << 14),
  pcmk_action_inputs_deduplicated = (1 << 15), pcmk_action_on_dc = (1 << 16), pe_action_pseudo = pcmk_action_pseudo, pe_action_runnable = pcmk_action_runnable,
  pe_action_optional = pcmk_action_optional, pe_action_print_always = pcmk_action_always_in_graph, pe_action_have_node_attrs = pcmk_action_attrs_evaluated, pe_action_implied_by_stonith = (1 << 6),
  pe_action_migrate_runnable = pcmk_action_migratable, pe_action_dumped = pcmk_action_added_to_graph, pe_action_processed = (1 << 9), pe_action_clear = (1 << 10),
  pe_action_dangle = pcmk_action_migration_abort, pe_action_requires_any = pcmk_action_min_runnable, pe_action_reschedule = pcmk_action_reschedule, pe_action_tracking = pcmk_action_detect_loop,
  pe_action_dedup = pcmk_action_inputs_deduplicated, pe_action_dc = pcmk_action_on_dc
}
 
enum  pe_link_state { pe_link_not_dumped = 0, pe_link_dumped = 1, pe_link_dup = 2 }
 
enum  pe_ordering {
  pe_order_none = 0x0, pe_order_optional = 0x1, pe_order_apply_first_non_migratable = 0x2, pe_order_implies_first = 0x10,
  pe_order_implies_then = 0x20, pe_order_promoted_implies_first = 0x40, pe_order_implies_first_migratable = 0x80, pe_order_runnable_left = 0x100,
  pe_order_pseudo_left = 0x200, pe_order_implies_then_on_node = 0x400, pe_order_probe = 0x800, pe_order_restart = 0x1000,
  pe_order_stonith_stop = 0x2000, pe_order_serialize_only = 0x4000, pe_order_same_node = 0x8000, pe_order_implies_first_printed = 0x10000,
  pe_order_implies_then_printed = 0x20000, pe_order_asymmetrical = 0x100000, pe_order_load = 0x200000, pe_order_one_or_more = 0x400000,
  pe_order_anti_colocation = 0x800000, pe_order_preserve = 0x1000000, pe_order_then_cancels_first = 0x2000000, pe_order_trace = 0x4000000,
  pe_order_implies_first_master = pe_order_promoted_implies_first
}
 

Functions

const char * pcmk_action_text (enum action_tasks action)
 Get string equivalent of an action type. More...
 
enum action_tasks pcmk_parse_action (const char *action_name)
 Parse an action type from an action name. More...
 
const char * pcmk_on_fail_text (enum action_fail_response on_fail)
 Get string equivalent of a failure handling type. More...
 
gboolean parse_op_key (const char *key, char **rsc_id, char **op_type, guint *interval_ms)
 
gboolean decode_transition_key (const char *key, char **uuid, int *transition_id, int *action_id, int *target_rc)
 Parse a transition key into its constituent parts. More...
 
gboolean decode_transition_magic (const char *magic, char **uuid, int *transition_id, int *action_id, int *op_status, int *op_rc, int *target_rc)
 Parse a transition magic string into its constituent parts. More...
 
int rsc_op_expected_rc (const lrmd_event_data_t *event)
 
gboolean did_rsc_op_fail (lrmd_event_data_t *event, int target_rc)
 
bool crm_op_needs_metadata (const char *rsc_class, const char *op)
 Check whether an operation requires resource agent meta-data. More...
 
xmlNode * crm_create_op_xml (xmlNode *parent, const char *prefix, const char *task, const char *interval_spec, const char *timeout)
 Create a CIB XML element for an operation. More...
 
bool pcmk_is_probe (const char *task, guint interval)
 Check whether an action name and interval represent a probe. More...
 
bool pcmk_xe_is_probe (const xmlNode *xml_op)
 Check whether an action history entry represents a probe. More...
 
bool pcmk_xe_mask_probe_failure (const xmlNode *xml_op)
 Check whether an action history entry represents a maskable probe. More...
 

Detailed Description

APIs related to actions.

Definition in file actions.h.

Macro Definition Documentation

◆ PCMK_ACTION_CANCEL

#define PCMK_ACTION_CANCEL   "cancel"

Definition at line 45 of file actions.h.

◆ PCMK_ACTION_CLEAR_FAILCOUNT

#define PCMK_ACTION_CLEAR_FAILCOUNT   "clear_failcount"

Definition at line 46 of file actions.h.

◆ PCMK_ACTION_CLONE_ONE_OR_MORE

#define PCMK_ACTION_CLONE_ONE_OR_MORE   "clone-one-or-more"

Definition at line 47 of file actions.h.

◆ PCMK_ACTION_DELETE

#define PCMK_ACTION_DELETE   "delete"

Definition at line 48 of file actions.h.

◆ PCMK_ACTION_DEMOTE

#define PCMK_ACTION_DEMOTE   "demote"

Definition at line 49 of file actions.h.

◆ PCMK_ACTION_DEMOTED

#define PCMK_ACTION_DEMOTED   "demoted"

Definition at line 50 of file actions.h.

◆ PCMK_ACTION_DO_SHUTDOWN

#define PCMK_ACTION_DO_SHUTDOWN   "do_shutdown"

Definition at line 51 of file actions.h.

◆ PCMK_ACTION_LIST

#define PCMK_ACTION_LIST   "list"

Definition at line 52 of file actions.h.

◆ PCMK_ACTION_LOAD_STOPPED

#define PCMK_ACTION_LOAD_STOPPED   "load_stopped"

Definition at line 54 of file actions.h.

◆ PCMK_ACTION_LRM_DELETE

#define PCMK_ACTION_LRM_DELETE   "lrm_delete"

Definition at line 53 of file actions.h.

◆ PCMK_ACTION_MAINTENANCE_NODES

#define PCMK_ACTION_MAINTENANCE_NODES   "maintenance_nodes"

Definition at line 55 of file actions.h.

◆ PCMK_ACTION_META_DATA

#define PCMK_ACTION_META_DATA   "meta-data"

Definition at line 56 of file actions.h.

◆ PCMK_ACTION_METADATA

#define PCMK_ACTION_METADATA   "metadata"

Definition at line 57 of file actions.h.

◆ PCMK_ACTION_MIGRATE_FROM

#define PCMK_ACTION_MIGRATE_FROM   "migrate_from"

Definition at line 58 of file actions.h.

◆ PCMK_ACTION_MIGRATE_TO

#define PCMK_ACTION_MIGRATE_TO   "migrate_to"

Definition at line 59 of file actions.h.

◆ PCMK_ACTION_MONITOR

#define PCMK_ACTION_MONITOR   "monitor"

Definition at line 60 of file actions.h.

◆ PCMK_ACTION_NOTIFIED

#define PCMK_ACTION_NOTIFIED   "notified"

Definition at line 61 of file actions.h.

◆ PCMK_ACTION_NOTIFY

#define PCMK_ACTION_NOTIFY   "notify"

Definition at line 62 of file actions.h.

◆ PCMK_ACTION_OFF

#define PCMK_ACTION_OFF   "off"

Definition at line 63 of file actions.h.

◆ PCMK_ACTION_ON

#define PCMK_ACTION_ON   "on"

Definition at line 64 of file actions.h.

◆ PCMK_ACTION_ONE_OR_MORE

#define PCMK_ACTION_ONE_OR_MORE   "one-or-more"

Definition at line 65 of file actions.h.

◆ PCMK_ACTION_PROMOTE

#define PCMK_ACTION_PROMOTE   "promote"

Definition at line 66 of file actions.h.

◆ PCMK_ACTION_PROMOTED

#define PCMK_ACTION_PROMOTED   "promoted"

Definition at line 67 of file actions.h.

◆ PCMK_ACTION_REBOOT

#define PCMK_ACTION_REBOOT   "reboot"

Definition at line 68 of file actions.h.

◆ PCMK_ACTION_RELOAD

#define PCMK_ACTION_RELOAD   "reload"

Definition at line 69 of file actions.h.

◆ PCMK_ACTION_RELOAD_AGENT

#define PCMK_ACTION_RELOAD_AGENT   "reload-agent"

Definition at line 70 of file actions.h.

◆ PCMK_ACTION_RUNNING

#define PCMK_ACTION_RUNNING   "running"

Definition at line 71 of file actions.h.

◆ PCMK_ACTION_START

#define PCMK_ACTION_START   "start"

Definition at line 72 of file actions.h.

◆ PCMK_ACTION_STATUS

#define PCMK_ACTION_STATUS   "status"

Definition at line 73 of file actions.h.

◆ PCMK_ACTION_STONITH

#define PCMK_ACTION_STONITH   "stonith"

Definition at line 74 of file actions.h.

◆ PCMK_ACTION_STOP

#define PCMK_ACTION_STOP   "stop"

Definition at line 75 of file actions.h.

◆ PCMK_ACTION_STOPPED

#define PCMK_ACTION_STOPPED   "stopped"

Definition at line 76 of file actions.h.

◆ PCMK_ACTION_VALIDATE_ALL

#define PCMK_ACTION_VALIDATE_ALL   "validate-all"

Definition at line 77 of file actions.h.

◆ PCMK_DEFAULT_ACTION_TIMEOUT_MS

#define PCMK_DEFAULT_ACTION_TIMEOUT_MS   20000

Default timeout (in milliseconds) for non-metadata actions.

Definition at line 38 of file actions.h.

◆ PCMK_DEFAULT_METADATA_TIMEOUT_MS

#define PCMK_DEFAULT_METADATA_TIMEOUT_MS   30000
Deprecated:
Default timeout (in milliseconds) for metadata actions

Definition at line 42 of file actions.h.

Enumeration Type Documentation

◆ action_fail_response

Deprecated:
Do not use (public access will be removed in a future release)
Enumerator
pcmk_on_fail_ignore 
pcmk_on_fail_restart 
pcmk_on_fail_ban 
pcmk_on_fail_block 
pcmk_on_fail_stop 
pcmk_on_fail_standby_node 
pcmk_on_fail_fence_node 
pcmk_on_fail_restart_container 
pcmk_on_fail_reset_remote 
pcmk_on_fail_demote 
action_fail_ignore 
action_fail_recover 
action_fail_migrate 
action_fail_block 
action_fail_stop 
action_fail_standby 
action_fail_fence 
action_fail_restart_container 
action_fail_reset_remote 
action_fail_demote 

Definition at line 130 of file actions.h.

◆ action_tasks

Deprecated:
Do not use (public access will be removed in a future release)
Enumerator
pcmk_action_unspecified 
pcmk_action_monitor 
pcmk_action_stop 
pcmk_action_stopped 
pcmk_action_start 
pcmk_action_started 
pcmk_action_notify 
pcmk_action_notified 
pcmk_action_promote 
pcmk_action_promoted 
pcmk_action_demote 
pcmk_action_demoted 
pcmk_action_shutdown 
pcmk_action_fence 
no_action 
monitor_rsc 
stop_rsc 
stopped_rsc 
start_rsc 
started_rsc 
action_notify 
action_notified 
action_promote 
action_promoted 
action_demote 
action_demoted 
shutdown_crm 
stonith_node 

Definition at line 83 of file actions.h.

◆ pe_action_flags

Deprecated:
Do not use (public access will be removed in a future release)
Enumerator
pcmk_no_action_flags 
pcmk_action_pseudo 
pcmk_action_runnable 
pcmk_action_optional 
pcmk_action_always_in_graph 
pcmk_action_attrs_evaluated 
pcmk_action_migratable 
pcmk_action_added_to_graph 
pcmk_action_migration_abort 
pcmk_action_min_runnable 
pcmk_action_reschedule 
pcmk_action_detect_loop 
pcmk_action_inputs_deduplicated 
pcmk_action_on_dc 
pe_action_pseudo 
pe_action_runnable 
pe_action_optional 
pe_action_print_always 
pe_action_have_node_attrs 
pe_action_implied_by_stonith 
pe_action_migrate_runnable 
pe_action_dumped 
pe_action_processed 
pe_action_clear 
pe_action_dangle 
pe_action_requires_any 
pe_action_reschedule 
pe_action_tracking 
pe_action_dedup 
pe_action_dc 

Definition at line 199 of file actions.h.

◆ pe_link_state

Deprecated:
Do not use
Enumerator
pe_link_not_dumped 
pe_link_dumped 
pe_link_dup 

Definition at line 275 of file actions.h.

◆ pe_ordering

Deprecated:
Do not use
Enumerator
pe_order_none 
pe_order_optional 
pe_order_apply_first_non_migratable 
pe_order_implies_first 
pe_order_implies_then 
pe_order_promoted_implies_first 
pe_order_implies_first_migratable 
pe_order_runnable_left 
pe_order_pseudo_left 
pe_order_implies_then_on_node 
pe_order_probe 
pe_order_restart 
pe_order_stonith_stop 
pe_order_serialize_only 
pe_order_same_node 
pe_order_implies_first_printed 
pe_order_implies_then_printed 
pe_order_asymmetrical 
pe_order_load 
pe_order_one_or_more 
pe_order_anti_colocation 
pe_order_preserve 
pe_order_then_cancels_first 
pe_order_trace 
pe_order_implies_first_master 

Definition at line 283 of file actions.h.

Function Documentation

◆ crm_create_op_xml()

xmlNode* crm_create_op_xml ( xmlNode *  parent,
const char *  prefix,
const char *  task,
const char *  interval_spec,
const char *  timeout 
)

Create a CIB XML element for an operation.

Parameters
[in,out]parentIf not NULL, make new XML node a child of this
[in]prefixGenerate an ID using this prefix
[in]taskOperation task to set
[in]interval_specOperation interval to set
[in]timeoutIf not NULL, operation timeout to set
Returns
New XML object on success, NULL otherwise

Definition at line 520 of file actions.c.

◆ crm_op_needs_metadata()

bool crm_op_needs_metadata ( const char *  rsc_class,
const char *  op 
)

Check whether an operation requires resource agent meta-data.

Parameters
[in]rsc_classResource agent class (or NULL to skip class check)
[in]opOperation action (or NULL to skip op check)
Returns
true if operation needs meta-data, false otherwise
Note
At least one of rsc_class and op must be specified.

Definition at line 547 of file actions.c.

◆ decode_transition_key()

gboolean decode_transition_key ( const char *  key,
char **  uuid,
int *  transition_id,
int *  action_id,
int *  target_rc 
)

Parse a transition key into its constituent parts.

Parameters
[in]keyTransition key to parse (must be non-NULL)
[out]uuidIf non-NULL, where to store copy of parsed UUID
[out]transition_idIf non-NULL, where to store parsed transition ID
[out]action_idIf non-NULL, where to store parsed action ID
[out]target_rcIf non-NULL, where to stored parsed target rc
Returns
TRUE if key was valid, FALSE otherwise
Note
If uuid is supplied and this returns TRUE, the caller is responsible for freeing the memory for *uuid using free().

Definition at line 425 of file actions.c.

◆ decode_transition_magic()

gboolean decode_transition_magic ( const char *  magic,
char **  uuid,
int *  transition_id,
int *  action_id,
int *  op_status,
int *  op_rc,
int *  target_rc 
)

Parse a transition magic string into its constituent parts.

Parameters
[in]magicMagic string to parse (must be non-NULL)
[out]uuidIf non-NULL, where to store copy of parsed UUID
[out]transition_idIf non-NULL, where to store parsed transition ID
[out]action_idIf non-NULL, where to store parsed action ID
[out]op_statusIf non-NULL, where to store parsed result status
[out]op_rcIf non-NULL, where to store parsed actual rc
[out]target_rcIf non-NULL, where to stored parsed target rc
Returns
TRUE if key was valid, FALSE otherwise
Note
If uuid is supplied and this returns TRUE, the caller is responsible for freeing the memory for *uuid using free().

Definition at line 362 of file actions.c.

◆ did_rsc_op_fail()

gboolean did_rsc_op_fail ( lrmd_event_data_t event,
int  target_rc 
)

Definition at line 483 of file actions.c.

◆ parse_op_key()

gboolean parse_op_key ( const char *  key,
char **  rsc_id,
char **  op_type,
guint *  interval_ms 
)

Definition at line 249 of file actions.c.

◆ pcmk_action_text()

const char* pcmk_action_text ( enum action_tasks  action)

Get string equivalent of an action type.

Deprecated:
Do not use (public access will be removed in a future release)
Parameters
[in]actionAction type
Returns
Static string describing action

Definition at line 37 of file actions.c.

◆ pcmk_is_probe()

bool pcmk_is_probe ( const char *  task,
guint  interval_ms 
)

Check whether an action name and interval represent a probe.

Parameters
[in]taskAction name
[in]interval_msAction interval in milliseconds
Returns
true if task is PCMK_ACTION_MONITOR and interval_ms is 0, otherwise false

Definition at line 30 of file probes.c.

◆ pcmk_on_fail_text()

const char* pcmk_on_fail_text ( enum action_fail_response  on_fail)

Get string equivalent of a failure handling type.

Deprecated:
Do not use (public access will be removed in a future release)
Parameters
[in]on_failFailure handling type
Returns
Static string describing on_fail

Definition at line 147 of file actions.c.

◆ pcmk_parse_action()

enum action_tasks pcmk_parse_action ( const char *  action_name)

Parse an action type from an action name.

Deprecated:
Do not use (public access will be removed in a future release)
Parameters
[in]action_nameAction name
Returns
Action type corresponding to action_name

Definition at line 92 of file actions.c.

◆ pcmk_xe_is_probe()

bool pcmk_xe_is_probe ( const xmlNode *  xml)

Check whether an action history entry represents a probe.

Parameters
[in]xmlXML of action history entry
Returns
true if xml is for a probe action, otherwise false

Definition at line 45 of file probes.c.

◆ pcmk_xe_mask_probe_failure()

bool pcmk_xe_mask_probe_failure ( const xmlNode *  xml)

Check whether an action history entry represents a maskable probe.

Parameters
[in]xmlXML of action history entry
Returns
true if xml is for a failed probe action that should be treated as successful, otherwise false

Definition at line 69 of file probes.c.

◆ rsc_op_expected_rc()

int rsc_op_expected_rc ( const lrmd_event_data_t event)

Definition at line 472 of file actions.c.