pacemaker 2.1.5-a3f44794f94
Scalable High-Availability cluster resource manager
internal.h
Go to the documentation of this file.
1/*
2 * Copyright 2004-2021 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 CRM_CLUSTER_INTERNAL__H
11# define CRM_CLUSTER_INTERNAL__H
12
13# include <stdint.h> // uint32_t, uint64_t
14# include <crm/cluster.h>
15
16/* *INDENT-OFF* */
18 crm_proc_none = 0x00000001,
19
20 // Cluster layers
21 crm_proc_cpg = 0x04000000,
22
23 // Daemons
24 crm_proc_execd = 0x00000010,
25 crm_proc_based = 0x00000100,
26 crm_proc_controld = 0x00000200,
27 crm_proc_attrd = 0x00001000,
28 crm_proc_schedulerd = 0x00010000,
29 crm_proc_fenced = 0x00100000,
30};
31/* *INDENT-ON* */
32
39static inline uint32_t
40crm_get_cluster_proc(void)
41{
42 switch (get_cluster_type()) {
44 return crm_proc_cpg;
45
46 default:
47 break;
48 }
49 return crm_proc_none;
50}
51
60static inline const char *
61pcmk__cs_err_str(int error)
62{
63# if SUPPORT_COROSYNC
64 switch (error) {
65 case CS_OK: return "OK";
66 case CS_ERR_LIBRARY: return "Library error";
67 case CS_ERR_VERSION: return "Version error";
68 case CS_ERR_INIT: return "Initialization error";
69 case CS_ERR_TIMEOUT: return "Timeout";
70 case CS_ERR_TRY_AGAIN: return "Try again";
71 case CS_ERR_INVALID_PARAM: return "Invalid parameter";
72 case CS_ERR_NO_MEMORY: return "No memory";
73 case CS_ERR_BAD_HANDLE: return "Bad handle";
74 case CS_ERR_BUSY: return "Busy";
75 case CS_ERR_ACCESS: return "Access error";
76 case CS_ERR_NOT_EXIST: return "Doesn't exist";
77 case CS_ERR_NAME_TOO_LONG: return "Name too long";
78 case CS_ERR_EXIST: return "Exists";
79 case CS_ERR_NO_SPACE: return "No space";
80 case CS_ERR_INTERRUPT: return "Interrupt";
81 case CS_ERR_NAME_NOT_FOUND: return "Name not found";
82 case CS_ERR_NO_RESOURCES: return "No resources";
83 case CS_ERR_NOT_SUPPORTED: return "Not supported";
84 case CS_ERR_BAD_OPERATION: return "Bad operation";
85 case CS_ERR_FAILED_OPERATION: return "Failed operation";
86 case CS_ERR_MESSAGE_ERROR: return "Message error";
87 case CS_ERR_QUEUE_FULL: return "Queue full";
88 case CS_ERR_QUEUE_NOT_AVAILABLE: return "Queue not available";
89 case CS_ERR_BAD_FLAGS: return "Bad flags";
90 case CS_ERR_TOO_BIG: return "Too big";
91 case CS_ERR_NO_SECTIONS: return "No sections";
92 }
93# endif
94 return "Corosync error";
95}
96
97# if SUPPORT_COROSYNC
98
99#if 0
100/* This is the new way to do it, but we still support all Corosync 2 versions,
101 * and this isn't always available. A better alternative here would be to check
102 * for support in the configure script and enable this conditionally.
103 */
104#define pcmk__init_cmap(handle) cmap_initialize_map((handle), CMAP_MAP_ICMAP)
105#else
106#define pcmk__init_cmap(handle) cmap_initialize(handle)
107#endif
108
110bool pcmk__corosync_add_nodes(xmlNode *xml_parent);
111# endif
112
113crm_node_t *crm_update_peer_proc(const char *source, crm_node_t * peer,
114 uint32_t flag, const char *status);
115crm_node_t *pcmk__update_peer_state(const char *source, crm_node_t *node,
116 const char *state, uint64_t membership);
117
118void pcmk__update_peer_expected(const char *source, crm_node_t *node,
119 const char *expected);
120void pcmk__reap_unseen_nodes(uint64_t ring_id);
121
122void pcmk__corosync_quorum_connect(gboolean (*dispatch)(unsigned long long,
123 gboolean),
124 void (*destroy) (gpointer));
125crm_node_t *pcmk__search_node_caches(unsigned int id, const char *uname,
126 uint32_t flags);
127crm_node_t *pcmk__search_cluster_node_cache(unsigned int id, const char *uname);
128
129void pcmk__refresh_node_caches_from_cib(xmlNode *cib);
130crm_node_t *pcmk__search_known_node_cache(unsigned int id, const char *uname,
131 uint32_t flags);
132
133#endif
void pcmk__update_peer_expected(const char *source, crm_node_t *node, const char *expected)
Definition: membership.c:959
crm_node_t * pcmk__search_known_node_cache(unsigned int id, const char *uname, uint32_t flags)
Definition: membership.c:1257
crm_node_t * crm_update_peer_proc(const char *source, crm_node_t *peer, uint32_t flag, const char *status)
Definition: membership.c:872
crm_node_t * pcmk__search_cluster_node_cache(unsigned int id, const char *uname)
Definition: membership.c:560
crm_node_t * pcmk__search_node_caches(unsigned int id, const char *uname, uint32_t flags)
Definition: membership.c:504
crm_proc_flag
Definition: internal.h:17
@ crm_proc_attrd
Definition: internal.h:27
@ crm_proc_schedulerd
Definition: internal.h:28
@ crm_proc_controld
Definition: internal.h:26
@ crm_proc_cpg
Definition: internal.h:21
@ crm_proc_based
Definition: internal.h:25
@ crm_proc_execd
Definition: internal.h:24
@ crm_proc_none
Definition: internal.h:18
@ crm_proc_fenced
Definition: internal.h:29
void pcmk__refresh_node_caches_from_cib(xmlNode *cib)
Definition: membership.c:1240
void pcmk__corosync_quorum_connect(gboolean(*dispatch)(unsigned long long, gboolean), void(*destroy)(gpointer))
Definition: corosync.c:341
crm_node_t * pcmk__update_peer_state(const char *source, crm_node_t *node, const char *state, uint64_t membership)
Update a node's state and membership information.
Definition: membership.c:1075
void pcmk__reap_unseen_nodes(uint64_t ring_id)
Definition: membership.c:1088
enum cluster_type_e get_cluster_type(void)
Get (and validate) the local cluster type.
Definition: cluster.c:311
@ pcmk_cluster_corosync
Definition: cluster.h:181
uint64_t flags
Definition: remote.c:3
char * pcmk__corosync_cluster_name(void)
Definition: corosync.c:671
bool pcmk__corosync_add_nodes(xmlNode *xml_parent)
Definition: corosync.c:559
char uname[MAX_NAME]
Definition: cpg.c:5