This source file includes following definitions.
- stonith__op_state_pending
1
2
3
4
5
6
7
8
9
10 #ifndef STONITH_NG_INTERNAL__H
11 # define STONITH_NG_INTERNAL__H
12
13 # include <glib.h>
14 # include <crm/common/ipc.h>
15 # include <crm/common/xml.h>
16 # include <crm/common/output_internal.h>
17 # include <crm/stonith-ng.h>
18
19 enum st_device_flags
20 {
21 st_device_supports_list = 0x0001,
22 st_device_supports_status = 0x0002,
23 st_device_supports_reboot = 0x0004,
24 st_device_supports_parameter_plug = 0x0008,
25 st_device_supports_parameter_port = 0x0010,
26 };
27
28 #define stonith__set_device_flags(device_flags, device_id, flags_to_set) do { \
29 device_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
30 "Fence device", device_id, \
31 (device_flags), (flags_to_set), \
32 #flags_to_set); \
33 } while (0)
34
35 #define stonith__set_call_options(st_call_opts, call_for, flags_to_set) do { \
36 st_call_opts = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
37 "Fencer call", (call_for), \
38 (st_call_opts), (flags_to_set), \
39 #flags_to_set); \
40 } while (0)
41
42 #define stonith__clear_call_options(st_call_opts, call_for, flags_to_clear) do { \
43 st_call_opts = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
44 "Fencer call", (call_for), \
45 (st_call_opts), (flags_to_clear), \
46 #flags_to_clear); \
47 } while (0)
48
49 struct stonith_action_s;
50 typedef struct stonith_action_s stonith_action_t;
51
52 stonith_action_t *stonith_action_create(const char *agent,
53 const char *_action,
54 const char *victim,
55 uint32_t victim_nodeid,
56 int timeout,
57 GHashTable * device_args,
58 GHashTable * port_map,
59 const char * host_arg);
60 void stonith__destroy_action(stonith_action_t *action);
61 void stonith__action_result(stonith_action_t *action, int *rc, char **output,
62 char **error_output);
63
64 int
65 stonith_action_execute_async(stonith_action_t * action,
66 void *userdata,
67 void (*done) (int pid, int rc, const char *output,
68 void *user_data),
69 void (*fork_cb) (int pid, void *user_data));
70
71 xmlNode *create_level_registration_xml(const char *node, const char *pattern,
72 const char *attr, const char *value,
73 int level,
74 stonith_key_value_t *device_list);
75
76 xmlNode *create_device_registration_xml(const char *id,
77 enum stonith_namespace namespace,
78 const char *agent,
79 stonith_key_value_t *params,
80 const char *rsc_provides);
81
82 void stonith__register_messages(pcmk__output_t *out);
83
84 GList *stonith__parse_targets(const char *hosts);
85
86 gboolean stonith__later_succeeded(stonith_history_t *event, stonith_history_t *top_history);
87 stonith_history_t *stonith__sort_history(stonith_history_t *history);
88
89 void stonith__device_parameter_flags(uint32_t *device_flags,
90 const char *device_name,
91 xmlNode *metadata);
92
93 # define ST_LEVEL_MAX 10
94
95 # define F_STONITH_CLIENTID "st_clientid"
96 # define F_STONITH_CALLOPTS "st_callopt"
97 # define F_STONITH_CALLID "st_callid"
98 # define F_STONITH_CALLDATA "st_calldata"
99 # define F_STONITH_OPERATION "st_op"
100 # define F_STONITH_TARGET "st_target"
101 # define F_STONITH_REMOTE_OP_ID "st_remote_op"
102 # define F_STONITH_REMOTE_OP_ID_RELAY "st_remote_op_relay"
103 # define F_STONITH_RC "st_rc"
104
105 # define F_STONITH_TIMEOUT "st_timeout"
106 # define F_STONITH_TOLERANCE "st_tolerance"
107 # define F_STONITH_DELAY "st_delay"
108
109 # define F_STONITH_ACTION_TIMEOUT "st_action_timeout"
110
111 # define F_STONITH_ACTION_DISALLOWED "st_action_disallowed"
112
113 # define F_STONITH_DELAY_MAX "st_delay_max"
114
115 # define F_STONITH_DELAY_BASE "st_delay_base"
116
117
118 # define F_STONITH_DEVICE_VERIFIED "st_monitor_verified"
119
120 # define F_STONITH_DEVICE_REQUIRED "st_required"
121
122 # define F_STONITH_AVAILABLE_DEVICES "st-available-devices"
123 # define F_STONITH_CALLBACK_TOKEN "st_async_id"
124 # define F_STONITH_CLIENTNAME "st_clientname"
125 # define F_STONITH_CLIENTNODE "st_clientnode"
126 # define F_STONITH_NOTIFY_ACTIVATE "st_notify_activate"
127 # define F_STONITH_NOTIFY_DEACTIVATE "st_notify_deactivate"
128 # define F_STONITH_DELEGATE "st_delegate"
129
130
131
132
133 # define F_STONITH_ORIGIN "st_origin"
134 # define F_STONITH_HISTORY_LIST "st_history"
135 # define F_STONITH_DATE "st_date"
136 # define F_STONITH_DATE_NSEC "st_date_nsec"
137 # define F_STONITH_STATE "st_state"
138 # define F_STONITH_ACTIVE "st_active"
139 # define F_STONITH_DIFFERENTIAL "st_differential"
140
141 # define F_STONITH_DEVICE "st_device_id"
142 # define F_STONITH_ACTION "st_device_action"
143 # define F_STONITH_MERGED "st_op_merged"
144
145 # define T_STONITH_NG "stonith-ng"
146 # define T_STONITH_REPLY "st-reply"
147
148
149
150 # define T_STONITH_TIMEOUT_VALUE "st-async-timeout-value"
151 # define T_STONITH_NOTIFY "st_notify"
152
153 # define STONITH_ATTR_ACTION_OP "action"
154
155 # define STONITH_OP_EXEC "st_execute"
156 # define STONITH_OP_TIMEOUT_UPDATE "st_timeout_update"
157 # define STONITH_OP_QUERY "st_query"
158 # define STONITH_OP_FENCE "st_fence"
159 # define STONITH_OP_RELAY "st_relay"
160 # define STONITH_OP_DEVICE_ADD "st_device_register"
161 # define STONITH_OP_DEVICE_DEL "st_device_remove"
162 # define STONITH_OP_FENCE_HISTORY "st_fence_history"
163 # define STONITH_OP_LEVEL_ADD "st_level_add"
164 # define STONITH_OP_LEVEL_DEL "st_level_remove"
165
166 # define STONITH_WATCHDOG_AGENT "fence_watchdog"
167
168 # define STONITH_WATCHDOG_AGENT_INTERNAL "#watchdog"
169 # define STONITH_WATCHDOG_ID "watchdog"
170
171
172 int stonith__failed_history(pcmk__output_t *out, va_list args);
173 int stonith__history(pcmk__output_t *out, va_list args);
174 int stonith__full_history(pcmk__output_t *out, va_list args);
175 int stonith__pending_actions(pcmk__output_t *out, va_list args);
176
177 stonith_history_t *stonith__first_matching_event(stonith_history_t *history,
178 bool (*matching_fn)(stonith_history_t *, void *),
179 void *user_data);
180 bool stonith__event_state_pending(stonith_history_t *history, void *user_data);
181 bool stonith__event_state_eq(stonith_history_t *history, void *user_data);
182 bool stonith__event_state_neq(stonith_history_t *history, void *user_data);
183
184
185
186
187
188
189
190
191
192 static inline bool
193 stonith__op_state_pending(enum op_state state)
194 {
195 return state != st_failed && state != st_done;
196 }
197
198 gboolean stonith__watchdog_fencing_enabled_for_node(const char *node);
199 gboolean stonith__watchdog_fencing_enabled_for_node_api(stonith_t *st, const char *node);
200
201 #endif