root/include/crm/common/nodes.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2004-2023 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 PCMK__CRM_COMMON_NODES__H
  11 #  define PCMK__CRM_COMMON_NODES__H
  12 
  13 #include <glib.h>                       // gboolean, GList, GHashTable
  14 
  15 #include <crm/common/scheduler_types.h> // pcmk_resource_t, pcmk_scheduler_t
  16 
  17 #ifdef __cplusplus
  18 extern "C" {
  19 #endif
  20 
  21 /*!
  22  * \file
  23  * \brief Scheduler API for nodes
  24  * \ingroup core
  25  */
  26 
  27 // Special node attributes
  28 
  29 #define PCMK_NODE_ATTR_TERMINATE    "terminate"
  30 
  31 
  32 //! Possible node types
  33 enum node_type {
  34     pcmk_node_variant_cluster  = 1,     //!< Cluster layer node
  35     pcmk_node_variant_remote   = 2,     //!< Pacemaker Remote node
  36 
  37     node_ping   = 0,      //!< \deprecated Do not use
  38 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
  39     //! \deprecated Use pcmk_node_variant_cluster instead
  40     node_member = pcmk_node_variant_cluster,
  41 
  42     //! \deprecated Use pcmk_node_variant_remote instead
  43     node_remote = pcmk_node_variant_remote,
  44 #endif
  45 };
  46 
  47 //! When to probe a resource on a node (as specified in location constraints)
  48 enum pe_discover_e {
  49     pcmk_probe_always       = 0,    //! Always probe resource on node
  50     pcmk_probe_never        = 1,    //! Never probe resource on node
  51     pcmk_probe_exclusive    = 2,    //! Probe only on designated nodes
  52 
  53 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
  54     //! \deprecated Use pcmk_probe_always instead
  55     pe_discover_always      = pcmk_probe_always,
  56 
  57     //! \deprecated Use pcmk_probe_never instead
  58     pe_discover_never       = pcmk_probe_never,
  59 
  60     //! \deprecated Use pcmk_probe_exclusive instead
  61     pe_discover_exclusive   = pcmk_probe_exclusive,
  62 #endif
  63 };
  64 
  65 //! Basic node information (all node objects for the same node share this)
  66 struct pe_node_shared_s {
  67     const char *id;             //!< Node ID at the cluster layer
  68     const char *uname;          //!< Node name in cluster
  69     enum node_type type;        //!< Node variant
  70 
  71     // @TODO Convert these into a flag group
  72     gboolean online;            //!< Whether online
  73     gboolean standby;           //!< Whether in standby mode
  74     gboolean standby_onfail;    //!< Whether in standby mode due to on-fail
  75     gboolean pending;           //!< Whether controller membership is pending
  76     gboolean unclean;           //!< Whether node requires fencing
  77     gboolean unseen;            //!< Whether node has never joined cluster
  78     gboolean shutdown;          //!< Whether shutting down
  79     gboolean expected_up;       //!< Whether expected join state is member
  80     gboolean is_dc;             //!< Whether node is cluster's DC
  81     gboolean maintenance;       //!< Whether in maintenance mode
  82     gboolean rsc_discovery_enabled; //!< Whether probes are allowed on node
  83 
  84     /*!
  85      * Whether this is a guest node whose guest resource must be recovered or a
  86      * remote node that must be fenced
  87      */
  88     gboolean remote_requires_reset;
  89 
  90     /*!
  91      * Whether this is a Pacemaker Remote node that was fenced since it was last
  92      * connected by the cluster
  93      */
  94     gboolean remote_was_fenced;
  95 
  96     /*!
  97      * Whether this is a Pacemaker Remote node previously marked in its
  98      * node state as being in maintenance mode
  99      */
 100     gboolean remote_maintenance;
 101 
 102     gboolean unpacked;              //!< Whether node history has been unpacked
 103 
 104     /*!
 105      * Number of resources active on this node (valid after CIB status section
 106      * has been unpacked, as long as pcmk_sched_no_counts was not set)
 107      */
 108     int num_resources;
 109 
 110     //! Remote connection resource for node, if it is a Pacemaker Remote node
 111     pcmk_resource_t *remote_rsc;
 112 
 113     GList *running_rsc;             //!< List of resources active on node
 114     GList *allocated_rsc;           //!< List of resources assigned to node
 115     GHashTable *attrs;              //!< Node attributes
 116     GHashTable *utilization;        //!< Node utilization attributes
 117     GHashTable *digest_cache;       //!< Cache of calculated resource digests
 118 
 119     /*!
 120      * Sum of priorities of all resources active on node and on any guest nodes
 121      * connected to this node, with +1 for promoted instances (used to compare
 122      * nodes for priority-fencing-delay)
 123      */
 124     int priority;
 125 
 126     pcmk_scheduler_t *data_set;     //!< Cluster that node is part of
 127 };
 128 
 129 //! Implementation of pcmk_node_t
 130 struct pe_node_s {
 131     int weight;         //!< Node score for a given resource
 132     gboolean fixed;     //!< \deprecated Do not use
 133     int count;          //!< Counter reused by assignment and promotion code
 134     struct pe_node_shared_s *details;   //!< Basic node information
 135 
 136     // @COMPAT This should be enum pe_discover_e
 137     int rsc_discover_mode;              //!< Probe mode (enum pe_discover_e)
 138 };
 139 
 140 #ifdef __cplusplus
 141 }
 142 #endif
 143 
 144 #endif // PCMK__CRM_COMMON_NODES__H

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