pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
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/probes.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.

Macros

#define PCMK_DEFAULT_ACTION_TIMEOUT_MS   20000
 Default timeout (in milliseconds) for non-metadata actions. More...
 
#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"
 

Functions

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...
 

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 36 of file actions.h.

◆ PCMK_ACTION_CLEAR_FAILCOUNT

#define PCMK_ACTION_CLEAR_FAILCOUNT   "clear_failcount"

Definition at line 37 of file actions.h.

◆ PCMK_ACTION_CLONE_ONE_OR_MORE

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

Definition at line 38 of file actions.h.

◆ PCMK_ACTION_DELETE

#define PCMK_ACTION_DELETE   "delete"

Definition at line 39 of file actions.h.

◆ PCMK_ACTION_DEMOTE

#define PCMK_ACTION_DEMOTE   "demote"

Definition at line 40 of file actions.h.

◆ PCMK_ACTION_DEMOTED

#define PCMK_ACTION_DEMOTED   "demoted"

Definition at line 41 of file actions.h.

◆ PCMK_ACTION_DO_SHUTDOWN

#define PCMK_ACTION_DO_SHUTDOWN   "do_shutdown"

Definition at line 42 of file actions.h.

◆ PCMK_ACTION_LIST

#define PCMK_ACTION_LIST   "list"

Definition at line 43 of file actions.h.

◆ PCMK_ACTION_LOAD_STOPPED

#define PCMK_ACTION_LOAD_STOPPED   "load_stopped"

Definition at line 45 of file actions.h.

◆ PCMK_ACTION_LRM_DELETE

#define PCMK_ACTION_LRM_DELETE   "lrm_delete"

Definition at line 44 of file actions.h.

◆ PCMK_ACTION_MAINTENANCE_NODES

#define PCMK_ACTION_MAINTENANCE_NODES   "maintenance_nodes"

Definition at line 46 of file actions.h.

◆ PCMK_ACTION_META_DATA

#define PCMK_ACTION_META_DATA   "meta-data"

Definition at line 47 of file actions.h.

◆ PCMK_ACTION_METADATA

#define PCMK_ACTION_METADATA   "metadata"

Definition at line 48 of file actions.h.

◆ PCMK_ACTION_MIGRATE_FROM

#define PCMK_ACTION_MIGRATE_FROM   "migrate_from"

Definition at line 49 of file actions.h.

◆ PCMK_ACTION_MIGRATE_TO

#define PCMK_ACTION_MIGRATE_TO   "migrate_to"

Definition at line 50 of file actions.h.

◆ PCMK_ACTION_MONITOR

#define PCMK_ACTION_MONITOR   "monitor"

Definition at line 51 of file actions.h.

◆ PCMK_ACTION_NOTIFIED

#define PCMK_ACTION_NOTIFIED   "notified"

Definition at line 52 of file actions.h.

◆ PCMK_ACTION_NOTIFY

#define PCMK_ACTION_NOTIFY   "notify"

Definition at line 53 of file actions.h.

◆ PCMK_ACTION_OFF

#define PCMK_ACTION_OFF   "off"

Definition at line 54 of file actions.h.

◆ PCMK_ACTION_ON

#define PCMK_ACTION_ON   "on"

Definition at line 55 of file actions.h.

◆ PCMK_ACTION_ONE_OR_MORE

#define PCMK_ACTION_ONE_OR_MORE   "one-or-more"

Definition at line 56 of file actions.h.

◆ PCMK_ACTION_PROMOTE

#define PCMK_ACTION_PROMOTE   "promote"

Definition at line 57 of file actions.h.

◆ PCMK_ACTION_PROMOTED

#define PCMK_ACTION_PROMOTED   "promoted"

Definition at line 58 of file actions.h.

◆ PCMK_ACTION_REBOOT

#define PCMK_ACTION_REBOOT   "reboot"

Definition at line 59 of file actions.h.

◆ PCMK_ACTION_RELOAD

#define PCMK_ACTION_RELOAD   "reload"

Definition at line 60 of file actions.h.

◆ PCMK_ACTION_RELOAD_AGENT

#define PCMK_ACTION_RELOAD_AGENT   "reload-agent"

Definition at line 61 of file actions.h.

◆ PCMK_ACTION_RUNNING

#define PCMK_ACTION_RUNNING   "running"

Definition at line 62 of file actions.h.

◆ PCMK_ACTION_START

#define PCMK_ACTION_START   "start"

Definition at line 63 of file actions.h.

◆ PCMK_ACTION_STATUS

#define PCMK_ACTION_STATUS   "status"

Definition at line 64 of file actions.h.

◆ PCMK_ACTION_STONITH

#define PCMK_ACTION_STONITH   "stonith"

Definition at line 65 of file actions.h.

◆ PCMK_ACTION_STOP

#define PCMK_ACTION_STOP   "stop"

Definition at line 66 of file actions.h.

◆ PCMK_ACTION_STOPPED

#define PCMK_ACTION_STOPPED   "stopped"

Definition at line 67 of file actions.h.

◆ PCMK_ACTION_VALIDATE_ALL

#define PCMK_ACTION_VALIDATE_ALL   "validate-all"

Definition at line 68 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 33 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 519 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 546 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 424 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 361 of file actions.c.

◆ did_rsc_op_fail()

gboolean did_rsc_op_fail ( lrmd_event_data_t event,
int  target_rc 
)

Definition at line 482 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 248 of file actions.c.

◆ rsc_op_expected_rc()

int rsc_op_expected_rc ( const lrmd_event_data_t event)

Definition at line 471 of file actions.c.