root/include/crm/cluster/internal.h

/* [previous][next][first][last][top][bottom][index][help] */

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. crm_get_cluster_proc
  2. pcmk__cs_err_str

   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* */
  17 enum crm_proc_flag {
  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 
  33 /*!
  34  * \internal
  35  * \brief Return the process bit corresponding to the current cluster stack
  36  *
  37  * \return Process flag if detectable, otherwise 0
  38  */
  39 static inline uint32_t
  40 crm_get_cluster_proc(void)
     /* [previous][next][first][last][top][bottom][index][help] */
  41 {
  42     switch (get_cluster_type()) {
  43         case pcmk_cluster_corosync:
  44             return crm_proc_cpg;
  45 
  46         default:
  47             break;
  48     }
  49     return crm_proc_none;
  50 }
  51 
  52 /*!
  53  * \internal
  54  * \brief Get log-friendly string description of a Corosync return code
  55  *
  56  * \param[in] error  Corosync return code
  57  *
  58  * \return Log-friendly string description corresponding to \p error
  59  */
  60 static inline const char *
  61 pcmk__cs_err_str(int error)
     /* [previous][next][first][last][top][bottom][index][help] */
  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 
 109 char *pcmk__corosync_cluster_name(void);
 110 bool pcmk__corosync_add_nodes(xmlNode *xml_parent);
 111 #  endif
 112 
 113 crm_node_t *crm_update_peer_proc(const char *source, crm_node_t * peer,
 114                                  uint32_t flag, const char *status);
 115 crm_node_t *pcmk__update_peer_state(const char *source, crm_node_t *node,
 116                                     const char *state, uint64_t membership);
 117 
 118 void pcmk__update_peer_expected(const char *source, crm_node_t *node,
 119                                 const char *expected);
 120 void pcmk__reap_unseen_nodes(uint64_t ring_id);
 121 
 122 void pcmk__corosync_quorum_connect(gboolean (*dispatch)(unsigned long long,
 123                                                         gboolean),
 124                                    void (*destroy) (gpointer));
 125 crm_node_t *pcmk__search_node_caches(unsigned int id, const char *uname,
 126                                      uint32_t flags);
 127 crm_node_t *pcmk__search_cluster_node_cache(unsigned int id, const char *uname);
 128 
 129 void pcmk__refresh_node_caches_from_cib(xmlNode *cib);
 130 crm_node_t *pcmk__search_known_node_cache(unsigned int id, const char *uname,
 131                                           uint32_t flags);
 132 
 133 #endif

/* [previous][next][first][last][top][bottom][index][help] */