summaryrefslogtreecommitdiffstats
path: root/include/crm/cluster
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:29 +0000
commitb41961d74fe7ff2d4d4abaca92454e87c561e49f (patch)
treeb34e3826a7b649dafdbd05081140c990c96d736d /include/crm/cluster
parentReleasing progress-linux version 2.1.7-1~progress7.99u1. (diff)
downloadpacemaker-b41961d74fe7ff2d4d4abaca92454e87c561e49f.tar.xz
pacemaker-b41961d74fe7ff2d4d4abaca92454e87c561e49f.zip
Merging upstream version 2.1.8~rc1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/crm/cluster')
-rw-r--r--include/crm/cluster/compat.h159
-rw-r--r--include/crm/cluster/internal.h104
2 files changed, 236 insertions, 27 deletions
diff --git a/include/crm/cluster/compat.h b/include/crm/cluster/compat.h
index 89a03fd..6802edf 100644
--- a/include/crm/cluster/compat.h
+++ b/include/crm/cluster/compat.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2023 the Pacemaker project contributors
+ * Copyright 2004-2024 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -10,7 +10,16 @@
#ifndef PCMK__CRM_CLUSTER_COMPAT__H
# define PCMK__CRM_CLUSTER_COMPAT__H
+#include <stdint.h> // uint32_t
+#include <sys/types.h> // size_t
+
+#include <glib.h> // gboolean, guint
#include <libxml/tree.h> // xmlNode
+
+#if SUPPORT_COROSYNC
+#include <corosync/cpg.h> // cpg_handle_t
+#endif // SUPPORT_COROSYNC
+
#include <crm/cluster.h> // crm_node_t
#ifdef __cplusplus
@@ -26,16 +35,158 @@ extern "C" {
* release.
*/
-// \deprecated Use stonith_api_kick() from libstonithd instead
+//! \deprecated Do not use
+enum crm_get_peer_flags {
+ CRM_GET_PEER_CLUSTER = 0x0001,
+ CRM_GET_PEER_REMOTE = 0x0002,
+ CRM_GET_PEER_ANY = CRM_GET_PEER_CLUSTER|CRM_GET_PEER_REMOTE,
+};
+
+// NOTE: sbd (as of at least 1.5.2) uses this
+//! \deprecated Use \c pcmk_cluster_t instead
+typedef pcmk_cluster_t crm_cluster_t;
+
+//! \deprecated Do not use Pacemaker for cluster node cacheing
+crm_node_t *crm_get_peer(unsigned int id, const char *uname);
+
+//! \deprecated Do not use Pacemaker for cluster node cacheing
+crm_node_t *crm_get_peer_full(unsigned int id, const char *uname, int flags);
+
+//! \deprecated Use stonith_api_kick() from libstonithd instead
int crm_terminate_member(int nodeid, const char *uname, void *unused);
-// \deprecated Use stonith_api_kick() from libstonithd instead
+//! \deprecated Use \c stonith_api_kick() from libstonithd instead
int crm_terminate_member_no_mainloop(int nodeid, const char *uname,
int *connection);
-// \deprecated Use crm_xml_add(xml, attr, crm_peer_uuid(node)) instead
+/*!
+ * \deprecated Use
+ * <tt>crm_xml_add(xml, attr, pcmk__cluster_node_uuid(node))</tt>
+ * instead
+ */
void set_uuid(xmlNode *xml, const char *attr, crm_node_t *node);
+#if SUPPORT_COROSYNC
+
+//! \deprecated Do not use
+gboolean cluster_connect_cpg(pcmk_cluster_t *cluster);
+
+//! \deprecated Do not use
+void cluster_disconnect_cpg(pcmk_cluster_t *cluster);
+
+//! \deprecated Do not use
+uint32_t get_local_nodeid(cpg_handle_t handle);
+
+//! \deprecated Do not use
+void pcmk_cpg_membership(cpg_handle_t handle,
+ const struct cpg_name *group_name,
+ const struct cpg_address *member_list,
+ size_t member_list_entries,
+ const struct cpg_address *left_list,
+ size_t left_list_entries,
+ const struct cpg_address *joined_list,
+ size_t joined_list_entries);
+
+//! \deprecated Do not use
+gboolean crm_is_corosync_peer_active(const crm_node_t * node);
+
+//! \deprecated Do not use
+gboolean send_cluster_text(enum crm_ais_msg_class msg_class, const char *data,
+ gboolean local, const crm_node_t *node,
+ enum crm_ais_msg_types dest);
+
+//! \deprecated Do not use
+char *pcmk_message_common_cs(cpg_handle_t handle, uint32_t nodeid, uint32_t pid,
+ void *msg, uint32_t *kind, const char **from);
+
+#endif // SUPPORT_COROSYNC
+
+// NOTE: sbd (as of at least 1.5.2) uses this
+//! \deprecated Use \c pcmk_cluster_connect() instead
+gboolean crm_cluster_connect(pcmk_cluster_t *cluster);
+
+//! \deprecated Use \c pcmk_cluster_disconnect() instead
+void crm_cluster_disconnect(pcmk_cluster_t *cluster);
+
+//! \deprecated Do not use
+int crm_remote_peer_cache_size(void);
+
+//! \deprecated Do not use
+void crm_remote_peer_cache_refresh(xmlNode *cib);
+
+//! \deprecated Do not use
+crm_node_t *crm_remote_peer_get(const char *node_name);
+
+//! \deprecated Do not use
+void crm_remote_peer_cache_remove(const char *node_name);
+
+//! \deprecated Do not use
+gboolean crm_is_peer_active(const crm_node_t *node);
+
+//! \deprecated Do not use
+guint crm_active_peers(void);
+
+//! \deprecated Do not use
+guint reap_crm_member(uint32_t id, const char *name);
+
+// NOTE: sbd (as of at least 1.5.2) uses this enum
+//!@{
+//! \deprecated Use <tt>enum pcmk_cluster_layer</tt> instead
+enum cluster_type_e {
+ // NOTE: sbd (as of at least 1.5.2) uses this value
+ pcmk_cluster_unknown = pcmk_cluster_layer_unknown,
+
+ pcmk_cluster_invalid = pcmk_cluster_layer_invalid,
+
+ // NOTE: sbd (as of at least 1.5.2) uses this value
+ pcmk_cluster_corosync = pcmk_cluster_layer_corosync,
+};
+//!@}
+
+// NOTE: sbd (as of at least 1.5.2) uses this
+//! \deprecated Use \c pcmk_cluster_layer_text() instead
+const char *name_for_cluster_type(enum cluster_type_e type);
+
+// NOTE: sbd (as of at least 1.5.2) uses this
+//! \deprecated Use \c pcmk_get_cluster_layer() instead
+enum cluster_type_e get_cluster_type(void);
+
+//! \deprecated Use \c pcmk_get_cluster_layer() instead
+gboolean is_corosync_cluster(void);
+
+//! \deprecated Do not use
+void crm_peer_init(void);
+
+//! \deprecated Do not use
+void crm_peer_destroy(void);
+
+//! \deprecated Do not use
+gboolean send_cluster_message(const crm_node_t *node,
+ enum crm_ais_msg_types service,
+ const xmlNode *data, gboolean ordered);
+
+//! \deprecated Do not use
+const char *crm_peer_uuid(crm_node_t *node);
+
+//! \deprecated Do not use
+enum crm_ais_msg_types text2msg_type(const char *text);
+
+//! \deprecated Do not use
+char *get_node_name(uint32_t nodeid);
+
+//! \deprecated Do not use
+const char *get_local_node_name(void);
+
+//! \deprecated Do not use
+void crm_set_autoreap(gboolean enable);
+
+//! \deprecated Do not use
+void crm_set_status_callback(void (*dispatch)(enum crm_status_type,
+ crm_node_t *, const void *));
+
+//! \deprecated Do not use
+const char *crm_peer_uname(const char *uuid);
+
#ifdef __cplusplus
}
#endif
diff --git a/include/crm/cluster/internal.h b/include/crm/cluster/internal.h
index e20ee4c..fc24c77 100644
--- a/include/crm/cluster/internal.h
+++ b/include/crm/cluster/internal.h
@@ -1,5 +1,5 @@
/*
- * Copyright 2004-2021 the Pacemaker project contributors
+ * Copyright 2004-2024 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -7,28 +7,49 @@
* version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
*/
-#ifndef CRM_CLUSTER_INTERNAL__H
-# define CRM_CLUSTER_INTERNAL__H
+#ifndef PCMK__CRM_CLUSTER_INTERNAL__H
+# define PCMK__CRM_CLUSTER_INTERNAL__H
+# include <stdbool.h>
# include <stdint.h> // uint32_t, uint64_t
+
+# include <glib.h> // gboolean
+
# include <crm/cluster.h>
-/* *INDENT-OFF* */
enum crm_proc_flag {
+ /* @COMPAT When crm_node_t:processes is made internal, we can merge this
+ * into node flags or turn it into a boolean. Until then, in theory
+ * something could depend on these particular numeric values.
+ */
crm_proc_none = 0x00000001,
// Cluster layers
crm_proc_cpg = 0x04000000,
+};
+
+// Used with node cache search functions
+enum pcmk__node_search_flags {
+ //! Does not affect search
+ pcmk__node_search_none = 0,
+
+ //! Search for cluster nodes from membership cache
+ pcmk__node_search_cluster_member = (1 << 0),
- // Daemons
- crm_proc_execd = 0x00000010,
- crm_proc_based = 0x00000100,
- crm_proc_controld = 0x00000200,
- crm_proc_attrd = 0x00001000,
- crm_proc_schedulerd = 0x00010000,
- crm_proc_fenced = 0x00100000,
+ //! Search for remote nodes
+ pcmk__node_search_remote = (1 << 1),
+
+ //! Search for cluster member nodes and remote nodes
+ pcmk__node_search_any = pcmk__node_search_cluster_member
+ |pcmk__node_search_remote,
+
+ /* @COMPAT The values before this must stay the same until we can drop
+ * support for enum crm_get_peer_flags
+ */
+
+ //! Search for cluster nodes from CIB (as of last cache refresh)
+ pcmk__node_search_cluster_cib = (1 << 2),
};
-/* *INDENT-ON* */
/*!
* \internal
@@ -39,8 +60,8 @@ enum crm_proc_flag {
static inline uint32_t
crm_get_cluster_proc(void)
{
- switch (get_cluster_type()) {
- case pcmk_cluster_corosync:
+ switch (pcmk_get_cluster_layer()) {
+ case pcmk_cluster_layer_corosync:
return crm_proc_cpg;
default:
@@ -108,8 +129,27 @@ pcmk__cs_err_str(int error)
char *pcmk__corosync_cluster_name(void);
bool pcmk__corosync_add_nodes(xmlNode *xml_parent);
+
+void pcmk__cpg_confchg_cb(cpg_handle_t handle,
+ const struct cpg_name *group_name,
+ const struct cpg_address *member_list,
+ size_t member_list_entries,
+ const struct cpg_address *left_list,
+ size_t left_list_entries,
+ const struct cpg_address *joined_list,
+ size_t joined_list_entries);
+
+char *pcmk__cpg_message_data(cpg_handle_t handle, uint32_t sender_id,
+ uint32_t pid, void *content, uint32_t *kind,
+ const char **from);
+
# endif
+const char *pcmk__cluster_node_uuid(crm_node_t *node);
+char *pcmk__cluster_node_name(uint32_t nodeid);
+const char *pcmk__cluster_local_node_name(void);
+const char *pcmk__node_name_from_uuid(const char *uuid);
+
crm_node_t *crm_update_peer_proc(const char *source, crm_node_t * peer,
uint32_t flag, const char *status);
crm_node_t *pcmk__update_peer_state(const char *source, crm_node_t *node,
@@ -122,18 +162,36 @@ void pcmk__reap_unseen_nodes(uint64_t ring_id);
void pcmk__corosync_quorum_connect(gboolean (*dispatch)(unsigned long long,
gboolean),
void (*destroy) (gpointer));
+
+enum crm_ais_msg_types pcmk__cluster_parse_msg_type(const char *text);
+bool pcmk__cluster_send_message(const crm_node_t *node,
+ enum crm_ais_msg_types service,
+ const xmlNode *data);
+
+// Membership
+
+void pcmk__cluster_init_node_caches(void);
+void pcmk__cluster_destroy_node_caches(void);
+
+void pcmk__cluster_set_autoreap(bool enable);
+void pcmk__cluster_set_status_callback(void (*dispatch)(enum crm_status_type,
+ crm_node_t *,
+ const void *));
+
+bool pcmk__cluster_is_node_active(const crm_node_t *node);
+unsigned int pcmk__cluster_num_active_nodes(void);
+unsigned int pcmk__cluster_num_remote_nodes(void);
+
+crm_node_t *pcmk__cluster_lookup_remote_node(const char *node_name);
+void pcmk__cluster_forget_cluster_node(uint32_t id, const char *node_name);
+void pcmk__cluster_forget_remote_node(const char *node_name);
crm_node_t *pcmk__search_node_caches(unsigned int id, const char *uname,
uint32_t flags);
-crm_node_t *pcmk__search_cluster_node_cache(unsigned int id, const char *uname,
- const char *uuid);
+void pcmk__purge_node_from_cache(const char *node_name, uint32_t node_id);
void pcmk__refresh_node_caches_from_cib(xmlNode *cib);
-crm_node_t *pcmk__search_known_node_cache(unsigned int id, const char *uname,
- uint32_t flags);
-crm_node_t *pcmk__get_peer(unsigned int id, const char *uname,
- const char *uuid);
-crm_node_t *pcmk__get_peer_full(unsigned int id, const char *uname,
- const char *uuid, int flags);
+crm_node_t *pcmk__get_node(unsigned int id, const char *uname,
+ const char *uuid, uint32_t flags);
-#endif
+#endif // PCMK__CRM_CLUSTER_INTERNAL__H