This source file includes following definitions.
- pcmk__readable_action
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_COMMON_ACTIONS_INTERNAL__H
11 #define PCMK__CRM_COMMON_ACTIONS_INTERNAL__H
12
13 #include <stdbool.h>
14 #include <stdint.h>
15 #include <glib.h>
16 #include <libxml/tree.h>
17
18 #include <crm/common/actions.h>
19 #include <crm/common/roles.h>
20 #include <crm/common/scheduler_types.h>
21 #include <crm/common/strings_internal.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27
28 #define PCMK__OP_FMT "%s_%s_%u"
29
30
31
32
33
34
35
36
37 #define pcmk__set_action_flags(action, flags_to_set) do { \
38 (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
39 LOG_TRACE, \
40 "Action", (action)->uuid, \
41 (action)->flags, \
42 (flags_to_set), \
43 #flags_to_set); \
44 } while (0)
45
46
47
48
49
50
51
52
53 #define pcmk__clear_action_flags(action, flags_to_clear) do { \
54 (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
55 LOG_TRACE, \
56 "Action", (action)->uuid, \
57 (action)->flags, \
58 (flags_to_clear), \
59 #flags_to_clear); \
60 } while (0)
61
62
63
64
65
66
67
68
69
70 #define pcmk__set_raw_action_flags(action_flags, action_name, to_set) do { \
71 action_flags = pcmk__set_flags_as(__func__, __LINE__, \
72 LOG_TRACE, "Action", action_name, \
73 (action_flags), \
74 (to_set), #to_set); \
75 } while (0)
76
77
78
79
80
81
82
83
84
85 #define pcmk__clear_raw_action_flags(action_flags, action_name, to_clear) \
86 do { \
87 action_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
88 "Action", action_name, \
89 (action_flags), \
90 (to_clear), #to_clear); \
91 } while (0)
92
93
94 enum pcmk__action_type {
95 pcmk__action_unspecified = 0,
96 pcmk__action_monitor,
97
98
99
100 pcmk__action_stop,
101 pcmk__action_stopped,
102
103 pcmk__action_start,
104 pcmk__action_started,
105
106 pcmk__action_notify,
107 pcmk__action_notified,
108
109 pcmk__action_promote,
110 pcmk__action_promoted,
111
112 pcmk__action_demote,
113 pcmk__action_demoted,
114
115 pcmk__action_shutdown,
116 pcmk__action_fence,
117 };
118
119
120 enum pcmk__action_flags {
121
122 pcmk__no_action_flags = 0,
123
124
125 pcmk__action_pseudo = (UINT32_C(1) << 0),
126
127
128 pcmk__action_runnable = (UINT32_C(1) << 1),
129
130
131 pcmk__action_optional = (UINT32_C(1) << 2),
132
133
134 pcmk__action_always_in_graph = (UINT32_C(1) << 3),
135
136
137 pcmk__action_attrs_evaluated = (UINT32_C(1) << 4),
138
139
140 pcmk__action_migratable = (UINT32_C(1) << 7),
141
142
143 pcmk__action_added_to_graph = (UINT32_C(1) << 8),
144
145
146 pcmk__action_migration_abort = (UINT32_C(1) << 11),
147
148
149 pcmk__action_reschedule = (UINT32_C(1) << 13),
150
151
152 pcmk__action_detect_loop = (UINT32_C(1) << 14),
153
154
155 pcmk__action_inputs_deduplicated = (UINT32_C(1) << 15),
156
157
158 pcmk__action_on_dc = (UINT32_C(1) << 16),
159 };
160
161
162
163
164
165
166 enum pcmk__on_fail {
167 pcmk__on_fail_ignore,
168 pcmk__on_fail_demote,
169 pcmk__on_fail_restart,
170
171
172
173
174
175 pcmk__on_fail_reset_remote,
176
177 pcmk__on_fail_restart_container,
178 pcmk__on_fail_ban,
179 pcmk__on_fail_block,
180 pcmk__on_fail_stop,
181 pcmk__on_fail_standby_node,
182 pcmk__on_fail_fence_node,
183 };
184
185
186 enum pcmk__requires {
187 pcmk__requires_nothing = 0,
188 pcmk__requires_quorum = 1,
189 pcmk__requires_fencing = 2,
190 };
191
192
193 struct pcmk__action {
194 int id;
195
196
197
198
199
200
201 int priority;
202
203 pcmk_resource_t *rsc;
204 pcmk_node_t *node;
205 xmlNode *op_entry;
206 char *task;
207 char *uuid;
208 char *cancel_task;
209 char *reason;
210 uint32_t flags;
211 enum pcmk__requires needs;
212 enum pcmk__on_fail on_fail;
213 enum rsc_role_e fail_role;
214 GHashTable *meta;
215 GHashTable *extra;
216 pcmk_scheduler_t *scheduler;
217
218
219
220
221 int runnable_before;
222
223
224
225
226
227
228 int required_runnable_before;
229
230
231 GList *actions_before;
232 GList *actions_after;
233 };
234
235 char *pcmk__op_key(const char *rsc_id, const char *op_type, guint interval_ms);
236 char *pcmk__notify_key(const char *rsc_id, const char *notify_type,
237 const char *op_type);
238 char *pcmk__transition_key(int transition_id, int action_id, int target_rc,
239 const char *node);
240 void pcmk__filter_op_for_digest(xmlNode *param_set);
241 bool pcmk__is_fencing_action(const char *action);
242 enum pcmk__action_type pcmk__parse_action(const char *action_name);
243 const char *pcmk__action_text(enum pcmk__action_type action);
244 const char *pcmk__on_fail_text(enum pcmk__on_fail on_fail);
245
246
247
248
249
250
251
252
253
254
255
256 static inline const char *
257 pcmk__readable_action(const char *action_name, guint interval_ms) {
258 if ((interval_ms == 0)
259 && pcmk__str_eq(action_name, PCMK_ACTION_MONITOR, pcmk__str_none)) {
260 return "probe";
261 }
262 return action_name;
263 }
264
265 #ifdef __cplusplus
266 }
267 #endif
268
269 #endif