root/include/pacemaker.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pcmk_query_node_name
  2. pcmk_check_rule

   1 /*
   2  * Copyright 2019-2025 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__PACEMAKER__H
  11 #  define PCMK__PACEMAKER__H
  12 
  13 #  include <glib.h>
  14 #  include <libxml/tree.h>
  15 #  include <crm/common/scheduler.h>
  16 #  include <crm/cib/cib_types.h>
  17 
  18 #  include <crm/stonith-ng.h>
  19 
  20 #ifdef __cplusplus
  21 extern "C" {
  22 #endif
  23 
  24 /**
  25  * \file
  26  * \brief High Level API
  27  * \ingroup pacemaker
  28  */
  29 
  30 
  31 /*!
  32  * \brief Modify operation of running a cluster simulation.
  33  */
  34 enum pcmk_sim_flags {
  35     // @COMPAT Use UINT32_C(1); should not affect behavior
  36     pcmk_sim_none             = 0,
  37     pcmk_sim_all_actions      = 1 << 0,
  38     pcmk_sim_show_pending     = 1 << 1,
  39     pcmk_sim_process          = 1 << 2,
  40     pcmk_sim_show_scores      = 1 << 3,
  41     pcmk_sim_show_utilization = 1 << 4,
  42     pcmk_sim_simulate         = 1 << 5,
  43     pcmk_sim_sanitized        = 1 << 6,
  44     pcmk_sim_verbose          = 1 << 7,
  45 };
  46 
  47 /*!
  48  * \brief Synthetic cluster events that can be injected into the cluster
  49  *        for running simulations.
  50  */
  51 typedef struct {
  52     /*! A list of node names (gchar *) to simulate bringing online */
  53     GList *node_up;
  54     /*! A list of node names (gchar *) to simulate bringing offline */
  55     GList *node_down;
  56     /*! A list of node names (gchar *) to simulate failing */
  57     GList *node_fail;
  58     /*! A list of operations (gchar *) to inject.  The format of these strings
  59      * is described in the "Operation Specification" section of crm_simulate
  60      * help output.
  61      */
  62     GList *op_inject;
  63     /*! A list of operations (gchar *) that should return a given error code
  64      * if they fail.  The format of these strings is described in the
  65      * "Operation Specification" section of crm_simulate help output.
  66      */
  67     GList *op_fail;
  68     /*! A list of tickets (gchar *) to simulate granting */
  69     GList *ticket_grant;
  70     /*! A list of tickets (gchar *) to simulate revoking */
  71     GList *ticket_revoke;
  72     /*! A list of tickets (gchar *) to simulate putting on standby */
  73     GList *ticket_standby;
  74     /*! A list of tickets (gchar *) to simulate activating */
  75     GList *ticket_activate;
  76     /*! Does the cluster have an active watchdog device? */
  77     char *watchdog;
  78     /*! Does the cluster have quorum? */
  79     char *quorum;
  80 } pcmk_injections_t;
  81 
  82 /*!
  83  * \brief Get and output controller status
  84  *
  85  * \param[in,out] xml                 Destination for the result, as an XML tree
  86  * \param[in]     node_name           Name of node whose status is desired
  87  *                                    (\p NULL for DC)
  88  * \param[in]     message_timeout_ms  How long to wait for a reply from the
  89  *                                    controller API. If 0,
  90  *                                    \p pcmk_ipc_dispatch_sync will be used.
  91  *                                    Otherwise, \p pcmk_ipc_dispatch_poll will
  92  *                                    be used.
  93  *
  94  * \return Standard Pacemaker return code
  95  */
  96 int pcmk_controller_status(xmlNodePtr *xml, const char *node_name,
  97                            unsigned int message_timeout_ms);
  98 
  99 /*!
 100  * \brief Get and output designated controller node name
 101  *
 102  * \param[in,out] xml                 Destination for the result, as an XML tree
 103  * \param[in]     message_timeout_ms  How long to wait for a reply from the
 104  *                                    controller API. If 0,
 105  *                                    \p pcmk_ipc_dispatch_sync will be used.
 106  *                                    Otherwise, \p pcmk_ipc_dispatch_poll will
 107  *                                    be used.
 108  *
 109  * \return Standard Pacemaker return code
 110  */
 111 int pcmk_designated_controller(xmlNodePtr *xml,
 112                                unsigned int message_timeout_ms);
 113 
 114 /*!
 115  * \brief Free a :pcmk_injections_t structure
 116  *
 117  * \param[in,out] injections The structure to be freed
 118  */
 119 void pcmk_free_injections(pcmk_injections_t *injections);
 120 
 121 /*!
 122  * \brief Get and optionally output node info corresponding to a node ID from
 123  *        the controller
 124  *
 125  * \param[in,out] xml                 Destination for the result, as an XML tree
 126  * \param[in,out] node_id             ID of node whose name to get. If \p NULL
 127  *                                    or 0, get the local node name. If not
 128  *                                    \p NULL, store the true node ID here on
 129  *                                    success.
 130  * \param[out]    node_name           If not \p NULL, where to store the node
 131  *                                    name
 132  * \param[out]    uuid                If not \p NULL, where to store the node
 133  *                                    UUID
 134  * \param[out]    state               If not \p NULL, where to store the
 135  *                                    membership state
 136  * \param[out]    is_remote           If not \p NULL, where to store whether the
 137  *                                    node is a Pacemaker Remote node
 138  * \param[out]    have_quorum         If not \p NULL, where to store whether the
 139  *                                    node has quorum
 140  * \param[in]     show_output         Whether to output the node info
 141  * \param[in]     message_timeout_ms  How long to wait for a reply from the
 142  *                                    controller API. If 0,
 143  *                                    \p pcmk_ipc_dispatch_sync will be used.
 144  *                                    Otherwise, \p pcmk_ipc_dispatch_poll will
 145  *                                    be used.
 146  *
 147  * \return Standard Pacemaker return code
 148  *
 149  * \note The caller is responsible for freeing \p *node_name, \p *uuid, and
 150  *       \p *state using \p free().
 151  */
 152 int pcmk_query_node_info(xmlNodePtr *xml, uint32_t *node_id, char **node_name,
 153                          char **uuid, char **state, bool *have_quorum,
 154                          bool *is_remote, bool show_output,
 155                          unsigned int message_timeout_ms);
 156 
 157 /*!
 158  * \brief Get the node name corresponding to a node ID from the controller
 159  *
 160  * \param[in,out] xml                 Destination for the result, as an XML tree
 161  * \param[in,out] node_id             ID of node whose name to get (or 0 for the
 162  *                                    local node)
 163  * \param[out]    node_name           If not \p NULL, where to store the node
 164  *                                    name
 165  * \param[in]     message_timeout_ms  How long to wait for a reply from the
 166  *                                    controller API. If 0,
 167  *                                    \p pcmk_ipc_dispatch_sync will be used.
 168  *                                    Otherwise, \p pcmk_ipc_dispatch_poll will
 169  *                                    be used.
 170  *
 171  * \return Standard Pacemaker return code
 172  *
 173  * \note The caller is responsible for freeing \p *node_name using \p free().
 174  */
 175 static inline int
 176 pcmk_query_node_name(xmlNodePtr *xml, uint32_t node_id, char **node_name,
     /* [previous][next][first][last][top][bottom][index][help] */
 177                      unsigned int message_timeout_ms)
 178 {
 179     return pcmk_query_node_info(xml, &node_id, node_name, NULL, NULL, NULL,
 180                                 NULL, false, message_timeout_ms);
 181 }
 182 
 183 /*!
 184  * \brief Get and output \p pacemakerd status
 185  *
 186  * \param[in,out] xml                 Destination for the result, as an XML tree
 187  * \param[in]     ipc_name            IPC name for request
 188  * \param[in]     message_timeout_ms  How long to wait for a reply from the
 189  *                                    \p pacemakerd API. If 0,
 190  *                                    \p pcmk_ipc_dispatch_sync will be used.
 191  *                                    Otherwise, \p pcmk_ipc_dispatch_poll will
 192  *                                    be used.
 193  *
 194  * \return Standard Pacemaker return code
 195  */
 196 int pcmk_pacemakerd_status(xmlNodePtr *xml, const char *ipc_name,
 197                            unsigned int message_timeout_ms);
 198 
 199 /*!
 200  * \brief Remove a resource
 201  *
 202  * \param[in,out] xml   Destination for the result, as an XML tree
 203  * \param[in] rsc_id    Resource to remove
 204  * \param[in] rsc_type  Type of the resource ("primitive", "group", etc.)
 205  *
 206  * \return Standard Pacemaker return code
 207  * \note This function will return \p pcmk_rc_ok if \p rsc_id doesn't exist
 208  *       or if \p rsc_type is incorrect for \p rsc_id (deleting something
 209  *       that doesn't exist always succeeds).
 210  */
 211 int pcmk_resource_delete(xmlNodePtr *xml, const char *rsc_id, const char *rsc_type);
 212 
 213 /*!
 214  * \brief Calculate and output resource operation digests
 215  *
 216  * \param[out]    xml        Where to store XML with result
 217  * \param[in,out] rsc        Resource to calculate digests for
 218  * \param[in]     node       Node whose operation history should be used
 219  * \param[in]     overrides  Hash table of configuration parameters to override
 220  *
 221  * \return Standard Pacemaker return code
 222  */
 223 int pcmk_resource_digests(xmlNodePtr *xml, pcmk_resource_t *rsc,
 224                           const pcmk_node_t *node, GHashTable *overrides);
 225 
 226 /*!
 227  * \brief Simulate a cluster's response to events
 228  *
 229  * This high-level function essentially implements crm_simulate(8). It operates
 230  * on an input CIB file and various lists of events that can be simulated. It
 231  * optionally writes out a variety of artifacts to show the results of the
 232  * simulation. Output can be modified with various flags.
 233  *
 234  * \param[in,out] xml          The destination for the result, as an XML tree
 235  * \param[in,out] scheduler    Scheduler data
 236  * \param[in]     injections   A structure containing cluster events
 237  *                             (node up/down, tickets, injected operations)
 238  * \param[in]     flags        Group of <tt>enum pcmk_sim_flags</tt>
 239  * \param[in]     section_opts Which portions of the cluster status output
 240  *                             should be displayed?
 241  * \param[in]     use_date     Date to set the cluster's time to (may be NULL)
 242  * \param[in]     input_file   The source CIB file, which may be overwritten by
 243  *                             this function (may be NULL)
 244  * \param[in]     graph_file   Where to write the XML-formatted transition graph
 245  *                             (may be NULL, in which case no file will be
 246  *                             written)
 247  * \param[in]     dot_file     Where to write the dot(1) formatted transition
 248  *                             graph (may be NULL, in which case no file will
 249  *                             be written)
 250  *
 251  * \return Standard Pacemaker return code
 252  */
 253 int pcmk_simulate(xmlNodePtr *xml, pcmk_scheduler_t *scheduler,
 254                   const pcmk_injections_t *injections, unsigned int flags,
 255                   unsigned int section_opts, const char *use_date,
 256                   const char *input_file, const char *graph_file,
 257                   const char *dot_file);
 258 
 259 /*!
 260  * \brief Verify that a CIB is error-free or output errors and warnings
 261  *
 262  * This high-level function essentially implements crm_verify(8). It operates
 263  * on an input CIB file, which can be inputted through one of several ways. It
 264  * writes out XML-formatted output.
 265  *
 266  * \param[in,out] xml          The destination for the result, as an XML tree
 267  * \param[in]     cib_source   Source of the CIB: 
 268  *                             NULL -> use live cib, "-" -> stdin
 269  *                             "<..." -> xml str, otherwise -> xml file name
 270  *
 271  * \return Standard Pacemaker return code
 272  */
 273 int pcmk_verify(xmlNodePtr *xml, const char *cib_source);
 274 
 275 /*!
 276  * \brief Get nodes list
 277  *
 278  * \param[in,out] xml         The destination for the result, as an XML tree
 279  * \param[in]     node_types  Node type(s) to return (default: all)
 280  *
 281  * \return Standard Pacemaker return code
 282  */
 283 int pcmk_list_nodes(xmlNodePtr *xml, const char *node_types);
 284 
 285 /*!
 286  * \brief Output cluster status formatted like `crm_mon --output-as=xml`
 287  *
 288  * \param[in,out] xml  The destination for the result, as an XML tree
 289  *
 290  * \return Standard Pacemaker return code
 291  */
 292 int pcmk_status(xmlNodePtr *xml);
 293 
 294 /*!
 295  * \brief Check whether each rule in a list is in effect
 296  *
 297  * \param[in,out] xml       The destination for the result, as an XML tree
 298  * \param[in]     input     The CIB XML to check (if \c NULL, use current CIB)
 299  * \param[in]     date      Check whether the rule is in effect at this date and
 300  *                          time (if \c NULL, use current date and time)
 301  * \param[in]     rule_ids  The IDs of the rules to check, as a <tt>NULL</tt>-
 302  *                          terminated list.
 303  *
 304  * \return Standard Pacemaker return code
 305  */
 306 int pcmk_check_rules(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
 307                      const char **rule_ids);
 308 
 309 /*!
 310  * \brief Check whether a given rule is in effect
 311  *
 312  * \param[in,out] xml       The destination for the result, as an XML tree
 313  * \param[in]     input     The CIB XML to check (if \c NULL, use current CIB)
 314  * \param[in]     date      Check whether the rule is in effect at this date and
 315  *                          time (if \c NULL, use current date and time)
 316  * \param[in]     rule_ids  The ID of the rule to check
 317  *
 318  * \return Standard Pacemaker return code
 319  */
 320 static inline int
 321 pcmk_check_rule(xmlNodePtr *xml, xmlNodePtr input, const crm_time_t *date,
     /* [previous][next][first][last][top][bottom][index][help] */
 322                 const char *rule_id)
 323 {
 324     const char *rule_ids[] = {rule_id, NULL};
 325     return pcmk_check_rules(xml, input, date, rule_ids);
 326 }
 327 
 328 //! Bit flags to control which fields of result code info are displayed
 329 enum pcmk_rc_disp_flags {
 330     pcmk_rc_disp_none = 0,          //!< (Does nothing)
 331     pcmk_rc_disp_code = (1 << 0),   //!< Display result code number
 332     pcmk_rc_disp_name = (1 << 1),   //!< Display result code name
 333     pcmk_rc_disp_desc = (1 << 2),   //!< Display result code description
 334 };
 335 
 336 /*!
 337  * \brief Display the name and/or description of a result code
 338  *
 339  * \param[in,out] xml    The destination for the result, as an XML tree
 340  * \param[in]     code   The result code
 341  * \param[in]     type   Interpret \c code as this type of result code.
 342  *                       Supported values: \c pcmk_result_legacy,
 343  *                       \c pcmk_result_rc, \c pcmk_result_exitcode.
 344  * \param[in]     flags  Group of \c pcmk_rc_disp_flags
 345  *
 346  * \return Standard Pacemaker return code
 347  */
 348 int pcmk_show_result_code(xmlNodePtr *xml, int code, enum pcmk_result_type type,
 349                           uint32_t flags);
 350 
 351 /*!
 352  * \brief List all valid result codes in a particular family
 353  *
 354  * \param[in,out] xml    The destination for the result, as an XML tree
 355  * \param[in]     type   The family of result codes to list. Supported
 356  *                       values: \c pcmk_result_legacy, \c pcmk_result_rc,
 357  *                       \c pcmk_result_exitcode.
 358  * \param[in]     flags  Group of \c pcmk_rc_disp_flags
 359  *
 360  * \return Standard Pacemaker return code
 361  */
 362 int pcmk_list_result_codes(xmlNodePtr *xml, enum pcmk_result_type type,
 363                            uint32_t flags);
 364 
 365 /*!
 366  * \brief List available providers for the given OCF agent
 367  *
 368  * \param[in,out] xml        The destination for the result, as an XML tree
 369  * \param[in]     agent_spec Resource agent name
 370  *
 371  * \return Standard Pacemaker return code
 372  */
 373 int pcmk_list_alternatives(xmlNodePtr *xml, const char *agent_spec);
 374 
 375 /*!
 376  * \brief List all agents available for the named standard and/or provider
 377  *
 378  * \param[in,out] xml        The destination for the result, as an XML tree
 379  * \param[in]     agent_spec STD[:PROV]
 380  *
 381  * \return Standard Pacemaker return code
 382  */
 383 int pcmk_list_agents(xmlNodePtr *xml, char *agent_spec);
 384 
 385 /*!
 386  * \brief List all available OCF providers for the given agent
 387  *
 388  * \param[in,out] xml        The destination for the result, as an XML tree
 389  * \param[in]     agent_spec Resource agent name
 390  *
 391  * \return Standard Pacemaker return code
 392  */
 393 int pcmk_list_providers(xmlNodePtr *xml, const char *agent_spec);
 394 
 395 /*!
 396  * \brief List all available resource agent standards
 397  *
 398  * \param[in,out] xml        The destination for the result, as an XML tree
 399  *
 400  * \return Standard Pacemaker return code
 401  */
 402 int pcmk_list_standards(xmlNodePtr *xml);
 403 
 404 /*!
 405  * \brief List all available cluster options
 406  *
 407  * These are options that affect the entire cluster.
 408  *
 409  * \param[in,out] xml  The destination for the result, as an XML tree
 410  * \param[in]     all  If \c true, include advanced and deprecated options
 411  *                     (currently always treated as true)
 412  *
 413  * \return Standard Pacemaker return code
 414  */
 415 int pcmk_list_cluster_options(xmlNode **xml, bool all);
 416 
 417 /*!
 418  * \brief List common fencing resource parameters
 419  *
 420  * These are parameters that are available for all fencing resources, regardless
 421  * of type. They are processed by Pacemaker, rather than by the fence agent or
 422  * the fencing library.
 423  *
 424  * \param[in,out] xml  The destination for the result, as an XML tree
 425  * \param[in]     all  If \c true, include advanced and deprecated options
 426  *                     (currently always treated as true)
 427  *
 428  * \return Standard Pacemaker return code
 429  */
 430 int pcmk_list_fencing_params(xmlNode **xml, bool all);
 431 
 432 /*!
 433  * \internal
 434  * \brief List meta-attributes applicable to primitive resources as OCF-like XML
 435  *
 436  * \param[in,out] out  Output object
 437  * \param[in]     all  If \c true, include advanced and deprecated options (this
 438  *                     is always treated as true for XML output objects)
 439  *
 440  * \return Standard Pacemaker return code
 441  */
 442 int pcmk_list_primitive_meta(xmlNode **xml, bool all);
 443 
 444 /*!
 445  * \brief Return constraints that apply to the given ticket
 446  *
 447  * \param[in,out] xml           The destination for the result, as an XML tree
 448  * \param[in]     ticket_id     Ticket to find constraint for, or \c NULL for
 449  *                              all ticket constraints
 450  *
 451  * \return Standard Pacemaker return code
 452  */
 453 int pcmk_ticket_constraints(xmlNodePtr *xml, const char *ticket_id);
 454 
 455 
 456 /*!
 457  * \brief Delete a ticket's state from the local cluster site
 458  *
 459  * \param[in,out] xml       The destination for the result, as an XML tree
 460  * \param[in]     ticket_id Ticket to delete
 461  * \param[in]     force     If \c true, delete the ticket even if it has
 462  *                          been granted
 463  *
 464  * \return Standard Pacemaker return code
 465  */
 466 int pcmk_ticket_delete(xmlNodePtr *xml, const char *ticket_id, bool force);
 467 
 468 /*!
 469  * \brief Return the value of a ticket's attribute
 470  *
 471  * \param[in,out] xml           The destination for the result, as an XML tree
 472  * \param[in]     ticket_id     Ticket to find attribute value for
 473  * \param[in]     attr_name     Attribute's name to find value for
 474  * \param[in]     attr_default  If either the ticket or the attribute do not
 475  *                              exist, use this as the value in \p xml
 476  *
 477  * \return Standard Pacemaker return code
 478  */
 479 int pcmk_ticket_get_attr(xmlNodePtr *xml, const char *ticket_id,
 480                          const char *attr_name, const char *attr_default);
 481 
 482 /*!
 483  * \brief Return information about the given ticket
 484  *
 485  * \param[in,out] xml           The destination for the result, as an XML tree
 486  * \param[in]     ticket_id     Ticket to find info value for, or \c NULL for
 487  *                              all tickets
 488  *
 489  * \return Standard Pacemaker return code
 490  */
 491 int pcmk_ticket_info(xmlNodePtr *xml, const char *ticket_id);
 492 
 493 /*!
 494  * \brief Remove the given attribute(s) from a ticket
 495  *
 496  * \param[in,out] xml           The destination for the result, as an XML tree
 497  * \param[in]     ticket_id     Ticket to remove attributes from
 498  * \param[in]     attr_delete   A list of attribute names
 499  * \param[in]     force         Attempting to remove the granted attribute of
 500  *                              \p ticket_id will cause this function to return
 501  *                              \c EACCES unless \p force is set to \c true
 502  *
 503  * \return Standard Pacemaker return code
 504  */
 505 int pcmk_ticket_remove_attr(xmlNodePtr *xml, const char *ticket_id, GList *attr_delete,
 506                             bool force);
 507 
 508 /*!
 509  * \brief Set the given attribute(s) on a ticket
 510  *
 511  * \param[in,out] xml           The destination for the result, as an XML tree
 512  * \param[in]     ticket_id     Ticket to set attributes on
 513  * \param[in]     attr_set      A hash table of attributes, where keys are the
 514  *                              attribute names and the values are the attribute
 515  *                              values
 516  * \param[in]     force         Attempting to change the granted status of
 517  *                              \p ticket_id will cause this function to return
 518  *                              \c EACCES unless \p force is set to \c true
 519  *
 520  * \return Standard Pacemaker return code
 521  *
 522  * \note If no \p ticket_id attribute exists but \p attr_set is non-NULL, the
 523  *       ticket will be created with the given attributes.
 524  */
 525 int pcmk_ticket_set_attr(xmlNodePtr *xml, const char *ticket_id, GHashTable *attr_set,
 526                          bool force);
 527 
 528 /*!
 529  * \brief Return a ticket's state XML
 530  *
 531  * \param[in,out] xml           The destination for the result, as an XML tree
 532  * \param[in]     ticket_id     Ticket to find state for, or \c NULL for all
 533  *                              tickets
 534  *
 535  * \return Standard Pacemaker return code
 536  *
 537  * \note If \p ticket_id is not \c NULL and more than one ticket exists with
 538  *       that ID, this function returns \c pcmk_rc_duplicate_id.
 539  */
 540 int pcmk_ticket_state(xmlNodePtr *xml, const char *ticket_id);
 541 
 542 /*!
 543  * \brief Ask the cluster to perform fencing
 544  *
 545  * \param[in,out] xml       The destination for the result, as an XML tree
 546  * \param[in]     target    The node that should be fenced
 547  * \param[in]     action    The fencing action (on, off, reboot) to perform
 548  * \param[in]     name      Who requested the fence action?
 549  * \param[in]     timeout   How long to wait for operation to complete (in ms)
 550  * \param[in]     tolerance If a successful action for \p target happened within
 551  *                          this many ms, return 0 without performing the action
 552  *                          again
 553  * \param[in]     delay     Apply this delay (in milliseconds) before initiating
 554  *                          fencing action (-1 applies no delay and also
 555  *                          disables any fencing delay from pcmk_delay_base and
 556  *                          pcmk_delay_max)
 557  * \param[out]     reason   If not NULL, where to put descriptive failure reason
 558  *
 559  * \return Standard Pacemaker return code
 560  * \note If \p reason is not NULL, the caller is responsible for freeing its
 561  *       returned value.
 562  */
 563 int pcmk_request_fencing(xmlNodePtr *xml, const char *target, const char *action,
 564                          const char *name, unsigned int timeout,
 565                          unsigned int tolerance, int delay, char **reason);
 566 
 567 /*!
 568  * \brief List the fencing operations that have occurred for a specific node
 569  *
 570  * \note If \p xml is not NULL, it will be freed first and the previous
 571  *       contents lost.
 572  *
 573  * \param[in,out] xml       The destination for the result, as an XML tree
 574  * \param[in]     target    The node to get history for
 575  * \param[in]     timeout   How long to wait for operation to complete (in ms)
 576  * \param[in]     quiet     Suppress most output
 577  * \param[in]     verbose   Include additional output
 578  * \param[in]     broadcast Gather fencing history from all nodes
 579  * \param[in]     cleanup   Clean up fencing history after listing
 580  *
 581  * \return Standard Pacemaker return code
 582  */
 583 int pcmk_fence_history(xmlNodePtr *xml, const char *target, unsigned int timeout,
 584                        bool quiet, int verbose, bool broadcast, bool cleanup);
 585 
 586 /*!
 587  * \brief List all installed fence agents
 588  *
 589  * \param[in,out] xml      The destination for the result, as an XML tree (if
 590  *                         not NULL, previous contents will be freed and lost)
 591  * \param[in]     timeout  Ignored
 592  *
 593  * \return Standard Pacemaker return code
 594  */
 595 int pcmk_fence_installed(xmlNodePtr *xml, unsigned int timeout);
 596 
 597 /*!
 598  * \brief When was a device last fenced?
 599  *
 600  * \param[in,out] xml        The destination for the result, as an XML tree (if
 601  *                           not NULL, previous contents will be freed and lost)
 602  * \param[in]     target     The node that was fenced
 603  * \param[in]     as_nodeid  If true, \p target has node ID rather than name
 604  *
 605  * \return Standard Pacemaker return code
 606  */
 607 int pcmk_fence_last(xmlNodePtr *xml, const char *target, bool as_nodeid);
 608 
 609 /*!
 610  * \brief List nodes that can be fenced
 611  *
 612  * \param[in,out] xml        The destination for the result, as an XML tree (if
 613  *                           not NULL, previous contents will be freed and lost)
 614  * \param[in]     device_id  Resource ID of fence device to check
 615  * \param[in]     timeout    How long to wait for operation to complete (in ms)
 616  *
 617  * \return Standard Pacemaker return code
 618  */
 619 int pcmk_fence_list_targets(xmlNodePtr *xml, const char *device_id,
 620                             unsigned int timeout);
 621 
 622 /*!
 623  * \brief Get metadata for a fence agent
 624  *
 625  * \note If \p xml is not NULL, it will be freed first and the previous
 626  *       contents lost.
 627  *
 628  * \param[in,out] xml      The destination for the result, as an XML tree (if
 629  *                         not NULL, previous contents will be freed and lost)
 630  * \param[in]     agent    The fence agent to get metadata for
 631  * \param[in]     timeout  How long to wait for operation to complete (in ms)
 632  *
 633  * \return Standard Pacemaker return code
 634  */
 635 int pcmk_fence_metadata(xmlNodePtr *xml, const char *agent, unsigned int timeout);
 636 
 637 /*!
 638  * \brief List registered fence devices
 639  *
 640  * \param[in,out] xml      The destination for the result, as an XML tree (if
 641  *                         not NULL, previous contents will be freed and lost)
 642  * \param[in]     target   If not NULL, return only devices that can fence this
 643  * \param[in]     timeout  How long to wait for operation to complete (in ms)
 644  *
 645  * \return Standard Pacemaker return code
 646  */
 647 int pcmk_fence_registered(xmlNodePtr *xml, const char *target, unsigned int timeout);
 648 
 649 /*!
 650  * \brief Register a fencing topology level
 651  *
 652  * \param[in,out] xml          The destination for the result, as an XML tree (if
 653  *                             not NULL, previous contents will be freed and lost)
 654  * \param[in]     target       What fencing level targets (as "name=value" to
 655  *                             target by given node attribute, or "@pattern" to
 656  *                             target by node name pattern, or a node name)
 657  * \param[in]     fence_level  Index number of level to add
 658  * \param[in]     devices      Devices to use in level as a list of char *
 659  *
 660  * \return Standard Pacemaker return code
 661  */
 662 int pcmk_fence_register_level(xmlNodePtr *xml, const char *target, int fence_level,
 663                               GList *devices);
 664 
 665 /*!
 666  * \brief Unregister a fencing topology level
 667  *
 668  * \param[in,out] xml          The destination for the result, as an XML tree (if
 669  *                             not NULL, previous contents will be freed and lost)
 670  * \param[in]     target       What fencing level targets (as "name=value" to
 671  *                             target by given node attribute, or "@pattern" to
 672  *                             target by node name pattern, or a node name)
 673  * \param[in]     fence_level  Index number of level to remove
 674  *
 675  * \return Standard Pacemaker return code
 676  */
 677 int pcmk_fence_unregister_level(xmlNodePtr *xml, const char *target, int fence_level);
 678 
 679 /*!
 680  * \brief Validate a fence device configuration
 681  *
 682  * \param[in,out] xml      The destination for the result, as an XML tree (if
 683  *                         not NULL, previous contents will be freed and lost)
 684  * \param[in]     agent    The agent to validate (for example, "fence_xvm")
 685  * \param[in]     id       Fence device ID (may be NULL)
 686  * \param[in]     params   Fence device configuration parameters
 687  * \param[in]     timeout  How long to wait for operation to complete (in ms)
 688  *
 689  * \return Standard Pacemaker return code
 690  */
 691 int pcmk_fence_validate(xmlNodePtr *xml, const char *agent, const char *id,
 692                         GHashTable *params, unsigned int timeout);
 693 
 694 #ifdef __cplusplus
 695 }
 696 #endif
 697 
 698 #endif

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