This source file includes following definitions.
- stonith__op_state_pending
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__CRM_FENCING_INTERNAL__H
11 #define PCMK__CRM_FENCING_INTERNAL__H
12
13 #include <stdbool.h>
14
15 #include <glib.h>
16 #include <crm/common/ipc.h>
17 #include <crm/common/xml.h>
18 #include <crm/common/output_internal.h>
19 #include <crm/common/results_internal.h>
20 #include <crm/stonith-ng.h>
21
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25
26 stonith_t *stonith__api_new(void);
27 void stonith__api_free(stonith_t *stonith_api);
28 int stonith__api_dispatch(stonith_t *stonith_api);
29
30 int stonith__api_connect_retry(stonith_t *stonith, const char *name,
31 int max_attempts);
32
33 bool stonith__agent_exists(const char *name);
34
35 stonith_key_value_t *stonith__key_value_add(stonith_key_value_t *head,
36 const char *key, const char *value);
37 void stonith__key_value_freeall(stonith_key_value_t *head, bool keys,
38 bool values);
39
40 #define stonith__set_call_options(st_call_opts, call_for, flags_to_set) do { \
41 st_call_opts = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
42 "Fencer call", (call_for), \
43 (st_call_opts), (flags_to_set), \
44 #flags_to_set); \
45 } while (0)
46
47 #define stonith__clear_call_options(st_call_opts, call_for, flags_to_clear) do { \
48 st_call_opts = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
49 "Fencer call", (call_for), \
50 (st_call_opts), (flags_to_clear), \
51 #flags_to_clear); \
52 } while (0)
53
54 struct stonith_action_s;
55 typedef struct stonith_action_s stonith_action_t;
56
57 stonith_action_t *stonith__action_create(const char *agent,
58 const char *action_name,
59 const char *target,
60 int timeout_sec,
61 GHashTable *device_args,
62 GHashTable *port_map,
63 const char *host_arg);
64 void stonith__destroy_action(stonith_action_t *action);
65 pcmk__action_result_t *stonith__action_result(stonith_action_t *action);
66 int stonith__result2rc(const pcmk__action_result_t *result);
67 void stonith__xe_set_result(xmlNode *xml, const pcmk__action_result_t *result);
68 void stonith__xe_get_result(const xmlNode *xml, pcmk__action_result_t *result);
69 xmlNode *stonith__find_xe_with_result(xmlNode *xml);
70
71 int stonith__execute_async(stonith_action_t *action, void *userdata,
72 void (*done) (int pid,
73 const pcmk__action_result_t *result,
74 void *user_data),
75 void (*fork_cb) (int pid, void *user_data));
76
77 int stonith__metadata_async(const char *agent, int timeout_sec,
78 void (*callback)(int pid,
79 const pcmk__action_result_t *result,
80 void *user_data),
81 void *user_data);
82
83 xmlNode *create_level_registration_xml(const char *node, const char *pattern,
84 const char *attr, const char *value,
85 int level,
86 const stonith_key_value_t *device_list);
87
88 xmlNode *create_device_registration_xml(const char *id,
89 enum stonith_namespace standard,
90 const char *agent,
91 const stonith_key_value_t *params,
92 const char *rsc_provides);
93
94 void stonith__register_messages(pcmk__output_t *out);
95
96 GList *stonith__parse_targets(const char *hosts);
97
98 void stonith__history_free(stonith_history_t *head);
99 const char *stonith__later_succeeded(const stonith_history_t *event,
100 const stonith_history_t *top_history);
101 stonith_history_t *stonith__sort_history(stonith_history_t *history);
102
103 const char *stonith__default_host_arg(xmlNode *metadata);
104
105
106
107
108
109 # define ST__LEVEL_COUNT 10
110
111 # define STONITH_ATTR_ACTION_OP "action"
112
113 # define STONITH_OP_EXEC "st_execute"
114 # define STONITH_OP_TIMEOUT_UPDATE "st_timeout_update"
115 # define STONITH_OP_QUERY "st_query"
116 # define STONITH_OP_FENCE "st_fence"
117 # define STONITH_OP_RELAY "st_relay"
118 # define STONITH_OP_DEVICE_ADD "st_device_register"
119 # define STONITH_OP_DEVICE_DEL "st_device_remove"
120 # define STONITH_OP_FENCE_HISTORY "st_fence_history"
121 # define STONITH_OP_LEVEL_ADD "st_level_add"
122 # define STONITH_OP_LEVEL_DEL "st_level_remove"
123 # define STONITH_OP_NOTIFY "st_notify"
124 # define STONITH_OP_POKE "poke"
125
126
127 # define STONITH_WATCHDOG_AGENT "fence_watchdog"
128
129 # define STONITH_WATCHDOG_AGENT_INTERNAL "#watchdog"
130 # define STONITH_WATCHDOG_ID "watchdog"
131
132 stonith_history_t *stonith__first_matching_event(stonith_history_t *history,
133 bool (*matching_fn)(stonith_history_t *, void *),
134 void *user_data);
135 bool stonith__event_state_pending(stonith_history_t *history, void *user_data);
136 bool stonith__event_state_eq(stonith_history_t *history, void *user_data);
137 bool stonith__event_state_neq(stonith_history_t *history, void *user_data);
138
139 int stonith__legacy2status(int rc);
140
141 int stonith__exit_status(const stonith_callback_data_t *data);
142 int stonith__execution_status(const stonith_callback_data_t *data);
143 const char *stonith__exit_reason(const stonith_callback_data_t *data);
144
145 int stonith__event_exit_status(const stonith_event_t *event);
146 int stonith__event_execution_status(const stonith_event_t *event);
147 const char *stonith__event_exit_reason(const stonith_event_t *event);
148 char *stonith__event_description(const stonith_event_t *event);
149 gchar *stonith__history_description(const stonith_history_t *event,
150 bool full_history,
151 const char *later_succeeded,
152 uint32_t show_opts);
153
154 const char *stonith__op_state_text(enum op_state state);
155
156
157
158
159
160
161
162
163
164 static inline bool
165 stonith__op_state_pending(enum op_state state)
166 {
167 return state != st_failed && state != st_done;
168 }
169
170 gboolean stonith__watchdog_fencing_enabled_for_node(const char *node);
171 gboolean stonith__watchdog_fencing_enabled_for_node_api(stonith_t *st, const char *node);
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188 int stonith__validate(stonith_t *st, int call_options, const char *rsc_id,
189 const char *agent, GHashTable *params, int timeout_sec,
190 char **output, char **error_output);
191
192 #ifdef __cplusplus
193 }
194 #endif
195
196 #endif