root/include/crm/crm.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. crm_action_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__H
  11 #  define CRM__H
  12 
  13 #ifdef __cplusplus
  14 extern "C" {
  15 #endif
  16 
  17 /**
  18  * \file
  19  * \brief A dumping ground
  20  * \ingroup core
  21  */
  22 
  23 #  include <crm_config.h>
  24 #  include <stdlib.h>
  25 #  include <glib.h>
  26 #  include <stdbool.h>
  27 
  28 #  include <string.h>
  29 
  30 #  include <libxml/tree.h>
  31 
  32 #ifndef PCMK_ALLOW_DEPRECATED
  33 /*!
  34  * \brief Allow use of deprecated Pacemaker APIs
  35  *
  36  * By default, external code using Pacemaker headers is allowed to use
  37  * deprecated Pacemaker APIs. If PCMK_ALLOW_DEPRECATED is defined to 0 before
  38  * including any Pacemaker headers, deprecated APIs will be unusable. It is
  39  * strongly recommended to leave this unchanged for production and release
  40  * builds, to avoid breakage when users upgrade to new Pacemaker releases that
  41  * deprecate more APIs. This should be defined to 0 only for development and
  42  * testing builds when desiring to check for usage of currently deprecated APIs.
  43  */
  44 #define PCMK_ALLOW_DEPRECATED 1
  45 #endif
  46 
  47 /*!
  48  * The CRM feature set assists with compatibility in mixed-version clusters.
  49  * The major version number increases when nodes with different versions
  50  * would not work (rolling upgrades are not allowed). The minor version
  51  * number increases when mixed-version clusters are allowed only during
  52  * rolling upgrades (a node with the oldest feature set will be elected DC). The
  53  * minor-minor version number is ignored, but allows resource agents to detect
  54  * cluster support for various features.
  55  *
  56  * The feature set also affects the processing of old saved CIBs (such as for
  57  * many scheduler regression tests).
  58  *
  59  * Particular feature points currently tested by Pacemaker code:
  60  *
  61  * >2.1:     Operation updates include timing data
  62  * >=3.0.5:  XML v2 digests are created
  63  * >=3.0.8:  Peers do not need acks for cancellations
  64  * >=3.0.9:  DC will send its own shutdown request to all peers
  65  *           XML v2 patchsets are created by default
  66  * >=3.0.13: Fail counts include operation name and interval
  67  * >=3.2.0:  DC supports PCMK_LRM_OP_INVALID and PCMK_LRM_OP_NOT_CONNECTED
  68  */
  69 #  define CRM_FEATURE_SET               "3.10.0"
  70 
  71 /* Pacemaker's CPG protocols use fixed-width binary fields for the sender and
  72  * recipient of a CPG message. This imposes an arbitrary limit on cluster node
  73  * names.
  74  */
  75 //! \brief Maximum length of a Corosync cluster node name (in bytes)
  76 #define MAX_NAME        256
  77 
  78 #  define CRM_META                      "CRM_meta"
  79 
  80 extern char *crm_system_name;
  81 
  82 /* *INDENT-OFF* */
  83 
  84 // How we represent "infinite" scores
  85 #  define CRM_SCORE_INFINITY    1000000
  86 #  define CRM_INFINITY_S        "INFINITY"
  87 #  define CRM_PLUS_INFINITY_S   "+" CRM_INFINITY_S
  88 #  define CRM_MINUS_INFINITY_S  "-" CRM_INFINITY_S
  89 
  90 /* @COMPAT API < 2.0.0 Deprecated "infinity" aliases
  91  *
  92  * INFINITY might be defined elsewhere (e.g. math.h), so undefine it first.
  93  * This, of course, complicates any attempt to use the other definition in any
  94  * code that includes this header.
  95  */
  96 #  undef INFINITY
  97 #  define INFINITY_S        "INFINITY"
  98 #  define MINUS_INFINITY_S "-INFINITY"
  99 #  define INFINITY        1000000
 100 
 101 /* Sub-systems */
 102 #  define CRM_SYSTEM_DC         "dc"
 103 #  define CRM_SYSTEM_DCIB               "dcib"
 104                                         /*  The master CIB */
 105 #  define CRM_SYSTEM_CIB                "cib"
 106 #  define CRM_SYSTEM_CRMD               "crmd"
 107 #  define CRM_SYSTEM_LRMD               "lrmd"
 108 #  define CRM_SYSTEM_PENGINE    "pengine"
 109 #  define CRM_SYSTEM_TENGINE    "tengine"
 110 #  define CRM_SYSTEM_STONITHD   "stonithd"
 111 #  define CRM_SYSTEM_MCP        "pacemakerd"
 112 
 113 // Names of internally generated node attributes
 114 #  define CRM_ATTR_UNAME            "#uname"
 115 #  define CRM_ATTR_ID               "#id"
 116 #  define CRM_ATTR_KIND             "#kind"
 117 #  define CRM_ATTR_ROLE             "#role"
 118 #  define CRM_ATTR_IS_DC            "#is_dc"
 119 #  define CRM_ATTR_CLUSTER_NAME     "#cluster-name"
 120 #  define CRM_ATTR_SITE_NAME        "#site-name"
 121 #  define CRM_ATTR_UNFENCED         "#node-unfenced"
 122 #  define CRM_ATTR_DIGESTS_ALL      "#digests-all"
 123 #  define CRM_ATTR_DIGESTS_SECURE   "#digests-secure"
 124 #  define CRM_ATTR_RA_VERSION       "#ra-version"
 125 #  define CRM_ATTR_PROTOCOL         "#attrd-protocol"
 126 
 127 /* Valid operations */
 128 #  define CRM_OP_NOOP           "noop"
 129 #  define CRM_OP_JOIN_ANNOUNCE  "join_announce"
 130 #  define CRM_OP_JOIN_OFFER     "join_offer"
 131 #  define CRM_OP_JOIN_REQUEST   "join_request"
 132 #  define CRM_OP_JOIN_ACKNAK    "join_ack_nack"
 133 #  define CRM_OP_JOIN_CONFIRM   "join_confirm"
 134 #  define CRM_OP_PING           "ping"
 135 #  define CRM_OP_NODE_INFO  "node-info"
 136 #  define CRM_OP_THROTTLE       "throttle"
 137 #  define CRM_OP_VOTE           "vote"
 138 #  define CRM_OP_NOVOTE         "no-vote"
 139 #  define CRM_OP_HELLO          "hello"
 140 #  define CRM_OP_PECALC         "pe_calc"
 141 #  define CRM_OP_QUIT           "quit"
 142 #  define CRM_OP_LOCAL_SHUTDOWN         "start_shutdown"
 143 #  define CRM_OP_SHUTDOWN_REQ   "req_shutdown"
 144 #  define CRM_OP_SHUTDOWN       "do_shutdown"
 145 #  define CRM_OP_FENCE          "stonith"
 146 #  define CRM_OP_REGISTER               "register"
 147 #  define CRM_OP_IPC_FWD                "ipc_fwd"
 148 #  define CRM_OP_INVOKE_LRM     "lrm_invoke"
 149 #  define CRM_OP_LRM_REFRESH    "lrm_refresh" /* Deprecated */
 150 #  define CRM_OP_LRM_QUERY      "lrm_query"
 151 #  define CRM_OP_LRM_DELETE     "lrm_delete"
 152 #  define CRM_OP_LRM_FAIL               "lrm_fail"
 153 #  define CRM_OP_PROBED         "probe_complete"
 154 #  define CRM_OP_REPROBE                "probe_again"
 155 #  define CRM_OP_CLEAR_FAILCOUNT  "clear_failcount"
 156 #  define CRM_OP_REMOTE_STATE     "remote_state"
 157 #  define CRM_OP_RELAXED_SET  "one-or-more"
 158 #  define CRM_OP_RELAXED_CLONE  "clone-one-or-more"
 159 #  define CRM_OP_RM_NODE_CACHE "rm_node_cache"
 160 #  define CRM_OP_MAINTENANCE_NODES "maintenance_nodes"
 161 
 162 /* Possible cluster membership states */
 163 #  define CRMD_JOINSTATE_DOWN           "down"
 164 #  define CRMD_JOINSTATE_PENDING        "pending"
 165 #  define CRMD_JOINSTATE_MEMBER         "member"
 166 #  define CRMD_JOINSTATE_NACK           "banned"
 167 
 168 #  define CRMD_ACTION_DELETE            "delete"
 169 #  define CRMD_ACTION_CANCEL            "cancel"
 170 
 171 #  define CRMD_ACTION_RELOAD            "reload"
 172 #  define CRMD_ACTION_RELOAD_AGENT      "reload-agent"
 173 #  define CRMD_ACTION_MIGRATE           "migrate_to"
 174 #  define CRMD_ACTION_MIGRATED          "migrate_from"
 175 
 176 #  define CRMD_ACTION_START             "start"
 177 #  define CRMD_ACTION_STARTED           "running"
 178 
 179 #  define CRMD_ACTION_STOP              "stop"
 180 #  define CRMD_ACTION_STOPPED           "stopped"
 181 
 182 #  define CRMD_ACTION_PROMOTE           "promote"
 183 #  define CRMD_ACTION_PROMOTED          "promoted"
 184 #  define CRMD_ACTION_DEMOTE            "demote"
 185 #  define CRMD_ACTION_DEMOTED           "demoted"
 186 
 187 #  define CRMD_ACTION_NOTIFY            "notify"
 188 #  define CRMD_ACTION_NOTIFIED          "notified"
 189 
 190 #  define CRMD_ACTION_STATUS            "monitor"
 191 #  define CRMD_ACTION_METADATA          "meta-data"
 192 #  define CRMD_METADATA_CALL_TIMEOUT   30000
 193 
 194 /* short names */
 195 #  define RSC_DELETE    CRMD_ACTION_DELETE
 196 #  define RSC_CANCEL    CRMD_ACTION_CANCEL
 197 
 198 #  define RSC_MIGRATE   CRMD_ACTION_MIGRATE
 199 #  define RSC_MIGRATED  CRMD_ACTION_MIGRATED
 200 
 201 #  define RSC_START     CRMD_ACTION_START
 202 #  define RSC_STARTED   CRMD_ACTION_STARTED
 203 
 204 #  define RSC_STOP      CRMD_ACTION_STOP
 205 #  define RSC_STOPPED   CRMD_ACTION_STOPPED
 206 
 207 #  define RSC_PROMOTE   CRMD_ACTION_PROMOTE
 208 #  define RSC_PROMOTED  CRMD_ACTION_PROMOTED
 209 #  define RSC_DEMOTE    CRMD_ACTION_DEMOTE
 210 #  define RSC_DEMOTED   CRMD_ACTION_DEMOTED
 211 
 212 #  define RSC_NOTIFY    CRMD_ACTION_NOTIFY
 213 #  define RSC_NOTIFIED  CRMD_ACTION_NOTIFIED
 214 
 215 #  define RSC_STATUS    CRMD_ACTION_STATUS
 216 #  define RSC_METADATA  CRMD_ACTION_METADATA
 217 /* *INDENT-ON* */
 218 
 219 #  include <crm/common/logging.h>
 220 #  include <crm/common/util.h>
 221 
 222 static inline const char *
 223 crm_action_str(const char *task, guint interval_ms) {
     /* [previous][next][first][last][top][bottom][index][help] */
 224     if ((task != NULL) && (interval_ms == 0)
 225         && (strcasecmp(task, RSC_STATUS) == 0)) {
 226         return "probe";
 227     }
 228     return task;
 229 }
 230 
 231 #if !defined(PCMK_ALLOW_DEPRECATED) || (PCMK_ALLOW_DEPRECATED == 1)
 232 #include <crm/crm_compat.h>
 233 #endif
 234 
 235 #ifdef __cplusplus
 236 }
 237 #endif
 238 
 239 #endif

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