pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
actions_internal.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_INTERNAL__H
11 #define PCMK__CRM_COMMON_ACTIONS_INTERNAL__H
12 
13 #include <stdbool.h> // bool
14 #include <glib.h> // guint
15 #include <libxml/tree.h> // xmlNode
16 
17 #include <crm/common/actions.h> // PCMK_ACTION_MONITOR
18 #include <crm/common/strings_internal.h> // pcmk__str_eq()
19 
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23 
24 // Action names as strings
25 
26 // @COMPAT Deprecated since 2.0.0
27 #define PCMK__ACTION_POWEROFF "poweroff"
28 
29 
31 #define PCMK__OP_FMT "%s_%s_%u"
32 
40 #define pcmk__set_action_flags(action, flags_to_set) do { \
41  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
42  LOG_TRACE, \
43  "Action", (action)->uuid, \
44  (action)->flags, \
45  (flags_to_set), \
46  #flags_to_set); \
47  } while (0)
48 
56 #define pcmk__clear_action_flags(action, flags_to_clear) do { \
57  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
58  LOG_TRACE, \
59  "Action", (action)->uuid, \
60  (action)->flags, \
61  (flags_to_clear), \
62  #flags_to_clear); \
63  } while (0)
64 
73 #define pcmk__set_raw_action_flags(action_flags, action_name, to_set) do { \
74  action_flags = pcmk__set_flags_as(__func__, __LINE__, \
75  LOG_TRACE, "Action", action_name, \
76  (action_flags), \
77  (to_set), #to_set); \
78  } while (0)
79 
88 #define pcmk__clear_raw_action_flags(action_flags, action_name, to_clear) \
89  do { \
90  action_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
91  "Action", action_name, \
92  (action_flags), \
93  (to_clear), #to_clear); \
94  } while (0)
95 
96 char *pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms);
97 char *pcmk__notify_key(const char *rsc_id, const char *notify_type,
98  const char *op_type);
99 char *pcmk__transition_key(int transition_id, int action_id, int target_rc,
100  const char *node);
101 void pcmk__filter_op_for_digest(xmlNode *param_set);
102 bool pcmk__is_fencing_action(const char *action);
103 
113 static inline const char *
114 pcmk__readable_action(const char *action_name, guint interval_ms) {
115  if ((interval_ms == 0)
116  && pcmk__str_eq(action_name, PCMK_ACTION_MONITOR, pcmk__str_none)) {
117  return "probe";
118  }
119  return action_name;
120 }
121 
122 #ifdef __cplusplus
123 }
124 #endif
125 
126 #endif // PCMK__CRM_COMMON_ACTIONS_INTERNAL__H
void pcmk__filter_op_for_digest(xmlNode *param_set)
Definition: digest.c:303
APIs related to actions.
#define PCMK_ACTION_MONITOR
Definition: actions.h:60
const char * action
Definition: pcmk_fence.c:30
char * pcmk__transition_key(int transition_id, int action_id, int target_rc, const char *node)
Definition: actions.c:403
char * pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms)
Generate an operation key (RESOURCE_ACTION_INTERVAL)
Definition: actions.c:196
char * pcmk__notify_key(const char *rsc_id, const char *notify_type, const char *op_type)
Definition: actions.c:336
bool pcmk__is_fencing_action(const char *action)
Definition: actions.c:582