root/lib/pacemaker/libpacemaker_private.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2021-2022 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 // Actions (pcmk_sched_actions.c)
  20 
  21 G_GNUC_INTERNAL
  22 void pcmk__update_action_for_orderings(pe_action_t *action,
  23                                        pe_working_set_t *data_set);
  24 
  25 G_GNUC_INTERNAL
  26 void pcmk__log_action(const char *pre_text, pe_action_t *action, bool details);
  27 
  28 G_GNUC_INTERNAL
  29 pe_action_t *pcmk__new_rsc_pseudo_action(pe_resource_t *rsc, const char *task,
  30                                          bool optional, bool runnable);
  31 
  32 G_GNUC_INTERNAL
  33 pe_action_t *pcmk__new_cancel_action(pe_resource_t *rsc, const char *name,
  34                                      guint interval_ms, pe_node_t *node);
  35 
  36 G_GNUC_INTERNAL
  37 pe_action_t *pcmk__new_shutdown_action(pe_node_t *node,
  38                                        pe_working_set_t *data_set);
  39 
  40 G_GNUC_INTERNAL
  41 bool pcmk__action_locks_rsc_to_node(const pe_action_t *action);
  42 
  43 G_GNUC_INTERNAL
  44 void pcmk__deduplicate_action_inputs(pe_action_t *action);
  45 
  46 G_GNUC_INTERNAL
  47 void pcmk__output_actions(pe_working_set_t *data_set);
  48 
  49 G_GNUC_INTERNAL
  50 bool pcmk__check_action_config(pe_resource_t *rsc, pe_node_t *node,
  51                                xmlNode *xml_op);
  52 
  53 G_GNUC_INTERNAL
  54 void pcmk__handle_rsc_config_changes(pe_working_set_t *data_set);
  55 
  56 // Producing transition graphs (pcmk_graph_producer.c)
  57 
  58 G_GNUC_INTERNAL
  59 bool pcmk__graph_has_loop(pe_action_t *init_action, pe_action_t *action,
  60                           pe_action_wrapper_t *input);
  61 
  62 G_GNUC_INTERNAL
  63 void pcmk__add_action_to_graph(pe_action_t *action, pe_working_set_t *data_set);
  64 
  65 G_GNUC_INTERNAL
  66 void pcmk__create_graph(pe_working_set_t *data_set);
  67 
  68 
  69 // Fencing (pcmk_sched_fencing.c)
  70 
  71 G_GNUC_INTERNAL
  72 void pcmk__order_vs_fence(pe_action_t *stonith_op, pe_working_set_t *data_set);
  73 
  74 G_GNUC_INTERNAL
  75 void pcmk__order_vs_unfence(pe_resource_t *rsc, pe_node_t *node,
  76                             pe_action_t *action, enum pe_ordering order,
  77                             pe_working_set_t *data_set);
  78 
  79 G_GNUC_INTERNAL
  80 void pcmk__fence_guest(pe_node_t *node, pe_working_set_t *data_set);
  81 
  82 G_GNUC_INTERNAL
  83 bool pcmk__node_unfenced(pe_node_t *node);
  84 
  85 G_GNUC_INTERNAL
  86 bool pcmk__is_unfence_device(const pe_resource_t *rsc,
  87                              const pe_working_set_t *data_set);
  88 
  89 
  90 // Injected scheduler inputs (pcmk_sched_injections.c)
  91 
  92 void pcmk__inject_scheduler_input(pe_working_set_t *data_set, cib_t *cib,
  93                                   pcmk_injections_t *injections);
  94 
  95 
  96 // Constraints of any type (pcmk_sched_constraints.c)
  97 
  98 G_GNUC_INTERNAL
  99 pe_resource_t *pcmk__find_constraint_resource(GList *rsc_list, const char *id);
 100 
 101 G_GNUC_INTERNAL
 102 xmlNode *pcmk__expand_tags_in_sets(xmlNode *xml_obj,
 103                                    pe_working_set_t *data_set);
 104 
 105 G_GNUC_INTERNAL
 106 bool pcmk__valid_resource_or_tag(pe_working_set_t *data_set, const char *id,
 107                                  pe_resource_t **rsc, pe_tag_t **tag);
 108 
 109 G_GNUC_INTERNAL
 110 bool pcmk__tag_to_set(xmlNode *xml_obj, xmlNode **rsc_set, const char *attr,
 111                       bool convert_rsc, pe_working_set_t *data_set);
 112 
 113 G_GNUC_INTERNAL
 114 void pcmk__create_internal_constraints(pe_working_set_t *data_set);
 115 
 116 
 117 // Location constraints
 118 
 119 G_GNUC_INTERNAL
 120 void pcmk__unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set);
 121 
 122 G_GNUC_INTERNAL
 123 pe__location_t *pcmk__new_location(const char *id, pe_resource_t *rsc,
 124                                    int node_weight, const char *discover_mode,
 125                                    pe_node_t *foo_node,
 126                                    pe_working_set_t *data_set);
 127 
 128 G_GNUC_INTERNAL
 129 void pcmk__apply_locations(pe_working_set_t *data_set);
 130 
 131 G_GNUC_INTERNAL
 132 void pcmk__apply_location(pe__location_t *constraint, pe_resource_t *rsc);
 133 
 134 
 135 // Colocation constraints
 136 
 137 enum pcmk__coloc_affects {
 138     pcmk__coloc_affects_nothing = 0,
 139     pcmk__coloc_affects_location,
 140     pcmk__coloc_affects_role,
 141 };
 142 
 143 G_GNUC_INTERNAL
 144 enum pcmk__coloc_affects pcmk__colocation_affects(pe_resource_t *dependent,
 145                                                   pe_resource_t *primary,
 146                                                   pcmk__colocation_t *constraint,
 147                                                   bool preview);
 148 
 149 G_GNUC_INTERNAL
 150 void pcmk__apply_coloc_to_weights(pe_resource_t *dependent,
 151                                   pe_resource_t *primary,
 152                                   pcmk__colocation_t *constraint);
 153 
 154 G_GNUC_INTERNAL
 155 void pcmk__apply_coloc_to_priority(pe_resource_t *dependent,
 156                                    pe_resource_t *primary,
 157                                    pcmk__colocation_t *constraint);
 158 
 159 G_GNUC_INTERNAL
 160 void pcmk__unpack_colocation(xmlNode *xml_obj, pe_working_set_t *data_set);
 161 
 162 G_GNUC_INTERNAL
 163 void pcmk__new_colocation(const char *id, const char *node_attr, int score,
 164                           pe_resource_t *dependent, pe_resource_t *primary,
 165                           const char *dependent_role, const char *primary_role,
 166                           bool influence, pe_working_set_t *data_set);
 167 
 168 G_GNUC_INTERNAL
 169 void pcmk__block_colocated_starts(pe_action_t *action,
 170                                   pe_working_set_t *data_set);
 171 
 172 
 173 // Ordering constraints (pcmk_sched_ordering.c)
 174 
 175 G_GNUC_INTERNAL
 176 void pcmk__new_ordering(pe_resource_t *lh_rsc, char *lh_task,
 177                         pe_action_t *lh_action, pe_resource_t *rh_rsc,
 178                         char *rh_task, pe_action_t *rh_action,
 179                         enum pe_ordering type, pe_working_set_t *data_set);
 180 
 181 G_GNUC_INTERNAL
 182 void pcmk__unpack_ordering(xmlNode *xml_obj, pe_working_set_t *data_set);
 183 
 184 G_GNUC_INTERNAL
 185 void pcmk__disable_invalid_orderings(pe_working_set_t *data_set);
 186 
 187 G_GNUC_INTERNAL
 188 void pcmk__order_stops_before_shutdown(pe_node_t *node,
 189                                        pe_action_t *shutdown_op,
 190                                        pe_working_set_t *data_set);
 191 
 192 G_GNUC_INTERNAL
 193 void pcmk__apply_orderings(pe_working_set_t *data_set);
 194 
 195 G_GNUC_INTERNAL
 196 void pcmk__order_after_each(pe_action_t *after, GList *list);
 197 
 198 
 199 /*!
 200  * \internal
 201  * \brief Create a new ordering between two resource actions
 202  *
 203  * \param[in] lh_rsc    Resource for 'first' action
 204  * \param[in] rh_rsc    Resource for 'then' action
 205  * \param[in] lh_task   Action key for 'first' action
 206  * \param[in] rh_task   Action key for 'then' action
 207  * \param[in] flags     Bitmask of enum pe_ordering flags
 208  * \param[in] data_set  Cluster working set to add ordering to
 209  */
 210 #define pcmk__order_resource_actions(lh_rsc, lh_task, rh_rsc, rh_task,      \
 211                                      flags, data_set)                       \
 212     pcmk__new_ordering((lh_rsc), pcmk__op_key((lh_rsc)->id, (lh_task), 0),  \
 213                        NULL,                                                \
 214                        (rh_rsc), pcmk__op_key((rh_rsc)->id, (rh_task), 0),  \
 215                        NULL, (flags), (data_set))
 216 
 217 #define pcmk__order_starts(rsc1, rsc2, type, data_set)       \
 218     pcmk__order_resource_actions((rsc1), CRMD_ACTION_START,  \
 219                                  (rsc2), CRMD_ACTION_START, (type), (data_set))
 220 
 221 #define pcmk__order_stops(rsc1, rsc2, type, data_set)        \
 222     pcmk__order_resource_actions((rsc1), CRMD_ACTION_STOP,   \
 223                                  (rsc2), CRMD_ACTION_STOP, (type), (data_set))
 224 
 225 G_GNUC_INTERNAL
 226 void pcmk__unpack_rsc_ticket(xmlNode *xml_obj, pe_working_set_t *data_set);
 227 
 228 G_GNUC_INTERNAL
 229 bool pcmk__is_failed_remote_node(pe_node_t *node);
 230 
 231 G_GNUC_INTERNAL
 232 void pcmk__order_remote_connection_actions(pe_working_set_t *data_set);
 233 
 234 G_GNUC_INTERNAL
 235 bool pcmk__rsc_corresponds_to_guest(pe_resource_t *rsc, pe_node_t *node);
 236 
 237 G_GNUC_INTERNAL
 238 pe_node_t *pcmk__connection_host_for_action(pe_action_t *action);
 239 
 240 G_GNUC_INTERNAL
 241 void pcmk__substitute_remote_addr(pe_resource_t *rsc, GHashTable *params,
 242                                   pe_working_set_t *data_set);
 243 
 244 G_GNUC_INTERNAL
 245 void pcmk__add_bundle_meta_to_xml(xmlNode *args_xml, pe_action_t *action);
 246 
 247 
 248 // Groups (pcmk_sched_group.c)
 249 
 250 G_GNUC_INTERNAL
 251 GList *pcmk__group_colocated_resources(pe_resource_t *rsc,
 252                                        pe_resource_t *orig_rsc,
 253                                        GList *colocated_rscs);
 254 
 255 
 256 // Bundles (pcmk_sched_bundle.c)
 257 
 258 G_GNUC_INTERNAL
 259 void pcmk__output_bundle_actions(pe_resource_t *rsc);
 260 
 261 
 262 // Injections (pcmk_injections.c)
 263 
 264 G_GNUC_INTERNAL
 265 xmlNode *pcmk__inject_node(cib_t *cib_conn, const char *node, const char *uuid);
 266 
 267 G_GNUC_INTERNAL
 268 xmlNode *pcmk__inject_node_state_change(cib_t *cib_conn, const char *node,
 269                                         bool up);
 270 
 271 G_GNUC_INTERNAL
 272 xmlNode *pcmk__inject_resource_history(pcmk__output_t *out, xmlNode *cib_node,
 273                                        const char *resource,
 274                                        const char *lrm_name,
 275                                        const char *rclass,
 276                                        const char *rtype,
 277                                        const char *rprovider);
 278 
 279 G_GNUC_INTERNAL
 280 void pcmk__inject_failcount(pcmk__output_t *out, xmlNode *cib_node,
 281                             const char *resource, const char *task,
 282                             guint interval_ms, int rc);
 283 
 284 G_GNUC_INTERNAL
 285 xmlNode *pcmk__inject_action_result(xmlNode *cib_resource,
 286                                     lrmd_event_data_t *op, int target_rc);
 287 
 288 
 289 // Nodes (pcmk_sched_nodes.c)
 290 
 291 G_GNUC_INTERNAL
 292 bool pcmk__node_available(const pe_node_t *node);
 293 
 294 G_GNUC_INTERNAL
 295 bool pcmk__any_node_available(GHashTable *nodes);
 296 
 297 G_GNUC_INTERNAL
 298 GHashTable *pcmk__copy_node_table(GHashTable *nodes);
 299 
 300 G_GNUC_INTERNAL
 301 GList *pcmk__sort_nodes(GList *nodes, pe_node_t *active_node,
 302                         pe_working_set_t *data_set);
 303 
 304 G_GNUC_INTERNAL
 305 void pcmk__apply_node_health(pe_working_set_t *data_set);
 306 
 307 
 308 // Clone notifictions (pcmk_sched_notif.c)
 309 
 310 G_GNUC_INTERNAL
 311 void pcmk__create_notifications(pe_resource_t *rsc, notify_data_t *n_data);
 312 
 313 G_GNUC_INTERNAL
 314 notify_data_t *pcmk__clone_notif_pseudo_ops(pe_resource_t *rsc,
 315                                             const char *task,
 316                                             pe_action_t *action,
 317                                             pe_action_t *complete);
 318 
 319 G_GNUC_INTERNAL
 320 void pcmk__free_notification_data(notify_data_t *n_data);
 321 
 322 G_GNUC_INTERNAL
 323 void pcmk__order_notifs_after_fencing(pe_action_t *action, pe_resource_t *rsc,
 324                                       pe_action_t *stonith_op);
 325 
 326 
 327 // Functions applying to more than one variant (pcmk_sched_resource.c)
 328 
 329 G_GNUC_INTERNAL
 330 void pcmk__set_allocation_methods(pe_working_set_t *data_set);
 331 
 332 G_GNUC_INTERNAL
 333 bool pcmk__rsc_agent_changed(pe_resource_t *rsc, pe_node_t *node,
 334                              const xmlNode *rsc_entry, bool active_on_node);
 335 
 336 G_GNUC_INTERNAL
 337 GList *pcmk__rscs_matching_id(const char *id, pe_working_set_t *data_set);
 338 
 339 G_GNUC_INTERNAL
 340 GList *pcmk__colocated_resources(pe_resource_t *rsc, pe_resource_t *orig_rsc,
 341                                  GList *colocated_rscs);
 342 
 343 G_GNUC_INTERNAL
 344 void pcmk__output_resource_actions(pe_resource_t *rsc);
 345 
 346 G_GNUC_INTERNAL
 347 bool pcmk__assign_primitive(pe_resource_t *rsc, pe_node_t *chosen, bool force);
 348 
 349 G_GNUC_INTERNAL
 350 bool pcmk__assign_resource(pe_resource_t *rsc, pe_node_t *node, bool force);
 351 
 352 G_GNUC_INTERNAL
 353 void pcmk__unassign_resource(pe_resource_t *rsc);
 354 
 355 G_GNUC_INTERNAL
 356 bool pcmk__threshold_reached(pe_resource_t *rsc, pe_node_t *node,
 357                              pe_resource_t **failed);
 358 
 359 G_GNUC_INTERNAL
 360 void pcmk__sort_resources(pe_working_set_t *data_set);
 361 
 362 
 363 // Functions related to probes (pcmk_sched_probes.c)
 364 
 365 G_GNUC_INTERNAL
 366 void pcmk__order_probes(pe_working_set_t *data_set);
 367 
 368 G_GNUC_INTERNAL
 369 void pcmk__schedule_probes(pe_working_set_t *data_set);
 370 
 371 
 372 // Functions related to node utilization (pcmk_sched_utilization.c)
 373 
 374 G_GNUC_INTERNAL
 375 int pcmk__compare_node_capacities(const pe_node_t *node1,
 376                                   const pe_node_t *node2);
 377 
 378 G_GNUC_INTERNAL
 379 void pcmk__consume_node_capacity(GHashTable *current_utilization,
 380                                  pe_resource_t *rsc);
 381 
 382 G_GNUC_INTERNAL
 383 void pcmk__release_node_capacity(GHashTable *current_utilization,
 384                                  pe_resource_t *rsc);
 385 
 386 G_GNUC_INTERNAL
 387 void pcmk__ban_insufficient_capacity(pe_resource_t *rsc, pe_node_t **prefer,
 388                                      pe_working_set_t *data_set);
 389 
 390 G_GNUC_INTERNAL
 391 void pcmk__create_utilization_constraints(pe_resource_t *rsc,
 392                                           GList *allowed_nodes);
 393 
 394 G_GNUC_INTERNAL
 395 void pcmk__show_node_capacities(const char *desc, pe_working_set_t *data_set);
 396 
 397 #endif // PCMK__LIBPACEMAKER_PRIVATE__H

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