root/lib/pacemaker/libpacemaker_private.h

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

INCLUDED FROM


DEFINITIONS

This source file includes following definitions.
  1. pcmk__colocation_has_influence

   1 /*
   2  * Copyright 2021-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 PCMK__LIBPACEMAKER_PRIVATE__H
  11 #  define PCMK__LIBPACEMAKER_PRIVATE__H
  12 
  13 /* This header is for the sole use of libpacemaker, so that functions can be
  14  * declared with G_GNUC_INTERNAL for efficiency.
  15  */
  16 
  17 #include <crm/pengine/pe_types.h> // pe_action_t, pe_node_t, pe_working_set_t
  18 
  19 // Flags to modify the behavior of add_colocated_node_scores()
  20 enum pcmk__coloc_select {
  21     // With no other flags, apply all "with this" colocations
  22     pcmk__coloc_select_default      = 0,
  23 
  24     // Apply "this with" colocations instead of "with this" colocations
  25     pcmk__coloc_select_this_with    = (1 << 0),
  26 
  27     // Apply only colocations with non-negative scores
  28     pcmk__coloc_select_nonnegative  = (1 << 1),
  29 
  30     // Apply only colocations with at least one matching node
  31     pcmk__coloc_select_active       = (1 << 2),
  32 };
  33 
  34 // Flags the update_ordered_actions() method can return
  35 enum pcmk__updated {
  36     pcmk__updated_none      = 0,        // Nothing changed
  37     pcmk__updated_first     = (1 << 0), // First action was updated
  38     pcmk__updated_then      = (1 << 1), // Then action was updated
  39 };
  40 
  41 #define pcmk__set_updated_flags(au_flags, action, flags_to_set) do {        \
  42         au_flags = pcmk__set_flags_as(__func__, __LINE__,                   \
  43                                       LOG_TRACE, "Action update",           \
  44                                       (action)->uuid, au_flags,             \
  45                                       (flags_to_set), #flags_to_set);       \
  46     } while (0)
  47 
  48 #define pcmk__clear_updated_flags(au_flags, action, flags_to_clear) do {    \
  49         au_flags = pcmk__clear_flags_as(__func__, __LINE__,                 \
  50                                         LOG_TRACE, "Action update",         \
  51                                         (action)->uuid, au_flags,           \
  52                                         (flags_to_clear), #flags_to_clear); \
  53     } while (0)
  54 
  55 // Resource allocation methods
  56 struct resource_alloc_functions_s {
  57     /*!
  58      * \internal
  59      * \brief Assign a resource to a node
  60      *
  61      * \param[in,out] rsc     Resource to assign to a node
  62      * \param[in]     prefer  Node to prefer, if all else is equal
  63      *
  64      * \return Node that \p rsc is assigned to, if assigned entirely to one node
  65      */
  66     pe_node_t *(*assign)(pe_resource_t *rsc, const pe_node_t *prefer);
  67 
  68     /*!
  69      * \internal
  70      * \brief Create all actions needed for a given resource
  71      *
  72      * \param[in,out] rsc  Resource to create actions for
  73      */
  74     void (*create_actions)(pe_resource_t *rsc);
  75 
  76     /*!
  77      * \internal
  78      * \brief Schedule any probes needed for a resource on a node
  79      *
  80      * \param[in,out] rsc   Resource to create probe for
  81      * \param[in,out] node  Node to create probe on
  82      *
  83      * \return true if any probe was created, otherwise false
  84      */
  85     bool (*create_probe)(pe_resource_t *rsc, pe_node_t *node);
  86 
  87     /*!
  88      * \internal
  89      * \brief Create implicit constraints needed for a resource
  90      *
  91      * \param[in,out] rsc  Resource to create implicit constraints for
  92      */
  93     void (*internal_constraints)(pe_resource_t *rsc);
  94 
  95     /*!
  96      * \internal
  97      * \brief Apply a colocation's score to node weights or resource priority
  98      *
  99      * Given a colocation constraint, apply its score to the dependent's
 100      * allowed node weights (if we are still placing resources) or priority (if
 101      * we are choosing promotable clone instance roles).
 102      *
 103      * \param[in,out] dependent      Dependent resource in colocation
 104      * \param[in]     primary        Primary resource in colocation
 105      * \param[in]     colocation     Colocation constraint to apply
 106      * \param[in]     for_dependent  true if called on behalf of dependent
 107      */
 108     void (*apply_coloc_score) (pe_resource_t *dependent,
 109                                const pe_resource_t *primary,
 110                                const pcmk__colocation_t *colocation,
 111                                bool for_dependent);
 112 
 113     /*!
 114      * \internal
 115      * \brief Create list of all resources in colocations with a given resource
 116      *
 117      * Given a resource, create a list of all resources involved in mandatory
 118      * colocations with it, whether directly or indirectly via chained colocations.
 119      *
 120      * \param[in]     rsc             Resource to add to colocated list
 121      * \param[in]     orig_rsc        Resource originally requested
 122      * \param[in,out] colocated_rscs  Existing list
 123      *
 124      * \return List of given resource and all resources involved in colocations
 125      *
 126      * \note This function is recursive; top-level callers should pass NULL as
 127      *       \p colocated_rscs and \p orig_rsc, and the desired resource as
 128      *       \p rsc. The recursive calls will use other values.
 129      */
 130     GList *(*colocated_resources)(const pe_resource_t *rsc,
 131                                   const pe_resource_t *orig_rsc,
 132                                   GList *colocated_rscs);
 133 
 134     /*!
 135      * \internal
 136      * \brief Add colocations affecting a resource as primary to a list
 137      *
 138      * Given a resource being assigned (\p orig_rsc) and a resource somewhere in
 139      * its chain of ancestors (\p rsc, which may be \p orig_rsc), get
 140      * colocations that affect the ancestor as primary and should affect the
 141      * resource, and add them to a given list.
 142      *
 143      * \param[in]     rsc       Resource whose colocations should be added
 144      * \param[in]     orig_rsc  Affected resource (\p rsc or a descendant)
 145      * \param[in,out] list      List of colocations to add to
 146      *
 147      * \note All arguments should be non-NULL.
 148      * \note The pcmk__with_this_colocations() wrapper should usually be used
 149      *       instead of using this method directly.
 150      */
 151     void (*with_this_colocations)(const pe_resource_t *rsc,
 152                                   const pe_resource_t *orig_rsc, GList **list);
 153 
 154     /*!
 155      * \internal
 156      * \brief Add colocations affecting a resource as dependent to a list
 157      *
 158      * Given a resource being assigned (\p orig_rsc) and a resource somewhere in
 159      * its chain of ancestors (\p rsc, which may be \p orig_rsc), get
 160      * colocations that affect the ancestor as dependent and should affect the
 161      * resource, and add them to a given list.
 162      *
 163      *
 164      * \param[in]     rsc       Resource whose colocations should be added
 165      * \param[in]     orig_rsc  Affected resource (\p rsc or a descendant)
 166      * \param[in,out] list      List of colocations to add to
 167      *
 168      * \note All arguments should be non-NULL.
 169      * \note The pcmk__this_with_colocations() wrapper should usually be used
 170      *       instead of using this method directly.
 171      */
 172     void (*this_with_colocations)(const pe_resource_t *rsc,
 173                                   const pe_resource_t *orig_rsc, GList **list);
 174 
 175     /*!
 176      * \internal
 177      * \brief Update nodes with scores of colocated resources' nodes
 178      *
 179      * Given a table of nodes and a resource, update the nodes' scores with the
 180      * scores of the best nodes matching the attribute used for each of the
 181      * resource's relevant colocations.
 182      *
 183      * \param[in,out] rsc      Resource to check colocations for
 184      * \param[in]     log_id   Resource ID to use in logs (if NULL, use \p rsc ID)
 185      * \param[in,out] nodes    Nodes to update
 186      * \param[in]     attr     Colocation attribute (NULL to use default)
 187      * \param[in]     factor   Incorporate scores multiplied by this factor
 188      * \param[in]     flags    Bitmask of enum pcmk__coloc_select values
 189      *
 190      * \note The caller remains responsible for freeing \p *nodes.
 191      */
 192     void (*add_colocated_node_scores)(pe_resource_t *rsc, const char *log_id,
 193                                       GHashTable **nodes, const char *attr,
 194                                       float factor, uint32_t flags);
 195 
 196     /*!
 197      * \internal
 198      * \brief Apply a location constraint to a resource's allowed node scores
 199      *
 200      * \param[in,out] rsc       Resource to apply constraint to
 201      * \param[in,out] location  Location constraint to apply
 202      */
 203     void (*apply_location)(pe_resource_t *rsc, pe__location_t *location);
 204 
 205     /*!
 206      * \internal
 207      * \brief Return action flags for a given resource action
 208      *
 209      * \param[in,out] action  Action to get flags for
 210      * \param[in]     node    If not NULL, limit effects to this node
 211      *
 212      * \return Flags appropriate to \p action on \p node
 213      * \note For primitives, this will be the same as action->flags regardless
 214      *       of node. For collective resources, the flags can differ due to
 215      *       multiple instances possibly being involved.
 216      */
 217     enum pe_action_flags (*action_flags)(pe_action_t *action,
 218                                          const pe_node_t *node);
 219 
 220     /*!
 221      * \internal
 222      * \brief Update two actions according to an ordering between them
 223      *
 224      * Given information about an ordering of two actions, update the actions'
 225      * flags (and runnable_before members if appropriate) as appropriate for the
 226      * ordering. Effects may cascade to other orderings involving the actions as
 227      * well.
 228      *
 229      * \param[in,out] first     'First' action in an ordering
 230      * \param[in,out] then      'Then' action in an ordering
 231      * \param[in]     node      If not NULL, limit scope of ordering to this
 232      *                          node (only used when interleaving instances)
 233      * \param[in]     flags     Action flags for \p first for ordering purposes
 234      * \param[in]     filter    Action flags to limit scope of certain updates
 235      *                          (may include pe_action_optional to affect only
 236      *                          mandatory actions, and pe_action_runnable to
 237      *                          affect only runnable actions)
 238      * \param[in]     type      Group of enum pe_ordering flags to apply
 239      * \param[in,out] data_set  Cluster working set
 240      *
 241      * \return Group of enum pcmk__updated flags indicating what was updated
 242      */
 243     uint32_t (*update_ordered_actions)(pe_action_t *first, pe_action_t *then,
 244                                        const pe_node_t *node, uint32_t flags,
 245                                        uint32_t filter, uint32_t type,
 246                                        pe_working_set_t *data_set);
 247 
 248     void (*output_actions)(pe_resource_t *rsc);
 249 
 250     /*!
 251      * \internal
 252      * \brief Add a resource's actions to the transition graph
 253      *
 254      * \param[in,out] rsc  Resource whose actions should be added
 255      */
 256     void (*add_actions_to_graph)(pe_resource_t *rsc);
 257 
 258     /*!
 259      * \internal
 260      * \brief Add meta-attributes relevant to transition graph actions to XML
 261      *
 262      * If a given resource supports variant-specific meta-attributes that are
 263      * needed for transition graph actions, add them to a given XML element.
 264      *
 265      * \param[in]     rsc  Resource whose meta-attributes should be added
 266      * \param[in,out] xml  Transition graph action attributes XML to add to
 267      */
 268     void (*add_graph_meta)(const pe_resource_t *rsc, xmlNode *xml);
 269 
 270     /*!
 271      * \internal
 272      * \brief Add a resource's utilization to a table of utilization values
 273      *
 274      * This function is used when summing the utilization of a resource and all
 275      * resources colocated with it, to determine whether a node has sufficient
 276      * capacity. Given a resource and a table of utilization values, it will add
 277      * the resource's utilization to the existing values, if the resource has
 278      * not yet been allocated to a node.
 279      *
 280      * \param[in]     rsc          Resource with utilization to add
 281      * \param[in]     orig_rsc     Resource being allocated (for logging only)
 282      * \param[in]     all_rscs     List of all resources that will be summed
 283      * \param[in,out] utilization  Table of utilization values to add to
 284      */
 285     void (*add_utilization)(const pe_resource_t *rsc,
 286                             const pe_resource_t *orig_rsc, GList *all_rscs,
 287                             GHashTable *utilization);
 288 
 289     /*!
 290      * \internal
 291      * \brief Apply a shutdown lock for a resource, if appropriate
 292      *
 293      * \param[in,out] rsc       Resource to check for shutdown lock
 294      */
 295     void (*shutdown_lock)(pe_resource_t *rsc);
 296 };
 297 
 298 // Actions (pcmk_sched_actions.c)
 299 
 300 G_GNUC_INTERNAL
 301 void pcmk__update_action_for_orderings(pe_action_t *action,
 302                                        pe_working_set_t *data_set);
 303 
 304 G_GNUC_INTERNAL
 305 uint32_t pcmk__update_ordered_actions(pe_action_t *first, pe_action_t *then,
 306                                       const pe_node_t *node, uint32_t flags,
 307                                       uint32_t filter, uint32_t type,
 308                                       pe_working_set_t *data_set);
 309 
 310 G_GNUC_INTERNAL
 311 void pcmk__log_action(const char *pre_text, const pe_action_t *action,
 312                       bool details);
 313 
 314 G_GNUC_INTERNAL
 315 pe_action_t *pcmk__new_cancel_action(pe_resource_t *rsc, const char *name,
 316                                      guint interval_ms, const pe_node_t *node);
 317 
 318 G_GNUC_INTERNAL
 319 pe_action_t *pcmk__new_shutdown_action(pe_node_t *node);
 320 
 321 G_GNUC_INTERNAL
 322 bool pcmk__action_locks_rsc_to_node(const pe_action_t *action);
 323 
 324 G_GNUC_INTERNAL
 325 void pcmk__deduplicate_action_inputs(pe_action_t *action);
 326 
 327 G_GNUC_INTERNAL
 328 void pcmk__output_actions(pe_working_set_t *data_set);
 329 
 330 G_GNUC_INTERNAL
 331 bool pcmk__check_action_config(pe_resource_t *rsc, pe_node_t *node,
 332                                const xmlNode *xml_op);
 333 
 334 G_GNUC_INTERNAL
 335 void pcmk__handle_rsc_config_changes(pe_working_set_t *data_set);
 336 
 337 
 338 // Recurring actions (pcmk_sched_recurring.c)
 339 
 340 G_GNUC_INTERNAL
 341 void pcmk__create_recurring_actions(pe_resource_t *rsc);
 342 
 343 G_GNUC_INTERNAL
 344 void pcmk__schedule_cancel(pe_resource_t *rsc, const char *call_id,
 345                            const char *task, guint interval_ms,
 346                            const pe_node_t *node, const char *reason);
 347 
 348 G_GNUC_INTERNAL
 349 void pcmk__reschedule_recurring(pe_resource_t *rsc, const char *task,
 350                                 guint interval_ms, pe_node_t *node);
 351 
 352 G_GNUC_INTERNAL
 353 bool pcmk__action_is_recurring(const pe_action_t *action);
 354 
 355 
 356 // Producing transition graphs (pcmk_graph_producer.c)
 357 
 358 G_GNUC_INTERNAL
 359 bool pcmk__graph_has_loop(const pe_action_t *init_action,
 360                           const pe_action_t *action,
 361                           pe_action_wrapper_t *input);
 362 
 363 G_GNUC_INTERNAL
 364 void pcmk__add_rsc_actions_to_graph(pe_resource_t *rsc);
 365 
 366 G_GNUC_INTERNAL
 367 void pcmk__create_graph(pe_working_set_t *data_set);
 368 
 369 
 370 // Fencing (pcmk_sched_fencing.c)
 371 
 372 G_GNUC_INTERNAL
 373 void pcmk__order_vs_fence(pe_action_t *stonith_op, pe_working_set_t *data_set);
 374 
 375 G_GNUC_INTERNAL
 376 void pcmk__order_vs_unfence(const pe_resource_t *rsc, pe_node_t *node,
 377                             pe_action_t *action, enum pe_ordering order);
 378 
 379 G_GNUC_INTERNAL
 380 void pcmk__fence_guest(pe_node_t *node);
 381 
 382 G_GNUC_INTERNAL
 383 bool pcmk__node_unfenced(const pe_node_t *node);
 384 
 385 G_GNUC_INTERNAL
 386 void pcmk__order_restart_vs_unfence(gpointer data, gpointer user_data);
 387 
 388 
 389 // Injected scheduler inputs (pcmk_sched_injections.c)
 390 
 391 void pcmk__inject_scheduler_input(pe_working_set_t *data_set, cib_t *cib,
 392                                   const pcmk_injections_t *injections);
 393 
 394 
 395 // Constraints of any type (pcmk_sched_constraints.c)
 396 
 397 G_GNUC_INTERNAL
 398 pe_resource_t *pcmk__find_constraint_resource(GList *rsc_list, const char *id);
 399 
 400 G_GNUC_INTERNAL
 401 xmlNode *pcmk__expand_tags_in_sets(xmlNode *xml_obj,
 402                                    const pe_working_set_t *data_set);
 403 
 404 G_GNUC_INTERNAL
 405 bool pcmk__valid_resource_or_tag(const pe_working_set_t *data_set,
 406                                  const char *id, pe_resource_t **rsc,
 407                                  pe_tag_t **tag);
 408 
 409 G_GNUC_INTERNAL
 410 bool pcmk__tag_to_set(xmlNode *xml_obj, xmlNode **rsc_set, const char *attr,
 411                       bool convert_rsc, const pe_working_set_t *data_set);
 412 
 413 G_GNUC_INTERNAL
 414 void pcmk__create_internal_constraints(pe_working_set_t *data_set);
 415 
 416 
 417 // Location constraints
 418 
 419 G_GNUC_INTERNAL
 420 void pcmk__unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set);
 421 
 422 G_GNUC_INTERNAL
 423 pe__location_t *pcmk__new_location(const char *id, pe_resource_t *rsc,
 424                                    int node_weight, const char *discover_mode,
 425                                    pe_node_t *foo_node,
 426                                    pe_working_set_t *data_set);
 427 
 428 G_GNUC_INTERNAL
 429 void pcmk__apply_locations(pe_working_set_t *data_set);
 430 
 431 G_GNUC_INTERNAL
 432 void pcmk__apply_location(pe_resource_t *rsc, pe__location_t *constraint);
 433 
 434 
 435 // Colocation constraints (pcmk_sched_colocation.c)
 436 
 437 enum pcmk__coloc_affects {
 438     pcmk__coloc_affects_nothing = 0,
 439     pcmk__coloc_affects_location,
 440     pcmk__coloc_affects_role,
 441 };
 442 
 443 G_GNUC_INTERNAL
 444 enum pcmk__coloc_affects pcmk__colocation_affects(const pe_resource_t *dependent,
 445                                                   const pe_resource_t *primary,
 446                                                   const pcmk__colocation_t *colocation,
 447                                                   bool preview);
 448 
 449 G_GNUC_INTERNAL
 450 void pcmk__apply_coloc_to_weights(pe_resource_t *dependent,
 451                                   const pe_resource_t *primary,
 452                                   const pcmk__colocation_t *colocation);
 453 
 454 G_GNUC_INTERNAL
 455 void pcmk__apply_coloc_to_priority(pe_resource_t *dependent,
 456                                    const pe_resource_t *primary,
 457                                    const pcmk__colocation_t *colocation);
 458 
 459 G_GNUC_INTERNAL
 460 void pcmk__add_colocated_node_scores(pe_resource_t *rsc, const char *log_id,
 461                                      GHashTable **nodes, const char *attr,
 462                                      float factor, uint32_t flags);
 463 
 464 G_GNUC_INTERNAL
 465 void pcmk__add_dependent_scores(gpointer data, gpointer user_data);
 466 
 467 G_GNUC_INTERNAL
 468 void pcmk__unpack_colocation(xmlNode *xml_obj, pe_working_set_t *data_set);
 469 
 470 G_GNUC_INTERNAL
 471 void pcmk__add_this_with(GList **list, const pcmk__colocation_t *colocation);
 472 
 473 G_GNUC_INTERNAL
 474 void pcmk__add_this_with_list(GList **list, GList *addition);
 475 
 476 G_GNUC_INTERNAL
 477 void pcmk__add_with_this(GList **list, const pcmk__colocation_t *colocation);
 478 
 479 G_GNUC_INTERNAL
 480 void pcmk__add_with_this_list(GList **list, GList *addition);
 481 
 482 G_GNUC_INTERNAL
 483 void pcmk__new_colocation(const char *id, const char *node_attr, int score,
 484                           pe_resource_t *dependent, pe_resource_t *primary,
 485                           const char *dependent_role, const char *primary_role,
 486                           bool influence, pe_working_set_t *data_set);
 487 
 488 G_GNUC_INTERNAL
 489 void pcmk__block_colocation_dependents(pe_action_t *action,
 490                                        pe_working_set_t *data_set);
 491 
 492 /*!
 493  * \internal
 494  * \brief Check whether colocation's dependent preferences should be considered
 495  *
 496  * \param[in] colocation  Colocation constraint
 497  * \param[in] rsc         Primary instance (normally this will be
 498  *                        colocation->primary, which NULL will be treated as,
 499  *                        but for clones or bundles with multiple instances
 500  *                        this can be a particular instance)
 501  *
 502  * \return true if colocation influence should be effective, otherwise false
 503  */
 504 static inline bool
 505 pcmk__colocation_has_influence(const pcmk__colocation_t *colocation,
     /* [previous][next][first][last][top][bottom][index][help] */
 506                                const pe_resource_t *rsc)
 507 {
 508     if (rsc == NULL) {
 509         rsc = colocation->primary;
 510     }
 511 
 512     /* A bundle replica colocates its remote connection with its container,
 513      * using a finite score so that the container can run on Pacemaker Remote
 514      * nodes.
 515      *
 516      * Moving a connection is lightweight and does not interrupt the service,
 517      * while moving a container is heavyweight and does interrupt the service,
 518      * so don't move a clean, active container based solely on the preferences
 519      * of its connection.
 520      *
 521      * This also avoids problematic scenarios where two containers want to
 522      * perpetually swap places.
 523      */
 524     if (pcmk_is_set(colocation->dependent->flags, pe_rsc_allow_remote_remotes)
 525         && !pcmk_is_set(rsc->flags, pe_rsc_failed)
 526         && pcmk__list_of_1(rsc->running_on)) {
 527         return false;
 528     }
 529 
 530     /* The dependent in a colocation influences the primary's location
 531      * if the influence option is true or the primary is not yet active.
 532      */
 533     return colocation->influence || (rsc->running_on == NULL);
 534 }
 535 
 536 
 537 // Ordering constraints (pcmk_sched_ordering.c)
 538 
 539 G_GNUC_INTERNAL
 540 void pcmk__new_ordering(pe_resource_t *first_rsc, char *first_task,
 541                         pe_action_t *first_action, pe_resource_t *then_rsc,
 542                         char *then_task, pe_action_t *then_action,
 543                         uint32_t flags, pe_working_set_t *data_set);
 544 
 545 G_GNUC_INTERNAL
 546 void pcmk__unpack_ordering(xmlNode *xml_obj, pe_working_set_t *data_set);
 547 
 548 G_GNUC_INTERNAL
 549 void pcmk__disable_invalid_orderings(pe_working_set_t *data_set);
 550 
 551 G_GNUC_INTERNAL
 552 void pcmk__order_stops_before_shutdown(pe_node_t *node,
 553                                        pe_action_t *shutdown_op);
 554 
 555 G_GNUC_INTERNAL
 556 void pcmk__apply_orderings(pe_working_set_t *data_set);
 557 
 558 G_GNUC_INTERNAL
 559 void pcmk__order_after_each(pe_action_t *after, GList *list);
 560 
 561 
 562 /*!
 563  * \internal
 564  * \brief Create a new ordering between two resource actions
 565  *
 566  * \param[in,out] first_rsc   Resource for 'first' action
 567  * \param[in,out] first_task  Action key for 'first' action
 568  * \param[in]     then_rsc    Resource for 'then' action
 569  * \param[in,out] then_task   Action key for 'then' action
 570  * \param[in]     flags       Bitmask of enum pe_ordering flags
 571  */
 572 #define pcmk__order_resource_actions(first_rsc, first_task,                 \
 573                                      then_rsc, then_task, flags)            \
 574     pcmk__new_ordering((first_rsc),                                         \
 575                        pcmk__op_key((first_rsc)->id, (first_task), 0),      \
 576                        NULL,                                                \
 577                        (then_rsc),                                          \
 578                        pcmk__op_key((then_rsc)->id, (then_task), 0),        \
 579                        NULL, (flags), (first_rsc)->cluster)
 580 
 581 #define pcmk__order_starts(rsc1, rsc2, flags)                \
 582     pcmk__order_resource_actions((rsc1), CRMD_ACTION_START,  \
 583                                  (rsc2), CRMD_ACTION_START, (flags))
 584 
 585 #define pcmk__order_stops(rsc1, rsc2, flags)                 \
 586     pcmk__order_resource_actions((rsc1), CRMD_ACTION_STOP,   \
 587                                  (rsc2), CRMD_ACTION_STOP, (flags))
 588 
 589 
 590 // Ticket constraints (pcmk_sched_tickets.c)
 591 
 592 G_GNUC_INTERNAL
 593 void pcmk__unpack_rsc_ticket(xmlNode *xml_obj, pe_working_set_t *data_set);
 594 
 595 
 596 // Promotable clone resources (pcmk_sched_promotable.c)
 597 
 598 G_GNUC_INTERNAL
 599 void pcmk__add_promotion_scores(pe_resource_t *rsc);
 600 
 601 G_GNUC_INTERNAL
 602 void pcmk__require_promotion_tickets(pe_resource_t *rsc);
 603 
 604 G_GNUC_INTERNAL
 605 void pcmk__set_instance_roles(pe_resource_t *rsc);
 606 
 607 G_GNUC_INTERNAL
 608 void pcmk__create_promotable_actions(pe_resource_t *clone);
 609 
 610 G_GNUC_INTERNAL
 611 void pcmk__promotable_restart_ordering(pe_resource_t *rsc);
 612 
 613 G_GNUC_INTERNAL
 614 void pcmk__order_promotable_instances(pe_resource_t *clone);
 615 
 616 G_GNUC_INTERNAL
 617 void pcmk__update_dependent_with_promotable(const pe_resource_t *primary,
 618                                             pe_resource_t *dependent,
 619                                             const pcmk__colocation_t *colocation);
 620 
 621 G_GNUC_INTERNAL
 622 void pcmk__update_promotable_dependent_priority(const pe_resource_t *primary,
 623                                                 pe_resource_t *dependent,
 624                                                 const pcmk__colocation_t *colocation);
 625 
 626 
 627 // Pacemaker Remote nodes (pcmk_sched_remote.c)
 628 
 629 G_GNUC_INTERNAL
 630 bool pcmk__is_failed_remote_node(const pe_node_t *node);
 631 
 632 G_GNUC_INTERNAL
 633 void pcmk__order_remote_connection_actions(pe_working_set_t *data_set);
 634 
 635 G_GNUC_INTERNAL
 636 bool pcmk__rsc_corresponds_to_guest(const pe_resource_t *rsc,
 637                                     const pe_node_t *node);
 638 
 639 G_GNUC_INTERNAL
 640 pe_node_t *pcmk__connection_host_for_action(const pe_action_t *action);
 641 
 642 G_GNUC_INTERNAL
 643 void pcmk__substitute_remote_addr(pe_resource_t *rsc, GHashTable *params);
 644 
 645 G_GNUC_INTERNAL
 646 void pcmk__add_bundle_meta_to_xml(xmlNode *args_xml, const pe_action_t *action);
 647 
 648 
 649 // Primitives (pcmk_sched_primitive.c)
 650 
 651 G_GNUC_INTERNAL
 652 pe_node_t *pcmk__primitive_assign(pe_resource_t *rsc, const pe_node_t *prefer);
 653 
 654 G_GNUC_INTERNAL
 655 void pcmk__primitive_create_actions(pe_resource_t *rsc);
 656 
 657 G_GNUC_INTERNAL
 658 void pcmk__primitive_internal_constraints(pe_resource_t *rsc);
 659 
 660 G_GNUC_INTERNAL
 661 enum pe_action_flags pcmk__primitive_action_flags(pe_action_t *action,
 662                                                   const pe_node_t *node);
 663 
 664 G_GNUC_INTERNAL
 665 void pcmk__primitive_apply_coloc_score(pe_resource_t *dependent,
 666                                        const pe_resource_t *primary,
 667                                        const pcmk__colocation_t *colocation,
 668                                        bool for_dependent);
 669 
 670 G_GNUC_INTERNAL
 671 void pcmk__with_primitive_colocations(const pe_resource_t *rsc,
 672                                       const pe_resource_t *orig_rsc,
 673                                       GList **list);
 674 
 675 G_GNUC_INTERNAL
 676 void pcmk__primitive_with_colocations(const pe_resource_t *rsc,
 677                                       const pe_resource_t *orig_rsc,
 678                                       GList **list);
 679 
 680 G_GNUC_INTERNAL
 681 void pcmk__schedule_cleanup(pe_resource_t *rsc, const pe_node_t *node,
 682                             bool optional);
 683 
 684 G_GNUC_INTERNAL
 685 void pcmk__primitive_add_graph_meta(const pe_resource_t *rsc, xmlNode *xml);
 686 
 687 G_GNUC_INTERNAL
 688 void pcmk__primitive_add_utilization(const pe_resource_t *rsc,
 689                                      const pe_resource_t *orig_rsc,
 690                                      GList *all_rscs, GHashTable *utilization);
 691 
 692 G_GNUC_INTERNAL
 693 void pcmk__primitive_shutdown_lock(pe_resource_t *rsc);
 694 
 695 
 696 // Groups (pcmk_sched_group.c)
 697 
 698 G_GNUC_INTERNAL
 699 pe_node_t *pcmk__group_assign(pe_resource_t *rsc, const pe_node_t *prefer);
 700 
 701 G_GNUC_INTERNAL
 702 void pcmk__group_create_actions(pe_resource_t *rsc);
 703 
 704 G_GNUC_INTERNAL
 705 void pcmk__group_internal_constraints(pe_resource_t *rsc);
 706 
 707 G_GNUC_INTERNAL
 708 void pcmk__group_apply_coloc_score(pe_resource_t *dependent,
 709                                    const pe_resource_t *primary,
 710                                    const pcmk__colocation_t *colocation,
 711                                    bool for_dependent);
 712 
 713 G_GNUC_INTERNAL
 714 void pcmk__with_group_colocations(const pe_resource_t *rsc,
 715                                   const pe_resource_t *orig_rsc, GList **list);
 716 
 717 G_GNUC_INTERNAL
 718 void pcmk__group_with_colocations(const pe_resource_t *rsc,
 719                                   const pe_resource_t *orig_rsc, GList **list);
 720 
 721 G_GNUC_INTERNAL
 722 void pcmk__group_add_colocated_node_scores(pe_resource_t *rsc,
 723                                            const char *log_id,
 724                                            GHashTable **nodes, const char *attr,
 725                                            float factor, uint32_t flags);
 726 
 727 G_GNUC_INTERNAL
 728 void pcmk__group_apply_location(pe_resource_t *rsc, pe__location_t *location);
 729 
 730 G_GNUC_INTERNAL
 731 enum pe_action_flags pcmk__group_action_flags(pe_action_t *action,
 732                                               const pe_node_t *node);
 733 
 734 G_GNUC_INTERNAL
 735 uint32_t pcmk__group_update_ordered_actions(pe_action_t *first,
 736                                             pe_action_t *then,
 737                                             const pe_node_t *node,
 738                                             uint32_t flags, uint32_t filter,
 739                                             uint32_t type,
 740                                             pe_working_set_t *data_set);
 741 
 742 G_GNUC_INTERNAL
 743 GList *pcmk__group_colocated_resources(const pe_resource_t *rsc,
 744                                        const pe_resource_t *orig_rsc,
 745                                        GList *colocated_rscs);
 746 
 747 G_GNUC_INTERNAL
 748 void pcmk__group_add_utilization(const pe_resource_t *rsc,
 749                                  const pe_resource_t *orig_rsc, GList *all_rscs,
 750                                  GHashTable *utilization);
 751 
 752 G_GNUC_INTERNAL
 753 void pcmk__group_shutdown_lock(pe_resource_t *rsc);
 754 
 755 
 756 // Clones (pcmk_sched_clone.c)
 757 
 758 G_GNUC_INTERNAL
 759 pe_node_t *pcmk__clone_assign(pe_resource_t *rsc, const pe_node_t *prefer);
 760 
 761 G_GNUC_INTERNAL
 762 void pcmk__clone_apply_coloc_score(pe_resource_t *dependent,
 763                                    const pe_resource_t *primary,
 764                                    const pcmk__colocation_t *colocation,
 765                                    bool for_dependent);
 766 
 767 G_GNUC_INTERNAL
 768 void pcmk__with_clone_colocations(const pe_resource_t *rsc,
 769                                   const pe_resource_t *orig_rsc, GList **list);
 770 
 771 G_GNUC_INTERNAL
 772 void pcmk__clone_with_colocations(const pe_resource_t *rsc,
 773                                   const pe_resource_t *orig_rsc, GList **list);
 774 
 775 // Bundles (pcmk_sched_bundle.c)
 776 
 777 G_GNUC_INTERNAL
 778 const pe_resource_t *pcmk__get_rsc_in_container(const pe_resource_t *instance);
 779 
 780 G_GNUC_INTERNAL
 781 void pcmk__bundle_apply_coloc_score(pe_resource_t *dependent,
 782                                     const pe_resource_t *primary,
 783                                     const pcmk__colocation_t *colocation,
 784                                     bool for_dependent);
 785 
 786 G_GNUC_INTERNAL
 787 void pcmk__with_bundle_colocations(const pe_resource_t *rsc,
 788                                    const pe_resource_t *orig_rsc, GList **list);
 789 
 790 G_GNUC_INTERNAL
 791 void pcmk__bundle_with_colocations(const pe_resource_t *rsc,
 792                                    const pe_resource_t *orig_rsc, GList **list);
 793 
 794 G_GNUC_INTERNAL
 795 void pcmk__output_bundle_actions(pe_resource_t *rsc);
 796 
 797 
 798 // Clone instances or bundle replica containers (pcmk_sched_instances.c)
 799 
 800 G_GNUC_INTERNAL
 801 void pcmk__assign_instances(pe_resource_t *collective, GList *instances,
 802                             int max_total, int max_per_node);
 803 
 804 G_GNUC_INTERNAL
 805 void pcmk__create_instance_actions(pe_resource_t *rsc, GList *instances);
 806 
 807 G_GNUC_INTERNAL
 808 bool pcmk__instance_matches(const pe_resource_t *instance,
 809                             const pe_node_t *node, enum rsc_role_e role,
 810                             bool current);
 811 
 812 G_GNUC_INTERNAL
 813 pe_resource_t *pcmk__find_compatible_instance(const pe_resource_t *match_rsc,
 814                                               const pe_resource_t *rsc,
 815                                               enum rsc_role_e role,
 816                                               bool current);
 817 
 818 G_GNUC_INTERNAL
 819 uint32_t pcmk__instance_update_ordered_actions(pe_action_t *first,
 820                                                pe_action_t *then,
 821                                                const pe_node_t *node,
 822                                                uint32_t flags, uint32_t filter,
 823                                                uint32_t type,
 824                                                pe_working_set_t *data_set);
 825 
 826 G_GNUC_INTERNAL
 827 enum pe_action_flags pcmk__collective_action_flags(pe_action_t *action,
 828                                                    const GList *instances,
 829                                                    const pe_node_t *node);
 830 
 831 G_GNUC_INTERNAL
 832 void pcmk__add_collective_constraints(GList **list,
 833                                       const pe_resource_t *instance,
 834                                       const pe_resource_t *collective,
 835                                       bool with_this);
 836 
 837 
 838 // Injections (pcmk_injections.c)
 839 
 840 G_GNUC_INTERNAL
 841 xmlNode *pcmk__inject_node(cib_t *cib_conn, const char *node, const char *uuid);
 842 
 843 G_GNUC_INTERNAL
 844 xmlNode *pcmk__inject_node_state_change(cib_t *cib_conn, const char *node,
 845                                         bool up);
 846 
 847 G_GNUC_INTERNAL
 848 xmlNode *pcmk__inject_resource_history(pcmk__output_t *out, xmlNode *cib_node,
 849                                        const char *resource,
 850                                        const char *lrm_name,
 851                                        const char *rclass,
 852                                        const char *rtype,
 853                                        const char *rprovider);
 854 
 855 G_GNUC_INTERNAL
 856 void pcmk__inject_failcount(pcmk__output_t *out, xmlNode *cib_node,
 857                             const char *resource, const char *task,
 858                             guint interval_ms, int rc);
 859 
 860 G_GNUC_INTERNAL
 861 xmlNode *pcmk__inject_action_result(xmlNode *cib_resource,
 862                                     lrmd_event_data_t *op, int target_rc);
 863 
 864 
 865 // Nodes (pcmk_sched_nodes.c)
 866 
 867 G_GNUC_INTERNAL
 868 bool pcmk__node_available(const pe_node_t *node, bool consider_score,
 869                           bool consider_guest);
 870 
 871 G_GNUC_INTERNAL
 872 bool pcmk__any_node_available(GHashTable *nodes);
 873 
 874 G_GNUC_INTERNAL
 875 GHashTable *pcmk__copy_node_table(GHashTable *nodes);
 876 
 877 G_GNUC_INTERNAL
 878 GList *pcmk__sort_nodes(GList *nodes, pe_node_t *active_node);
 879 
 880 G_GNUC_INTERNAL
 881 void pcmk__apply_node_health(pe_working_set_t *data_set);
 882 
 883 G_GNUC_INTERNAL
 884 pe_node_t *pcmk__top_allowed_node(const pe_resource_t *rsc,
 885                                   const pe_node_t *node);
 886 
 887 
 888 // Functions applying to more than one variant (pcmk_sched_resource.c)
 889 
 890 G_GNUC_INTERNAL
 891 void pcmk__set_allocation_methods(pe_working_set_t *data_set);
 892 
 893 G_GNUC_INTERNAL
 894 bool pcmk__rsc_agent_changed(pe_resource_t *rsc, pe_node_t *node,
 895                              const xmlNode *rsc_entry, bool active_on_node);
 896 
 897 G_GNUC_INTERNAL
 898 GList *pcmk__rscs_matching_id(const char *id, const pe_working_set_t *data_set);
 899 
 900 G_GNUC_INTERNAL
 901 GList *pcmk__colocated_resources(const pe_resource_t *rsc,
 902                                  const pe_resource_t *orig_rsc,
 903                                  GList *colocated_rscs);
 904 
 905 G_GNUC_INTERNAL
 906 void pcmk__noop_add_graph_meta(const pe_resource_t *rsc, xmlNode *xml);
 907 
 908 G_GNUC_INTERNAL
 909 void pcmk__output_resource_actions(pe_resource_t *rsc);
 910 
 911 G_GNUC_INTERNAL
 912 bool pcmk__finalize_assignment(pe_resource_t *rsc, pe_node_t *chosen,
 913                                bool force);
 914 
 915 G_GNUC_INTERNAL
 916 bool pcmk__assign_resource(pe_resource_t *rsc, pe_node_t *node, bool force);
 917 
 918 G_GNUC_INTERNAL
 919 void pcmk__unassign_resource(pe_resource_t *rsc);
 920 
 921 G_GNUC_INTERNAL
 922 bool pcmk__threshold_reached(pe_resource_t *rsc, const pe_node_t *node,
 923                              pe_resource_t **failed);
 924 
 925 G_GNUC_INTERNAL
 926 void pcmk__sort_resources(pe_working_set_t *data_set);
 927 
 928 G_GNUC_INTERNAL
 929 gint pcmk__cmp_instance(gconstpointer a, gconstpointer b);
 930 
 931 G_GNUC_INTERNAL
 932 gint pcmk__cmp_instance_number(gconstpointer a, gconstpointer b);
 933 
 934 
 935 // Functions related to probes (pcmk_sched_probes.c)
 936 
 937 G_GNUC_INTERNAL
 938 bool pcmk__probe_rsc_on_node(pe_resource_t *rsc, pe_node_t *node);
 939 
 940 G_GNUC_INTERNAL
 941 void pcmk__order_probes(pe_working_set_t *data_set);
 942 
 943 G_GNUC_INTERNAL
 944 bool pcmk__probe_resource_list(GList *rscs, pe_node_t *node);
 945 
 946 G_GNUC_INTERNAL
 947 void pcmk__schedule_probes(pe_working_set_t *data_set);
 948 
 949 
 950 // Functions related to live migration (pcmk_sched_migration.c)
 951 
 952 void pcmk__create_migration_actions(pe_resource_t *rsc,
 953                                     const pe_node_t *current);
 954 
 955 void pcmk__abort_dangling_migration(void *data, void *user_data);
 956 
 957 bool pcmk__rsc_can_migrate(const pe_resource_t *rsc, const pe_node_t *current);
 958 
 959 void pcmk__order_migration_equivalents(pe__ordering_t *order);
 960 
 961 
 962 // Functions related to node utilization (pcmk_sched_utilization.c)
 963 
 964 G_GNUC_INTERNAL
 965 int pcmk__compare_node_capacities(const pe_node_t *node1,
 966                                   const pe_node_t *node2);
 967 
 968 G_GNUC_INTERNAL
 969 void pcmk__consume_node_capacity(GHashTable *current_utilization,
 970                                  const pe_resource_t *rsc);
 971 
 972 G_GNUC_INTERNAL
 973 void pcmk__release_node_capacity(GHashTable *current_utilization,
 974                                  const pe_resource_t *rsc);
 975 
 976 G_GNUC_INTERNAL
 977 const pe_node_t *pcmk__ban_insufficient_capacity(pe_resource_t *rsc);
 978 
 979 G_GNUC_INTERNAL
 980 void pcmk__create_utilization_constraints(pe_resource_t *rsc,
 981                                           const GList *allowed_nodes);
 982 
 983 G_GNUC_INTERNAL
 984 void pcmk__show_node_capacities(const char *desc, pe_working_set_t *data_set);
 985 
 986 #endif // PCMK__LIBPACEMAKER_PRIVATE__H

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