pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
actions.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2024 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PCMK__CRM_COMMON_ACTIONS__H
11 #define PCMK__CRM_COMMON_ACTIONS__H
12 
13 #include <stdbool.h> // bool
14 #include <strings.h> // strcasecmp()
15 #include <glib.h> // gboolean, guint
16 #include <libxml/tree.h> // xmlNode
17 
18 #include <crm/lrmd_events.h> // lrmd_event_data_t
19 #include <crm/common/nodes.h>
20 #include <crm/common/probes.h>
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
32 #define PCMK_DEFAULT_ACTION_TIMEOUT_MS 20000
34 
35 // Action names as strings
36 #define PCMK_ACTION_CANCEL "cancel"
37 #define PCMK_ACTION_CLEAR_FAILCOUNT "clear_failcount"
38 #define PCMK_ACTION_CLONE_ONE_OR_MORE "clone-one-or-more"
39 #define PCMK_ACTION_DELETE "delete"
40 #define PCMK_ACTION_DEMOTE "demote"
41 #define PCMK_ACTION_DEMOTED "demoted"
42 #define PCMK_ACTION_DO_SHUTDOWN "do_shutdown"
43 #define PCMK_ACTION_LIST "list"
44 #define PCMK_ACTION_LRM_DELETE "lrm_delete"
45 #define PCMK_ACTION_LOAD_STOPPED "load_stopped"
46 #define PCMK_ACTION_MAINTENANCE_NODES "maintenance_nodes"
47 #define PCMK_ACTION_META_DATA "meta-data"
48 #define PCMK_ACTION_METADATA "metadata"
49 #define PCMK_ACTION_MIGRATE_FROM "migrate_from"
50 #define PCMK_ACTION_MIGRATE_TO "migrate_to"
51 #define PCMK_ACTION_MONITOR "monitor"
52 #define PCMK_ACTION_NOTIFIED "notified"
53 #define PCMK_ACTION_NOTIFY "notify"
54 #define PCMK_ACTION_OFF "off"
55 #define PCMK_ACTION_ON "on"
56 #define PCMK_ACTION_ONE_OR_MORE "one-or-more"
57 #define PCMK_ACTION_PROMOTE "promote"
58 #define PCMK_ACTION_PROMOTED "promoted"
59 #define PCMK_ACTION_REBOOT "reboot"
60 #define PCMK_ACTION_RELOAD "reload"
61 #define PCMK_ACTION_RELOAD_AGENT "reload-agent"
62 #define PCMK_ACTION_RUNNING "running"
63 #define PCMK_ACTION_START "start"
64 #define PCMK_ACTION_STATUS "status"
65 #define PCMK_ACTION_STONITH "stonith"
66 #define PCMK_ACTION_STOP "stop"
67 #define PCMK_ACTION_STOPPED "stopped"
68 #define PCMK_ACTION_VALIDATE_ALL "validate-all"
69 
70 // For parsing various action-related string specifications
71 gboolean parse_op_key(const char *key, char **rsc_id, char **op_type,
72  guint *interval_ms);
73 gboolean decode_transition_key(const char *key, char **uuid, int *transition_id,
74  int *action_id, int *target_rc);
75 gboolean decode_transition_magic(const char *magic, char **uuid,
76  int *transition_id, int *action_id,
77  int *op_status, int *op_rc, int *target_rc);
78 
79 // @COMPAT Either these shouldn't be in libcrmcommon or lrmd_event_data_t should
80 int rsc_op_expected_rc(const lrmd_event_data_t *event);
81 gboolean did_rsc_op_fail(lrmd_event_data_t *event, int target_rc);
82 
83 bool crm_op_needs_metadata(const char *rsc_class, const char *op);
84 
85 xmlNode *crm_create_op_xml(xmlNode *parent, const char *prefix,
86  const char *task, const char *interval_spec,
87  const char *timeout);
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 #endif // PCMK__CRM_COMMON_ACTIONS__H
API for strings.
Scheduler API for probes.
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.
Definition: actions.c:361
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.
Definition: actions.c:424
gboolean did_rsc_op_fail(lrmd_event_data_t *event, int target_rc)
Definition: actions.c:482
int rsc_op_expected_rc(const lrmd_event_data_t *event)
Definition: actions.c:471
bool crm_op_needs_metadata(const char *rsc_class, const char *op)
Check whether an operation requires resource agent meta-data.
Definition: actions.c:546
Scheduler API for nodes.
gboolean parse_op_key(const char *key, char **rsc_id, char **op_type, guint *interval_ms)
Definition: actions.c:248
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.
Definition: actions.c:519
const char * parent
Definition: cib.c:27
Resource agent executor events.
unsigned int timeout
Definition: pcmk_fence.c:34