root/daemons/controld/controld_globals.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2022-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 CONTROLD_GLOBALS__H
  11 #  define CONTROLD_GLOBALS__H
  12 
  13 #include <crm_internal.h>       // pcmk__output_t, etc.
  14 
  15 #include <stdint.h>             // uint32_t, uint64_t
  16 #include <glib.h>               // GList, GMainLoop
  17 #include <crm/cib.h>            // cib_t
  18 #include <pacemaker-internal.h> // pcmk__graph_t
  19 #include <controld_fsa.h>       // enum crmd_fsa_state
  20 
  21 typedef struct {
  22     // Booleans
  23 
  24     //! Group of \p controld_flags values
  25     uint32_t flags;
  26 
  27 
  28     // Controller FSA
  29 
  30     //! FSA state
  31     enum crmd_fsa_state fsa_state;
  32 
  33     //! FSA actions (group of \p A_* flags)
  34     uint64_t fsa_actions;
  35 
  36     //! FSA input register contents (group of \p R_* flags)
  37     uint64_t fsa_input_register;
  38 
  39     //! FSA message queue
  40     GList *fsa_message_queue;
  41 
  42 
  43     // CIB
  44 
  45     //! Connection to the CIB
  46     cib_t *cib_conn;
  47 
  48     //! CIB connection's client ID
  49     const char *cib_client_id;
  50 
  51 
  52     // Scheduler
  53 
  54     //! Reference of the scheduler request being waited on
  55     char *fsa_pe_ref;
  56 
  57 
  58     // Transitioner
  59 
  60     //! Transitioner UUID
  61     char *te_uuid;
  62 
  63     //! Graph of transition currently being processed
  64     pcmk__graph_t *transition_graph;
  65 
  66 
  67     // Logging
  68 
  69     //! Output object for controller log messages
  70     pcmk__output_t *logger_out;
  71 
  72 
  73     // Other
  74 
  75     //! Cluster name
  76     char *cluster_name;
  77 
  78     //! Designated controller name
  79     char *dc_name;
  80 
  81     //! Designated controller's Pacemaker version
  82     char *dc_version;
  83 
  84     //! Local node's node name
  85     char *our_nodename;
  86 
  87     //! Local node's UUID
  88     char *our_uuid;
  89 
  90     //! Last saved cluster communication layer membership ID
  91     unsigned long long membership_id;
  92 
  93     //! Max lifetime (in seconds) of a resource's shutdown lock to a node
  94     guint shutdown_lock_limit;
  95 
  96     //! Main event loop
  97     GMainLoop *mainloop;
  98 } controld_globals_t;
  99 
 100 extern controld_globals_t controld_globals;
 101 
 102 /*!
 103  * \internal
 104  * \enum controld_flags
 105  * \brief Bit flags to store various controller state and configuration info
 106  */
 107 enum controld_flags {
 108     //! The DC left in a membership change that is being processed
 109     controld_dc_left                = (1 << 0),
 110 
 111     //! The FSA is stalled waiting for further input
 112     controld_fsa_is_stalled         = (1 << 1),
 113 
 114     //! The local node has been in a quorate partition at some point
 115     controld_ever_had_quorum        = (1 << 2),
 116 
 117     //! The local node is currently in a quorate partition
 118     controld_has_quorum             = (1 << 3),
 119 
 120     //! Panic the local node if it loses quorum
 121     controld_no_quorum_suicide      = (1 << 4),
 122 
 123     //! Lock resources to the local node when it shuts down cleanly
 124     controld_shutdown_lock_enabled  = (1 << 5),
 125 };
 126 
 127 #  define controld_set_global_flags(flags_to_set) do {                      \
 128         controld_globals.flags = pcmk__set_flags_as(__func__, __LINE__,     \
 129                                                     LOG_TRACE,              \
 130                                                     "Global", "controller", \
 131                                                     controld_globals.flags, \
 132                                                     (flags_to_set),         \
 133                                                     #flags_to_set);         \
 134     } while (0)
 135 
 136 #  define controld_clear_global_flags(flags_to_clear) do {                  \
 137         controld_globals.flags                                              \
 138             = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, "Global", \
 139                                    "controller", controld_globals.flags,    \
 140                                    (flags_to_clear), #flags_to_clear);      \
 141     } while (0)
 142 
 143 #endif  // ifndef CONTROLD_GLOBALS__H

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