Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-15-SP7:Update
pacemaker.29789
bsc#1198767-0005-Refactor-libcrmcluster-interna...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File bsc#1198767-0005-Refactor-libcrmcluster-internal-functions-for-gettin.patch of Package pacemaker.29789
From 9938a467e2de5a37b26affcea9ca9cf1344ce887 Mon Sep 17 00:00:00 2001 From: "Gao,Yan" <ygao@suse.com> Date: Sat, 27 May 2023 09:36:32 +0200 Subject: [PATCH 5/6] Refactor: libcrmcluster: internal functions for getting a node cache entry by uuid instead of id ... for future use --- include/crm/cluster/internal.h | 5 ++++ lib/cluster/membership.c | 49 +++++++++++++++++++++++++++++----- 2 files changed, 48 insertions(+), 6 deletions(-) Index: pacemaker-2.0.5+20201202.ba59be712/include/crm/cluster/internal.h =================================================================== --- pacemaker-2.0.5+20201202.ba59be712.orig/include/crm/cluster/internal.h +++ pacemaker-2.0.5+20201202.ba59be712/include/crm/cluster/internal.h @@ -362,4 +362,9 @@ crm_node_t * crm_find_peer(unsigned int void crm_peer_caches_refresh(xmlNode *cib); crm_node_t *crm_find_known_peer_full(unsigned int id, const char *uname, int 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); + #endif Index: pacemaker-2.0.5+20201202.ba59be712/lib/cluster/membership.c =================================================================== --- pacemaker-2.0.5+20201202.ba59be712.orig/lib/cluster/membership.c +++ pacemaker-2.0.5+20201202.ba59be712/lib/cluster/membership.c @@ -500,7 +500,8 @@ crm_find_peer_full(unsigned int id, cons } crm_node_t * -crm_get_peer_full(unsigned int id, const char *uname, int flags) +pcmk__get_peer_full(unsigned int id, const char *uname, const char *uuid, + int flags) { crm_node_t *node = NULL; @@ -513,11 +514,26 @@ crm_get_peer_full(unsigned int id, const } if (node == NULL && (flags & CRM_GET_PEER_CLUSTER)) { - node = crm_get_peer(id, uname); + node = pcmk__get_peer(id, uname, uuid); } return node; } +/*! + * \brief Get a node cache entry (cluster or Pacemaker Remote) + * + * \param[in] id If not 0, cluster node ID to search for + * \param[in] uname If not NULL, node name to search for + * \param[in] flags Bitmask of enum crm_get_peer_flags + * + * \return (Possibly newly created) node cache entry + */ +crm_node_t * +crm_get_peer_full(unsigned int id, const char *uname, int flags) +{ + return pcmk__get_peer_full(id, uname, NULL, flags); +} + crm_node_t * crm_find_peer(unsigned int id, const char *uname, const char *uuid) { @@ -661,7 +677,7 @@ crm_remove_conflicting_peer(crm_node_t * /* coverity[-alloc] Memory is referenced in one or both hashtables */ crm_node_t * -crm_get_peer(unsigned int id, const char *uname) +pcmk__get_peer(unsigned int id, const char *uname, const char *uuid) { crm_node_t *node = NULL; char *uname_lookup = NULL; @@ -670,7 +686,7 @@ crm_get_peer(unsigned int id, const char crm_peer_init(); - node = crm_find_peer(id, uname, NULL); + node = crm_find_peer(id, uname, uuid); /* if uname wasn't provided, and find_peer did not turn up a uname based on id. * we need to do a lookup of the node name using the id in the cluster membership. */ @@ -684,7 +700,7 @@ crm_get_peer(unsigned int id, const char /* try to turn up the node one more time now that we know the uname. */ if (node == NULL) { - node = crm_find_peer(id, uname, NULL); + node = crm_find_peer(id, uname, uuid); } } @@ -713,7 +729,9 @@ crm_get_peer(unsigned int id, const char } if(node->uuid == NULL) { - const char *uuid = crm_peer_uuid(node); + if (uuid == NULL) { + uuid = crm_peer_uuid(node); + } if (uuid) { crm_info("Node %u has uuid %s", id, uuid); @@ -729,6 +747,21 @@ crm_get_peer(unsigned int id, const char } /*! + * \brief Get a cluster node cache entry + * + * \param[in] id If not 0, cluster node ID to search for + * \param[in] uname If not NULL, node name to search for + * + * \return (Possibly newly created) cluster node cache entry + */ +/* coverity[-alloc] Memory is referenced in one or both hashtables */ +crm_node_t * +crm_get_peer(unsigned int id, const char *uname) +{ + return pcmk__get_peer(id, uname, NULL); +} + +/*! * \internal * \brief Update a node's uname *
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor