pacemaker  1.1.24-3850484742
Scalable High-Availability cluster resource manager
internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2018 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This source code is licensed under the GNU Lesser General Public License
5  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
6  */
7 
8 #ifndef STONITH_NG_INTERNAL__H
9 # define STONITH_NG_INTERNAL__H
10 
11 # include <crm/common/ipc.h>
12 # include <crm/common/xml.h>
13 
15 {
21 };
22 
23 struct stonith_action_s;
24 typedef struct stonith_action_s stonith_action_t;
25 
26 stonith_action_t *stonith_action_create(const char *agent,
27  const char *_action,
28  const char *victim,
29  uint32_t victim_nodeid,
30  int timeout,
31  GHashTable * device_args,
32  GHashTable * port_map,
33  const char * host_arg);
35 void stonith__action_result(stonith_action_t *action, int *rc, char **output,
36  char **error_output);
37 
38 int
40  void *userdata,
41  void (*done) (GPid pid, int rc, const char *output,
42  gpointer user_data),
43  void (*fork_cb) (GPid pid, gpointer user_data));
44 
46 
47 xmlNode *create_level_registration_xml(const char *node, const char *pattern,
48  const char *attr, const char *value,
49  int level,
50  stonith_key_value_t *device_list);
51 
52 xmlNode *create_device_registration_xml(const char *id,
53  enum stonith_namespace namespace,
54  const char *agent,
55  stonith_key_value_t *params,
56  const char *rsc_provides);
57 
58 long long stonith__device_parameter_flags(xmlNode *metadata);
59 
60 # define ST_LEVEL_MAX 10
61 
62 # define F_STONITH_CLIENTID "st_clientid"
63 # define F_STONITH_CALLOPTS "st_callopt"
64 # define F_STONITH_CALLID "st_callid"
65 # define F_STONITH_CALLDATA "st_calldata"
66 # define F_STONITH_OPERATION "st_op"
67 # define F_STONITH_TARGET "st_target"
68 # define F_STONITH_REMOTE_OP_ID "st_remote_op"
69 # define F_STONITH_REMOTE_OP_ID_RELAY "st_remote_op_relay"
70 # define F_STONITH_RC "st_rc"
71 
72 # define F_STONITH_TIMEOUT "st_timeout"
73 # define F_STONITH_TOLERANCE "st_tolerance"
74 # define F_STONITH_DELAY "st_delay"
75 
76 # define F_STONITH_ACTION_TIMEOUT "st_action_timeout"
77 
78 # define F_STONITH_ACTION_DISALLOWED "st_action_disallowed"
79 
80 # define F_STONITH_DELAY_MAX "st_delay_max"
81 
82 # define F_STONITH_DELAY_BASE "st_delay_base"
83 
85 # define F_STONITH_DEVICE_VERIFIED "st_monitor_verified"
86 
87 # define F_STONITH_DEVICE_REQUIRED "st_required"
88 
89 # define F_STONITH_AVAILABLE_DEVICES "st-available-devices"
90 # define F_STONITH_CALLBACK_TOKEN "st_async_id"
91 # define F_STONITH_CLIENTNAME "st_clientname"
92 # define F_STONITH_CLIENTNODE "st_clientnode"
93 # define F_STONITH_NOTIFY_TYPE "st_notify_type"
94 # define F_STONITH_NOTIFY_ACTIVATE "st_notify_activate"
95 # define F_STONITH_NOTIFY_DEACTIVATE "st_notify_deactivate"
96 # define F_STONITH_DELEGATE "st_delegate"
97 
101 # define F_STONITH_ORIGIN "st_origin"
102 # define F_STONITH_HISTORY_LIST "st_history"
103 # define F_STONITH_DATE "st_date"
104 # define F_STONITH_STATE "st_state"
105 # define F_STONITH_ACTIVE "st_active"
106 # define F_STONITH_DIFFERENTIAL "st_differential"
107 
108 # define F_STONITH_DEVICE "st_device_id"
109 # define F_STONITH_ACTION "st_device_action"
110 # define F_STONITH_MODE "st_mode"
111 
112 # define T_STONITH_NG "stonith-ng"
113 # define T_STONITH_REPLY "st-reply"
114 
117 # define T_STONITH_TIMEOUT_VALUE "st-async-timeout-value"
118 # define T_STONITH_NOTIFY "st_notify"
119 
120 # define STONITH_ATTR_ARGMAP "pcmk_arg_map"
121 # define STONITH_ATTR_HOSTARG "pcmk_host_argument"
122 # define STONITH_ATTR_HOSTMAP "pcmk_host_map"
123 # define STONITH_ATTR_HOSTLIST "pcmk_host_list"
124 # define STONITH_ATTR_HOSTCHECK "pcmk_host_check"
125 # define STONITH_ATTR_DELAY_MAX "pcmk_delay_max"
126 # define STONITH_ATTR_DELAY_BASE "pcmk_delay_base"
127 # define STONITH_ATTR_ACTION_LIMIT "pcmk_action_limit"
128 
129 # define STONITH_ATTR_ACTION_OP "action"
130 
131 # define STONITH_OP_EXEC "st_execute"
132 # define STONITH_OP_TIMEOUT_UPDATE "st_timeout_update"
133 # define STONITH_OP_QUERY "st_query"
134 # define STONITH_OP_FENCE "st_fence"
135 # define STONITH_OP_RELAY "st_relay"
136 # define STONITH_OP_CONFIRM "st_confirm"
137 # define STONITH_OP_DEVICE_ADD "st_device_register"
138 # define STONITH_OP_DEVICE_DEL "st_device_remove"
139 # define STONITH_OP_DEVICE_METADATA "st_device_metadata"
140 # define STONITH_OP_FENCE_HISTORY "st_fence_history"
141 # define STONITH_OP_LEVEL_ADD "st_level_add"
142 # define STONITH_OP_LEVEL_DEL "st_level_remove"
143 
144 # define stonith_channel "st_command"
145 # define stonith_channel_callback "st_callback"
146 
147 # define STONITH_WATCHDOG_AGENT "#watchdog"
148 
149 # ifdef HAVE_STONITH_STONITH_H
150 // utilities from st_lha.c
152 int stonith__lha_metadata(const char *agent, int timeout, char **output);
153 bool stonith__agent_is_lha(const char *agent);
154 int stonith__lha_validate(stonith_t *st, int call_options, const char *target,
155  const char *agent, GHashTable *params,
156  int timeout, char **output, char **error_output);
157 # endif
158 
159 // utilities from st_rhcs.c
161 int stonith__rhcs_metadata(const char *agent, int timeout, char **output);
162 bool stonith__agent_is_rhcs(const char *agent);
163 int stonith__rhcs_validate(stonith_t *st, int call_options, const char *target,
164  const char *agent, GHashTable *params, const char *host_arg,
165  int timeout, char **output, char **error_output);
166 
167 #endif
void stonith__destroy_action(stonith_action_t *action)
Definition: st_client.c:700
struct stonith_action_s stonith_action_t
Definition: internal.h:24
void stonith__action_result(stonith_action_t *action, int *rc, char **output, char **error_output)
Definition: st_client.c:731
int stonith__rhcs_metadata(const char *agent, int timeout, char **output)
Execute RHCS-compatible agent&#39;s meta-data action.
Definition: st_rhcs.c:184
int stonith__execute(stonith_action_t *action)
Definition: st_client.c:1010
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:406
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
int stonith__lha_metadata(const char *agent, int timeout, char **output)
Definition: st_lha.c:152
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, const char *host_arg)
Definition: st_client.c:760
stonith_namespace
Definition: stonith-ng.h:81
uint32_t pid
Definition: internal.h:77
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:983
int stonith__list_lha_agents(stonith_key_value_t **devices)
Definition: st_lha.c:84
st_device_flags
Definition: internal.h:14
bool stonith__agent_is_rhcs(const char *agent)
Definition: st_rhcs.c:210
Wrappers for and extensions to libxml2.
int stonith__rhcs_validate(stonith_t *st, int call_options, const char *target, const char *agent, GHashTable *params, const char *host_arg, int timeout, char **output, char **error_output)
Definition: st_rhcs.c:221
int stonith__list_rhcs_agents(stonith_key_value_t **devices)
Definition: st_rhcs.c:29
long long stonith__device_parameter_flags(xmlNode *metadata)
Definition: st_client.c:2433
#define uint32_t
Definition: stdint.in.h:158
Wrappers for and extensions to libqb IPC.
bool stonith__agent_is_lha(const char *agent)
Determine namespace of a fence agent.
Definition: st_lha.c:57
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:286