pacemaker 2.1.8-2.1.8
Scalable High-Availability cluster resource manager
Loading...
Searching...
No Matches
internal.h
Go to the documentation of this file.
1/*
2 * Copyright 2004-2024 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 CIB_INTERNAL__H
11# define CIB_INTERNAL__H
12# include <crm/cib.h>
15
16// Request types for CIB manager IPC/CPG
17#define PCMK__CIB_REQUEST_SECONDARY "cib_slave"
18#define PCMK__CIB_REQUEST_PRIMARY "cib_master"
19#define PCMK__CIB_REQUEST_SYNC_TO_ALL "cib_sync"
20#define PCMK__CIB_REQUEST_SYNC_TO_ONE "cib_sync_one"
21#define PCMK__CIB_REQUEST_IS_PRIMARY "cib_ismaster"
22#define PCMK__CIB_REQUEST_BUMP "cib_bump"
23#define PCMK__CIB_REQUEST_QUERY "cib_query"
24#define PCMK__CIB_REQUEST_CREATE "cib_create"
25#define PCMK__CIB_REQUEST_MODIFY "cib_modify"
26#define PCMK__CIB_REQUEST_DELETE "cib_delete"
27#define PCMK__CIB_REQUEST_ERASE "cib_erase"
28#define PCMK__CIB_REQUEST_REPLACE "cib_replace"
29#define PCMK__CIB_REQUEST_APPLY_PATCH "cib_apply_diff"
30#define PCMK__CIB_REQUEST_UPGRADE "cib_upgrade"
31#define PCMK__CIB_REQUEST_ABS_DELETE "cib_delete_alt"
32#define PCMK__CIB_REQUEST_NOOP "noop"
33#define PCMK__CIB_REQUEST_SHUTDOWN "cib_shutdown_req"
34#define PCMK__CIB_REQUEST_COMMIT_TRANSACT "cib_commit_transact"
35#define PCMK__CIB_REQUEST_SCHEMAS "cib_schemas"
36
51
79
80gboolean cib_diff_version_details(xmlNode * diff, int *admin_epoch, int *epoch, int *updates,
81 int *_admin_epoch, int *_epoch, int *_updates);
82
83gboolean cib_read_config(GHashTable * options, xmlNode * current_cib);
84
85typedef int (*cib__op_fn_t)(const char *, int, const char *, xmlNode *,
86 xmlNode *, xmlNode *, xmlNode **, xmlNode **);
87
88typedef struct cib__operation_s {
89 const char *name;
91 uint32_t flags;
93
94typedef struct cib_notify_client_s {
95 const char *event;
96 const char *obj_id; /* implement one day */
97 const char *obj_type; /* implement one day */
98 void (*callback) (const char *event, xmlNode * msg);
99
101
102typedef struct cib_callback_client_s {
103 void (*callback) (xmlNode *, int, int, xmlNode *, void *);
104 const char *id;
106 gboolean only_success;
108 void (*free_func)(void *);
110
114 guint ref;
116};
117
118#define cib__set_call_options(cib_call_opts, call_for, flags_to_set) do { \
119 cib_call_opts = pcmk__set_flags_as(__func__, __LINE__, \
120 LOG_TRACE, "CIB call", (call_for), (cib_call_opts), \
121 (flags_to_set), #flags_to_set); \
122 } while (0)
123
124#define cib__clear_call_options(cib_call_opts, call_for, flags_to_clear) do { \
125 cib_call_opts = pcmk__clear_flags_as(__func__, __LINE__, \
126 LOG_TRACE, "CIB call", (call_for), (cib_call_opts), \
127 (flags_to_clear), #flags_to_clear); \
128 } while (0)
129
131
155static inline bool
156cib__client_triggers_refresh(const char *name)
157{
158 return !crm_is_daemon_name(name)
160 "attrd_updater",
161 "crm_attribute",
162 "crm_node",
163 "crm_resource",
164 "crm_ticket",
165 NULL);
166}
167
168int cib__get_notify_patchset(const xmlNode *msg, const xmlNode **patchset);
169
170bool cib__element_in_patchset(const xmlNode *patchset, const char *element);
171
172int cib_perform_op(cib_t *cib, const char *op, int call_options, cib__op_fn_t fn,
173 bool is_query, const char *section, xmlNode *req,
174 xmlNode *input, bool manage_counters, bool *config_changed,
175 xmlNode **current_cib, xmlNode **result_cib, xmlNode **diff,
176 xmlNode **output);
177
178int cib__create_op(cib_t *cib, const char *op, const char *host,
179 const char *section, xmlNode *data, int call_options,
180 const char *user_name, const char *client_name,
181 xmlNode **op_msg);
182
183int cib__extend_transaction(cib_t *cib, xmlNode *request);
184
185void cib_native_callback(cib_t * cib, xmlNode * msg, int call_id, int rc);
186void cib_native_notify(gpointer data, gpointer user_data);
187
188int cib__get_operation(const char *op, const cib__operation_t **operation);
189
190int cib_process_query(const char *op, int options, const char *section, xmlNode * req,
191 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
192 xmlNode ** answer);
193
194int cib_process_erase(const char *op, int options, const char *section, xmlNode * req,
195 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
196 xmlNode ** answer);
197
198int cib_process_bump(const char *op, int options, const char *section, xmlNode * req,
199 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
200 xmlNode ** answer);
201
202int cib_process_replace(const char *op, int options, const char *section, xmlNode * req,
203 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
204 xmlNode ** answer);
205
206int cib_process_create(const char *op, int options, const char *section, xmlNode * req,
207 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
208 xmlNode ** answer);
209
210int cib_process_modify(const char *op, int options, const char *section, xmlNode * req,
211 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
212 xmlNode ** answer);
213
214int cib_process_delete(const char *op, int options, const char *section, xmlNode * req,
215 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
216 xmlNode ** answer);
217
218int cib_process_diff(const char *op, int options, const char *section, xmlNode * req,
219 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
220 xmlNode ** answer);
221
222int cib_process_upgrade(const char *op, int options, const char *section, xmlNode * req,
223 xmlNode * input, xmlNode * existing_cib, xmlNode ** result_cib,
224 xmlNode ** answer);
225
248int cib_process_xpath(const char *op, int options, const char *section,
249 const xmlNode *req, xmlNode *input, xmlNode *existing_cib,
250 xmlNode **result_cib, xmlNode ** answer);
251
252bool cib__config_changed_v1(xmlNode *last, xmlNode *next, xmlNode **diff);
253
254int cib_internal_op(cib_t * cib, const char *op, const char *host,
255 const char *section, xmlNode * data,
256 xmlNode ** output_data, int call_options, const char *user_name);
257
258
259int cib_file_read_and_verify(const char *filename, const char *sigfile,
260 xmlNode **root);
261int cib_file_write_with_digest(xmlNode *cib_root, const char *cib_dirname,
262 const char *cib_filename);
263
264void cib__set_output(cib_t *cib, pcmk__output_t *out);
265
267
289int cib__signon_query(pcmk__output_t *out, cib_t **cib, xmlNode **cib_object);
290
291int cib__signon_attempts(cib_t *cib, const char *name, enum cib_conn_type type,
292 int attempts);
293
295
296int cib__update_node_attr(pcmk__output_t *out, cib_t *cib, int call_options,
297 const char *section, const char *node_uuid, const char *set_type,
298 const char *set_name, const char *attr_id, const char *attr_name,
299 const char *attr_value, const char *user_name,
300 const char *node_type);
301
302int cib__get_node_attrs(pcmk__output_t *out, cib_t *cib, const char *section,
303 const char *node_uuid, const char *set_type, const char *set_name,
304 const char *attr_id, const char *attr_name, const char *user_name,
305 xmlNode **result);
306
307int cib__delete_node_attr(pcmk__output_t *out, cib_t *cib, int options,
308 const char *section, const char *node_uuid, const char *set_type,
309 const char *set_name, const char *attr_id, const char *attr_name,
310 const char *attr_value, const char *user_name);
311
312#endif
int cib__extend_transaction(cib_t *cib, xmlNode *request)
Definition cib_utils.c:743
int cib__clean_up_connection(cib_t **cib)
Definition cib_utils.c:1046
void cib_native_callback(cib_t *cib, xmlNode *msg, int call_id, int rc)
Definition cib_utils.c:771
int cib_process_delete(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:429
int cib_process_xpath(const char *op, int options, const char *section, const xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:763
int cib__get_operation(const char *op, const cib__operation_t **operation)
Definition cib_ops.c:144
int cib__get_notify_patchset(const xmlNode *msg, const xmlNode **patchset)
Definition cib_utils.c:75
int cib_process_query(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:168
struct cib_callback_client_s cib_callback_client_t
int cib_process_modify(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:457
cib_t * cib_new_variant(void)
Definition cib_client.c:676
cib__op_attr
Definition internal.h:42
@ cib__op_attr_none
No special attributes.
Definition internal.h:43
@ cib__op_attr_transaction
Supported in a transaction.
Definition internal.h:49
@ cib__op_attr_privileged
Requires privileges.
Definition internal.h:45
@ cib__op_attr_local
Must only be processed locally.
Definition internal.h:46
@ cib__op_attr_replaces
Replaces CIB.
Definition internal.h:47
@ cib__op_attr_modifies
Modifies CIB.
Definition internal.h:44
@ cib__op_attr_writes_through
Writes to disk on success.
Definition internal.h:48
int cib_file_write_with_digest(xmlNode *cib_root, const char *cib_dirname, const char *cib_filename)
Definition cib_file.c:916
int cib_process_create(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:602
int cib__signon_attempts(cib_t *cib, const char *name, enum cib_conn_type type, int attempts)
Definition cib_utils.c:1019
bool cib__config_changed_v1(xmlNode *last, xmlNode *next, xmlNode **diff)
Definition cib_ops.c:692
int cib__get_node_attrs(pcmk__output_t *out, cib_t *cib, const char *section, const char *node_uuid, const char *set_type, const char *set_name, const char *attr_id, const char *attr_name, const char *user_name, xmlNode **result)
Definition cib_attrs.c:345
int cib__signon_query(pcmk__output_t *out, cib_t **cib, xmlNode **cib_object)
Definition cib_utils.c:965
struct cib_notify_client_s cib_notify_client_t
int cib__create_op(cib_t *cib, const char *op, const char *host, const char *section, xmlNode *data, int call_options, const char *user_name, const char *client_name, xmlNode **op_msg)
Definition cib_utils.c:660
int cib_process_bump(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:289
int cib_process_replace(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:304
int cib__update_node_attr(pcmk__output_t *out, cib_t *cib, int call_options, const char *section, const char *node_uuid, const char *set_type, const char *set_name, const char *attr_id, const char *attr_name, const char *attr_value, const char *user_name, const char *node_type)
Definition cib_attrs.c:164
void cib__set_output(cib_t *cib, pcmk__output_t *out)
Definition cib_remote.c:643
int cib_internal_op(cib_t *cib, const char *op, const char *host, const char *section, xmlNode *data, xmlNode **output_data, int call_options, const char *user_name)
Definition cib_utils.c:883
gboolean cib_diff_version_details(xmlNode *diff, int *admin_epoch, int *epoch, int *updates, int *_admin_epoch, int *_epoch, int *_updates)
Definition cib_utils.c:46
int cib_perform_op(cib_t *cib, const char *op, int call_options, cib__op_fn_t fn, bool is_query, const char *section, xmlNode *req, xmlNode *input, bool manage_counters, bool *config_changed, xmlNode **current_cib, xmlNode **result_cib, xmlNode **diff, xmlNode **output)
Definition cib_utils.c:332
int cib_process_diff(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:669
int cib_process_upgrade(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:260
cib_callback_client_t * cib__lookup_id(int call_id)
Definition cib_client.c:838
int cib__delete_node_attr(pcmk__output_t *out, cib_t *cib, int options, const char *section, const char *node_uuid, const char *set_type, const char *set_name, const char *attr_id, const char *attr_name, const char *attr_value, const char *user_name)
Definition cib_attrs.c:371
int(* cib__op_fn_t)(const char *, int, const char *, xmlNode *, xmlNode *, xmlNode *, xmlNode **, xmlNode **)
Definition internal.h:85
struct cib__operation_s cib__operation_t
int cib_process_erase(const char *op, int options, const char *section, xmlNode *req, xmlNode *input, xmlNode *existing_cib, xmlNode **result_cib, xmlNode **answer)
Definition cib_ops.c:241
cib__op_type
Definition internal.h:57
@ cib__op_create
Definition internal.h:62
@ cib__op_is_primary
Definition internal.h:65
@ cib__op_primary
Definition internal.h:69
@ cib__op_sync_all
Definition internal.h:74
@ cib__op_delete
Definition internal.h:63
@ cib__op_commit_transact
Definition internal.h:61
@ cib__op_apply_patch
Definition internal.h:59
@ cib__op_schemas
Definition internal.h:77
@ cib__op_bump
Definition internal.h:60
@ cib__op_erase
Definition internal.h:64
@ cib__op_abs_delete
Definition internal.h:58
@ cib__op_shutdown
Definition internal.h:73
@ cib__op_replace
Definition internal.h:71
@ cib__op_sync_one
Definition internal.h:75
@ cib__op_upgrade
Definition internal.h:76
@ cib__op_query
Definition internal.h:70
@ cib__op_noop
Definition internal.h:67
@ cib__op_modify
Definition internal.h:66
@ cib__op_ping
Definition internal.h:68
@ cib__op_secondary
Definition internal.h:72
gboolean cib_read_config(GHashTable *options, xmlNode *current_cib)
Definition cib_utils.c:855
bool cib__element_in_patchset(const xmlNode *patchset, const char *element)
Definition cib_utils.c:199
int cib_file_read_and_verify(const char *filename, const char *sigfile, xmlNode **root)
Definition cib_file.c:744
void cib_native_notify(gpointer data, gpointer user_data)
Definition cib_utils.c:823
const char * name
Definition cib.c:26
Cluster Configuration.
cib_conn_type
Definition cib_types.h:50
bool crm_is_daemon_name(const char *name)
Check whether string represents a client name used by cluster daemons.
pcmk__cpg_host_t host
Definition cpg.c:4
enum crm_ais_msg_types type
Definition cpg.c:3
char data[0]
Definition cpg.c:10
xmlNode * input
node_type
Definition nodes.h:38
Formatted output for pacemaker tools.
pcmk__action_result_t result
Definition pcmk_fence.c:35
bool pcmk__str_any_of(const char *s,...) G_GNUC_NULL_TERMINATED
Definition strings.c:1050
const char * name
Definition internal.h:89
uint32_t flags
Group of enum cib__op_attr flags.
Definition internal.h:91
enum cib__op_type type
Definition internal.h:90
const char * id
Definition internal.h:104
void(* callback)(xmlNode *, int, int, xmlNode *, void *)
Definition internal.h:103
void(* free_func)(void *)
Definition internal.h:108
struct timer_rec_s * timer
Definition internal.h:107
const char * obj_type
Definition internal.h:97
const char * obj_id
Definition internal.h:96
const char * event
Definition internal.h:95
void(* callback)(const char *event, xmlNode *msg)
Definition internal.h:98
This structure contains everything that makes up a single output formatter.
cib_t * cib
Definition internal.h:115
guint ref
Definition internal.h:114