pacemaker  2.1.0-7c3f660
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2020 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 
39 static inline uint32_t
40 crm_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 
60 static inline const char *
61 pcmk__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 char *pcmk__corosync_cluster_name(void);
99 bool pcmk__corosync_add_nodes(xmlNode *xml_parent);
100 # endif
101 
102 crm_node_t *crm_update_peer_proc(const char *source, crm_node_t * peer,
103  uint32_t flag, const char *status);
104 crm_node_t *pcmk__update_peer_state(const char *source, crm_node_t *node,
105  const char *state, uint64_t membership);
106 
107 void pcmk__update_peer_expected(const char *source, crm_node_t *node,
108  const char *expected);
109 void pcmk__reap_unseen_nodes(uint64_t ring_id);
110 
111 void pcmk__corosync_quorum_connect(gboolean (*dispatch)(unsigned long long,
112  gboolean),
113  void (*destroy) (gpointer));
114 crm_node_t *pcmk__search_node_caches(unsigned int id, const char *uname,
115  uint32_t flags);
116 crm_node_t *pcmk__search_cluster_node_cache(unsigned int id, const char *uname);
117 
118 void pcmk__refresh_node_caches_from_cib(xmlNode *cib);
119 crm_node_t *pcmk__search_known_node_cache(unsigned int id, const char *uname,
120  uint32_t flags);
121 
122 #endif
void pcmk__reap_unseen_nodes(uint64_t ring_id)
Definition: membership.c:1092
bool pcmk__corosync_add_nodes(xmlNode *xml_parent)
Definition: corosync.c:543
crm_node_t * pcmk__search_known_node_cache(unsigned int id, const char *uname, uint32_t flags)
Definition: membership.c:1265
char * pcmk__corosync_cluster_name(void)
Definition: corosync.c:655
crm_node_t * pcmk__update_peer_state(const char *source, crm_node_t *node, const char *state, uint64_t membership)
Update a node&#39;s state and membership information.
Definition: membership.c:1079
crm_node_t * pcmk__search_cluster_node_cache(unsigned int id, const char *uname)
Definition: membership.c:562
crm_node_t * crm_update_peer_proc(const char *source, crm_node_t *peer, uint32_t flag, const char *status)
Definition: membership.c:876
void pcmk__update_peer_expected(const char *source, crm_node_t *node, const char *expected)
Definition: membership.c:963
crm_node_t * pcmk__search_node_caches(unsigned int id, const char *uname, uint32_t flags)
Definition: membership.c:506
void pcmk__corosync_quorum_connect(gboolean(*dispatch)(unsigned long long, gboolean), void(*destroy)(gpointer))
Definition: corosync.c:345
char uname[MAX_NAME]
Definition: cpg.c:50
crm_proc_flag
Definition: internal.h:17
uint64_t flags
Definition: remote.c:149
enum cluster_type_e get_cluster_type(void)
Get (and validate) the local cluster type.
Definition: cluster.c:311
void pcmk__refresh_node_caches_from_cib(xmlNode *cib)
Definition: membership.c:1248