root/include/pacemaker.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2019-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 PACEMAKER__H
  11 #  define PACEMAKER__H
  12 
  13 #ifdef __cplusplus
  14 extern "C" {
  15 #endif
  16 
  17 /**
  18  * \file
  19  * \brief High Level API
  20  * \ingroup pacemaker
  21  */
  22 
  23 #  include <glib.h>
  24 #  include <libxml/tree.h>
  25 #  include <crm/pengine/pe_types.h>
  26 
  27 #  include <crm/stonith-ng.h>
  28 
  29 /*!
  30  * \brief Get controller status
  31  *
  32  * \param[in,out] xml                The destination for the result, as an XML tree.
  33  * \param[in]     dest_node          Destination node for request
  34  * \param[in]     message_timeout_ms Message timeout
  35  *
  36  * \return Standard Pacemaker return code
  37  */
  38 int pcmk_controller_status(xmlNodePtr *xml, char *dest_node, unsigned int message_timeout_ms);
  39 
  40 /*!
  41  * \brief Get designated controller
  42  *
  43  * \param[in,out] xml                The destination for the result, as an XML tree.
  44  * \param[in]     message_timeout_ms Message timeout
  45  *
  46  * \return Standard Pacemaker return code
  47  */
  48 int pcmk_designated_controller(xmlNodePtr *xml, unsigned int message_timeout_ms);
  49 
  50 /*!
  51  * \brief Get pacemakerd status
  52  *
  53  * \param[in,out] xml                The destination for the result, as an XML tree.
  54  * \param[in]     ipc_name           IPC name for request
  55  * \param[in]     message_timeout_ms Message timeout
  56  *
  57  * \return Standard Pacemaker return code
  58  */
  59 int pcmk_pacemakerd_status(xmlNodePtr *xml, char *ipc_name, unsigned int message_timeout_ms);
  60 
  61 /*!
  62  * \brief Calculate and output resource operation digests
  63  *
  64  * \param[out] xml        Where to store XML with result
  65  * \param[in]  rsc        Resource to calculate digests for
  66  * \param[in]  node       Node whose operation history should be used
  67  * \param[in]  overrides  Hash table of configuration parameters to override
  68  * \param[in]  data_set   Cluster working set (with status)
  69  *
  70  * \return Standard Pacemaker return code
  71  */
  72 int pcmk_resource_digests(xmlNodePtr *xml, pe_resource_t *rsc,
  73                           pe_node_t *node, GHashTable *overrides,
  74                           pe_working_set_t *data_set);
  75 
  76 /*!
  77  * \brief Get nodes list
  78  *
  79  * \param[in,out] xml                The destination for the result, as an XML tree.
  80  * \param[in]     node_types         Node type(s) to return (default: all)
  81  *
  82  * \return Standard Pacemaker return code
  83  */
  84 int pcmk_list_nodes(xmlNodePtr *xml, char *node_types);
  85 
  86 #ifdef BUILD_PUBLIC_LIBPACEMAKER
  87 
  88 /*!
  89  * \brief Perform a STONITH action.
  90  *
  91  * \param[in] st        A connection to the STONITH API.
  92  * \param[in] target    The node receiving the action.
  93  * \param[in] action    The action to perform.
  94  * \param[in] name      Who requested the fence action?
  95  * \param[in] timeout   How long to wait for the operation to complete (in ms).
  96  * \param[in] tolerance If a successful action for \p target happened within
  97  *                      this many ms, return 0 without performing the action
  98  *                      again.
  99  * \param[in] delay     Apply a fencing delay. Value -1 means disable also any
 100  *                      static/random fencing delays from pcmk_delay_base/max.
 101  *
 102  * \return Standard Pacemaker return code
 103  */
 104 int pcmk_fence_action(stonith_t *st, const char *target, const char *action,
 105                       const char *name, unsigned int timeout, unsigned int tolerance,
 106                       int delay);
 107 
 108 /*!
 109  * \brief List the fencing operations that have occurred for a specific node.
 110  *
 111  * \note If \p xml is not NULL, it will be freed first and the previous
 112  *       contents lost.
 113  *
 114  * \param[in,out] xml       The destination for the result, as an XML tree.
 115  * \param[in]     st        A connection to the STONITH API.
 116  * \param[in]     target    The node to get history for.
 117  * \param[in]     timeout   How long to wait for the operation to complete (in ms).
 118  * \param[in]     quiet     Suppress most output.
 119  * \param[in]     verbose   Include additional output.
 120  * \param[in]     broadcast Gather fencing history from all nodes.
 121  * \param[in]     cleanup   Clean up fencing history after listing.
 122  *
 123  * \return Standard Pacemaker return code
 124  */
 125 int pcmk_fence_history(xmlNodePtr *xml, stonith_t *st, char *target,
 126                        unsigned int timeout, bool quiet, int verbose,
 127                        bool broadcast, bool cleanup);
 128 
 129 /*!
 130  * \brief List all installed STONITH agents.
 131  *
 132  * \note If \p xml is not NULL, it will be freed first and the previous
 133  *       contents lost.
 134  *
 135  * \param[in,out] xml     The destination for the result, as an XML tree.
 136  * \param[in]     st      A connection to the STONITH API.
 137  * \param[in]     timeout How long to wait for the operation to complete (in ms).
 138  *
 139  * \return Standard Pacemaker return code
 140  */
 141 int pcmk_fence_installed(xmlNodePtr *xml, stonith_t *st, unsigned int timeout);
 142 
 143 /*!
 144  * \brief When was a device last fenced?
 145  *
 146  * \note If \p xml is not NULL, it will be freed first and the previous
 147  *       contents lost.
 148  *
 149  * \param[in,out] xml       The destination for the result, as an XML tree.
 150  * \param[in]     target    The node that was fenced.
 151  * \param[in]     as_nodeid
 152  *
 153  * \return Standard Pacemaker return code
 154  */
 155 int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
 156 
 157 /*!
 158  * \brief List nodes that can be fenced.
 159  *
 160  * \note If \p xml is not NULL, it will be freed first and the previous
 161  *       contents lost.
 162  *
 163  * \param[in,out] xml        The destination for the result, as an XML tree
 164  * \param[in]     st         A connection to the STONITH API
 165  * \param[in]     device_id  Resource ID of fence device to check
 166  * \param[in]     timeout    How long to wait for the operation to complete (in ms)
 167  *
 168  * \return Standard Pacemaker return code
 169  */
 170 int pcmk_fence_list_targets(xmlNodePtr *xml, stonith_t *st,
 171                             const char *device_id, unsigned int timeout);
 172 
 173 /*!
 174  * \brief Get metadata for a resource.
 175  *
 176  * \note If \p xml is not NULL, it will be freed first and the previous
 177  *       contents lost.
 178  *
 179  * \param[in,out] xml     The destination for the result, as an XML tree.
 180  * \param[in]     st      A connection to the STONITH API.
 181  * \param[in]     agent   The fence agent to get metadata for.
 182  * \param[in]     timeout How long to wait for the operation to complete (in ms).
 183  *
 184  * \return Standard Pacemaker return code
 185  */
 186 int pcmk_fence_metadata(xmlNodePtr *xml, stonith_t *st, char *agent,
 187                         unsigned int timeout);
 188 
 189 /*!
 190  * \brief List registered fence devices.
 191  *
 192  * \note If \p xml is not NULL, it will be freed first and the previous
 193  *       contents lost.
 194  *
 195  * \param[in,out] xml     The destination for the result, as an XML tree.
 196  * \param[in]     st      A connection to the STONITH API.
 197  * \param[in]     target  If not NULL, only return devices that can fence
 198  *                        this node.
 199  * \param[in]     timeout How long to wait for the operation to complete (in ms).
 200  *
 201  * \return Standard Pacemaker return code
 202  */
 203 int pcmk_fence_registered(xmlNodePtr *xml, stonith_t *st, char *target,
 204                           unsigned int timeout);
 205 
 206 /*!
 207  * \brief Register a fencing level for a specific node, node regex, or attribute.
 208  *
 209  * \p target can take three different forms:
 210  *   - name=value, in which case \p target is an attribute.
 211  *   - @pattern, in which case \p target is a node regex.
 212  *   - Otherwise, \p target is a node name.
 213  *
 214  * \param[in] st          A connection to the STONITH API.
 215  * \param[in] target      The object to register a fencing level for.
 216  * \param[in] fence_level Index number of level to add.
 217  * \param[in] devices     Devices to use in level.
 218  *
 219  * \return Standard Pacemaker return code
 220  */
 221 int pcmk_fence_register_level(stonith_t *st, char *target, int fence_level,
 222                               stonith_key_value_t *devices);
 223 
 224 /*!
 225  * \brief Unregister a fencing level for a specific node, node regex, or attribute.
 226  *
 227  * \p target can take three different forms:
 228  *   - name=value, in which case \p target is an attribute.
 229  *   - @pattern, in which case \p target is a node regex.
 230  *   - Otherwise, \p target is a node name.
 231  *
 232  * \param[in] st          A connection to the STONITH API.
 233  * \param[in] target      The object to unregister a fencing level for.
 234  * \param[in] fence_level Index number of level to remove.
 235  *
 236  * \return Standard Pacemaker return code
 237  */
 238 int pcmk_fence_unregister_level(stonith_t *st, char *target, int fence_level);
 239 
 240 /*!
 241  * \brief Validate a STONITH device configuration.
 242  *
 243  * \note If \p xml is not NULL, it will be freed first and the previous
 244  *       contents lost.
 245  *
 246  * \param[in,out] xml     The destination for the result, as an XML tree.
 247  * \param[in]     st      A connection to the STONITH API.
 248  * \param[in]     agent   The agent to validate (for example, "fence_xvm").
 249  * \param[in]     id      STONITH device ID (may be NULL).
 250  * \param[in]     params  STONITH device configuration parameters.
 251  * \param[in]     timeout How long to wait for the operation to complete (in ms).
 252  *
 253  * \return Standard Pacemaker return code
 254  */
 255 int pcmk_fence_validate(xmlNodePtr *xml, stonith_t *st, const char *agent,
 256                         const char *id, stonith_key_value_t *params,
 257                         unsigned int timeout);
 258 
 259 #endif
 260 
 261 #ifdef __cplusplus
 262 }
 263 #endif
 264 
 265 #endif

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