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 st_device_supports_none = (0 << 0),
21 st_device_supports_list = (1 << 0),
22 st_device_supports_status = (1 << 1),
23 st_device_supports_reboot = (1 << 2),
24 st_device_supports_parameter_plug = (1 << 3),
25 st_device_supports_parameter_port = (1 << 4),
26 st_device_supports_on = (1 << 5),
27 };
28
29 #define stonith__set_device_flags(device_flags, device_id, flags_to_set) do { \
30 device_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
31 "Fence device", device_id, \
32 (device_flags), (flags_to_set), \
33 #flags_to_set); \
34 } while (0)
35
36 #define stonith__set_call_options(st_call_opts, call_for, flags_to_set) do { \
37 st_call_opts = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
38 "Fencer call", (call_for), \
39 (st_call_opts), (flags_to_set), \
40 #flags_to_set); \
41 } while (0)
42
43 #define stonith__clear_call_options(st_call_opts, call_for, flags_to_clear) do { \
44 st_call_opts = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
45 "Fencer call", (call_for), \
46 (st_call_opts), (flags_to_clear), \
47 #flags_to_clear); \
48 } while (0)
49
50 struct stonith_action_s;
51 typedef struct stonith_action_s stonith_action_t;
52
53 stonith_action_t *stonith__action_create(const char *agent,
54 const char *action_name,
55 const char *target,
56 uint32_t target_nodeid,
57 int timeout_sec,
58 GHashTable *device_args,
59 GHashTable *port_map,
60 const char *host_arg);
61 void stonith__destroy_action(stonith_action_t *action);
62 pcmk__action_result_t *stonith__action_result(stonith_action_t *action);
63 int stonith__result2rc(const pcmk__action_result_t *result);
64 void stonith__xe_set_result(xmlNode *xml, const pcmk__action_result_t *result);
65 void stonith__xe_get_result(const xmlNode *xml, pcmk__action_result_t *result);
66 xmlNode *stonith__find_xe_with_result(xmlNode *xml);
67
68 int stonith__execute_async(stonith_action_t *action, void *userdata,
69 void (*done) (int pid,
70 const pcmk__action_result_t *result,
71 void *user_data),
72 void (*fork_cb) (int pid, void *user_data));
73
74 int stonith__metadata_async(const char *agent, int timeout_sec,
75 void (*callback)(int pid,
76 const pcmk__action_result_t *result,
77 void *user_data),
78 void *user_data);
79
80 xmlNode *create_level_registration_xml(const char *node, const char *pattern,
81 const char *attr, const char *value,
82 int level,
83 const stonith_key_value_t *device_list);
84
85 xmlNode *create_device_registration_xml(const char *id,
86 enum stonith_namespace namespace,
87 const char *agent,
88 const stonith_key_value_t *params,
89 const char *rsc_provides);
90
91 void stonith__register_messages(pcmk__output_t *out);
92
93 GList *stonith__parse_targets(const char *hosts);
94
95 const char *stonith__later_succeeded(const stonith_history_t *event,
96 const stonith_history_t *top_history);
97 stonith_history_t *stonith__sort_history(stonith_history_t *history);
98
99 void stonith__device_parameter_flags(uint32_t *device_flags,
100 const char *device_name,
101 xmlNode *metadata);
102
103
104
105
106
107 # define ST__LEVEL_COUNT 10
108
109
110 # define STONITH_ATTR_ACTION_OP "action"
111
112 # define STONITH_OP_EXEC "st_execute"
113 # define STONITH_OP_TIMEOUT_UPDATE "st_timeout_update"
114 # define STONITH_OP_QUERY "st_query"
115 # define STONITH_OP_FENCE "st_fence"
116 # define STONITH_OP_RELAY "st_relay"
117 # define STONITH_OP_DEVICE_ADD "st_device_register"
118 # define STONITH_OP_DEVICE_DEL "st_device_remove"
119 # define STONITH_OP_FENCE_HISTORY "st_fence_history"
120 # define STONITH_OP_LEVEL_ADD "st_level_add"
121 # define STONITH_OP_LEVEL_DEL "st_level_remove"
122 # define STONITH_OP_NOTIFY "st_notify"
123 # define STONITH_OP_POKE "poke"
124
125
126 # define STONITH_WATCHDOG_AGENT "fence_watchdog"
127
128 # define STONITH_WATCHDOG_AGENT_INTERNAL "#watchdog"
129 # define STONITH_WATCHDOG_ID "watchdog"
130
131 stonith_history_t *stonith__first_matching_event(stonith_history_t *history,
132 bool (*matching_fn)(stonith_history_t *, void *),
133 void *user_data);
134 bool stonith__event_state_pending(stonith_history_t *history, void *user_data);
135 bool stonith__event_state_eq(stonith_history_t *history, void *user_data);
136 bool stonith__event_state_neq(stonith_history_t *history, void *user_data);
137
138 int stonith__legacy2status(int rc);
139
140 int stonith__exit_status(const stonith_callback_data_t *data);
141 int stonith__execution_status(const stonith_callback_data_t *data);
142 const char *stonith__exit_reason(const stonith_callback_data_t *data);
143
144 int stonith__event_exit_status(const stonith_event_t *event);
145 int stonith__event_execution_status(const stonith_event_t *event);
146 const char *stonith__event_exit_reason(const stonith_event_t *event);
147 char *stonith__event_description(const stonith_event_t *event);
148 gchar *stonith__history_description(const stonith_history_t *event,
149 bool full_history,
150 const char *later_succeeded,
151 uint32_t show_opts);
152
153
154
155
156
157
158
159
160
161 static inline bool
162 stonith__op_state_pending(enum op_state state)
163 {
164 return state != st_failed && state != st_done;
165 }
166
167 gboolean stonith__watchdog_fencing_enabled_for_node(const char *node);
168 gboolean stonith__watchdog_fencing_enabled_for_node_api(stonith_t *st, const char *node);
169
170 #endif