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