pacemaker  2.0.3-4b1f869f0f
Scalable High-Availability cluster resource manager
internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2019 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 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/output.h>
16 # include <crm/common/xml.h>
17 
18 struct stonith_action_s;
19 typedef struct stonith_action_s stonith_action_t;
20 
21 stonith_action_t *stonith_action_create(const char *agent,
22  const char *_action,
23  const char *victim,
24  uint32_t victim_nodeid,
25  int timeout,
26  GHashTable * device_args, GHashTable * port_map);
28 void stonith__action_result(stonith_action_t *action, int *rc, char **output,
29  char **error_output);
30 
31 int
33  void *userdata,
34  void (*done) (GPid pid, int rc, const char *output,
35  gpointer user_data),
36  void (*fork_cb) (GPid pid, gpointer user_data));
37 
39 
40 xmlNode *create_level_registration_xml(const char *node, const char *pattern,
41  const char *attr, const char *value,
42  int level,
43  stonith_key_value_t *device_list);
44 
45 xmlNode *create_device_registration_xml(const char *id,
46  enum stonith_namespace namespace,
47  const char *agent,
48  stonith_key_value_t *params,
49  const char *rsc_provides);
50 
52 
53 GList *stonith__parse_targets(const char *hosts);
54 
55 gboolean stonith__later_succeeded(stonith_history_t *event, stonith_history_t *top_history);
57 
58 # define ST_LEVEL_MAX 10
59 
60 # define F_STONITH_CLIENTID "st_clientid"
61 # define F_STONITH_CALLOPTS "st_callopt"
62 # define F_STONITH_CALLID "st_callid"
63 # define F_STONITH_CALLDATA "st_calldata"
64 # define F_STONITH_OPERATION "st_op"
65 # define F_STONITH_TARGET "st_target"
66 # define F_STONITH_REMOTE_OP_ID "st_remote_op"
67 # define F_STONITH_RC "st_rc"
68 
69 # define F_STONITH_TIMEOUT "st_timeout"
70 # define F_STONITH_TOLERANCE "st_tolerance"
71 
72 # define F_STONITH_ACTION_TIMEOUT "st_action_timeout"
73 
74 # define F_STONITH_ACTION_DISALLOWED "st_action_disallowed"
75 
76 # define F_STONITH_DELAY_MAX "st_delay_max"
77 
78 # define F_STONITH_DELAY_BASE "st_delay_base"
79 
81 # define F_STONITH_DEVICE_VERIFIED "st_monitor_verified"
82 
83 # define F_STONITH_DEVICE_REQUIRED "st_required"
84 
85 # define F_STONITH_AVAILABLE_DEVICES "st-available-devices"
86 # define F_STONITH_CALLBACK_TOKEN "st_async_id"
87 # define F_STONITH_CLIENTNAME "st_clientname"
88 # define F_STONITH_CLIENTNODE "st_clientnode"
89 # define F_STONITH_NOTIFY_ACTIVATE "st_notify_activate"
90 # define F_STONITH_NOTIFY_DEACTIVATE "st_notify_deactivate"
91 # define F_STONITH_DELEGATE "st_delegate"
92 
96 # define F_STONITH_ORIGIN "st_origin"
97 # define F_STONITH_HISTORY_LIST "st_history"
98 # define F_STONITH_DATE "st_date"
99 # define F_STONITH_STATE "st_state"
100 # define F_STONITH_ACTIVE "st_active"
101 # define F_STONITH_DIFFERENTIAL "st_differential"
102 
103 # define F_STONITH_DEVICE "st_device_id"
104 # define F_STONITH_ACTION "st_device_action"
105 # define F_STONITH_MODE "st_mode"
106 
107 # define T_STONITH_NG "stonith-ng"
108 # define T_STONITH_REPLY "st-reply"
109 
112 # define T_STONITH_TIMEOUT_VALUE "st-async-timeout-value"
113 # define T_STONITH_NOTIFY "st_notify"
114 
115 # define STONITH_ATTR_HOSTARG "pcmk_host_argument"
116 # define STONITH_ATTR_HOSTMAP "pcmk_host_map"
117 # define STONITH_ATTR_HOSTLIST "pcmk_host_list"
118 # define STONITH_ATTR_HOSTCHECK "pcmk_host_check"
119 # define STONITH_ATTR_DELAY_MAX "pcmk_delay_max"
120 # define STONITH_ATTR_DELAY_BASE "pcmk_delay_base"
121 # define STONITH_ATTR_ACTION_LIMIT "pcmk_action_limit"
122 
123 # define STONITH_ATTR_ACTION_OP "action"
124 
125 # define STONITH_OP_EXEC "st_execute"
126 # define STONITH_OP_TIMEOUT_UPDATE "st_timeout_update"
127 # define STONITH_OP_QUERY "st_query"
128 # define STONITH_OP_FENCE "st_fence"
129 # define STONITH_OP_RELAY "st_relay"
130 # define STONITH_OP_DEVICE_ADD "st_device_register"
131 # define STONITH_OP_DEVICE_DEL "st_device_remove"
132 # define STONITH_OP_FENCE_HISTORY "st_fence_history"
133 # define STONITH_OP_LEVEL_ADD "st_level_add"
134 # define STONITH_OP_LEVEL_DEL "st_level_remove"
135 
136 # define STONITH_WATCHDOG_AGENT "#watchdog"
137 
138 # ifdef HAVE_STONITH_STONITH_H
139 // utilities from st_lha.c
141 int stonith__lha_metadata(const char *agent, int timeout, char **output);
142 bool stonith__agent_is_lha(const char *agent);
143 int stonith__lha_validate(stonith_t *st, int call_options, const char *target,
144  const char *agent, GHashTable *params,
145  int timeout, char **output, char **error_output);
146 # endif
147 
148 // utilities from st_rhcs.c
150 int stonith__rhcs_metadata(const char *agent, int timeout, char **output);
151 bool stonith__agent_is_rhcs(const char *agent);
152 int stonith__rhcs_validate(stonith_t *st, int call_options, const char *target,
153  const char *agent, GHashTable *params,
154  int timeout, char **output, char **error_output);
155 
156 #endif
stonith__execute
int stonith__execute(stonith_action_t *action)
Definition: st_client.c:897
stonith__action_result
void stonith__action_result(stonith_action_t *action, int *rc, char **output, char **error_output)
Definition: st_client.c:620
stonith__lha_validate
int stonith__lha_validate(stonith_t *st, int call_options, const char *target, const char *agent, GHashTable *params, int timeout, char **output, char **error_output)
Definition: st_lha.c:251
stonith__list_lha_agents
int stonith__list_lha_agents(stonith_key_value_t **devices)
Definition: st_lha.c:84
stonith_key_value_s
Definition: stonith-ng.h:92
stonith__parse_targets
GList * stonith__parse_targets(const char *hosts)
Definition: st_client.c:2484
stonith__lha_metadata
int stonith__lha_metadata(const char *agent, int timeout, char **output)
Definition: st_lha.c:152
xml.h
Wrappers for and extensions to libxml2.
create_device_registration_xml
xmlNode * create_device_registration_xml(const char *id, enum stonith_namespace namespace, const char *agent, stonith_key_value_t *params, const char *rsc_provides)
Definition: st_client.c:277
stonith_action_execute_async
int stonith_action_execute_async(stonith_action_t *action, void *userdata, void(*done)(GPid pid, int rc, const char *output, gpointer user_data), void(*fork_cb)(GPid pid, gpointer user_data))
Definition: st_client.c:870
stonith__sort_history
stonith_history_t * stonith__sort_history(stonith_history_t *history)
Definition: st_client.c:2555
stonith_history_s
Definition: stonith-ng.h:98
stonith__destroy_action
void stonith__destroy_action(stonith_action_t *action)
Definition: st_client.c:589
pid
uint32_t pid
Definition: internal.h:3
stonith_action_create
stonith_action_t * stonith_action_create(const char *agent, const char *_action, const char *victim, uint32_t victim_nodeid, int timeout, GHashTable *device_args, GHashTable *port_map)
Definition: st_client.c:649
stonith__list_rhcs_agents
int stonith__list_rhcs_agents(stonith_key_value_t **devices)
Definition: st_rhcs.c:31
ipc.h
Wrappers for and extensions to libqb IPC.
stonith__later_succeeded
gboolean stonith__later_succeeded(stonith_history_t *event, stonith_history_t *top_history)
Definition: st_client.c:2524
stonith__agent_is_rhcs
bool stonith__agent_is_rhcs(const char *agent)
Definition: st_rhcs.c:181
pcmk__output_s
This structure contains everything that makes up a single output formatter.
Definition: output.h:150
stonith__register_messages
void stonith__register_messages(pcmk__output_t *out)
Definition: st_output.c:294
create_level_registration_xml
xmlNode * create_level_registration_xml(const char *node, const char *pattern, const char *attr, const char *value, int level, stonith_key_value_t *device_list)
Definition: st_client.c:397
stonith__rhcs_metadata
int stonith__rhcs_metadata(const char *agent, int timeout, char **output)
Execute RHCS-compatible agent's meta-data action.
Definition: st_rhcs.c:98
stonith__rhcs_validate
int stonith__rhcs_validate(stonith_t *st, int call_options, const char *target, const char *agent, GHashTable *params, int timeout, char **output, char **error_output)
Definition: st_rhcs.c:192
stonith__agent_is_lha
bool stonith__agent_is_lha(const char *agent)
Determine namespace of a fence agent.
Definition: st_lha.c:57
stonith_action_t
struct stonith_action_s stonith_action_t
Definition: internal.h:19
output.h
Formatted output for pacemaker tools.
stonith_s
Definition: stonith-ng.h:405
stonith_namespace
stonith_namespace
Definition: stonith-ng.h:75