root/include/pcmki/pcmki_sched_allocate.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2004-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__PCMKI_PCMKI_SCHED_ALLOCATE__H
  11 #  define PCMK__PCMKI_PCMKI_SCHED_ALLOCATE__H
  12 
  13 #  include <glib.h>
  14 #  include <crm/common/xml.h>
  15 #  include <crm/pengine/status.h>
  16 #  include <crm/pengine/complex.h>
  17 #  include <crm/common/xml_internal.h>
  18 #  include <crm/pengine/internal.h>
  19 #  include <crm/common/xml.h>
  20 #  include <pcmki/pcmki_scheduler.h>
  21 
  22 struct resource_alloc_functions_s {
  23     GHashTable *(*merge_weights) (pe_resource_t *, const char *, GHashTable *, const char *, float,
  24                                   enum pe_weights);
  25     pe_node_t *(*allocate) (pe_resource_t *, pe_node_t *, pe_working_set_t *);
  26     void (*create_actions) (pe_resource_t *, pe_working_set_t *);
  27      gboolean(*create_probe) (pe_resource_t *, pe_node_t *, pe_action_t *, gboolean, pe_working_set_t *);
  28     void (*internal_constraints) (pe_resource_t *, pe_working_set_t *);
  29 
  30     void (*rsc_colocation_lh) (pe_resource_t *, pe_resource_t *,
  31                                pcmk__colocation_t *, pe_working_set_t *);
  32     void (*rsc_colocation_rh) (pe_resource_t *, pe_resource_t *,
  33                                pcmk__colocation_t *, pe_working_set_t *);
  34 
  35     /*!
  36      * \internal
  37      * \brief Create list of all resources in colocations with a given resource
  38      *
  39      * Given a resource, create a list of all resources involved in mandatory
  40      * colocations with it, whether directly or indirectly via chained colocations.
  41      *
  42      * \param[in] rsc             Resource to add to colocated list
  43      * \param[in] orig_rsc        Resource originally requested
  44      * \param[in] colocated_rscs  Existing list
  45      *
  46      * \return List of given resource and all resources involved in colocations
  47      *
  48      * \note This function is recursive; top-level callers should pass NULL as
  49      *       \p colocated_rscs and \p orig_rsc, and the desired resource as
  50      *       \p rsc. The recursive calls will use other values.
  51      */
  52     GList *(*colocated_resources)(pe_resource_t *rsc, pe_resource_t *orig_rsc,
  53                                   GList *colocated_rscs);
  54 
  55     void (*rsc_location) (pe_resource_t *, pe__location_t *);
  56 
  57     enum pe_action_flags (*action_flags) (pe_action_t *, pe_node_t *);
  58     enum pe_graph_flags (*update_actions) (pe_action_t *, pe_action_t *,
  59                                            pe_node_t *, enum pe_action_flags,
  60                                            enum pe_action_flags,
  61                                            enum pe_ordering,
  62                                            pe_working_set_t *data_set);
  63     void (*output_actions)(pe_resource_t *rsc);
  64 
  65     void (*expand) (pe_resource_t *, pe_working_set_t *);
  66     void (*append_meta) (pe_resource_t * rsc, xmlNode * xml);
  67 
  68     /*!
  69      * \internal
  70      * \brief Add a resource's utilization to a table of utilization values
  71      *
  72      * This function is used when summing the utilization of a resource and all
  73      * resources colocated with it, to determine whether a node has sufficient
  74      * capacity. Given a resource and a table of utilization values, it will add
  75      * the resource's utilization to the existing values, if the resource has
  76      * not yet been allocated to a node.
  77      *
  78      * \param[in] rsc          Resource with utilization to add
  79      * \param[in] orig_rsc     Resource being allocated (for logging only)
  80      * \param[in] all_rscs     List of all resources that will be summed
  81      * \param[in] utilization  Table of utilization values to add to
  82      */
  83     void (*add_utilization)(pe_resource_t *rsc, pe_resource_t *orig_rsc,
  84                             GList *all_rscs, GHashTable *utilization);
  85 
  86     /*!
  87      * \internal
  88      * \brief Apply a shutdown lock for a resource, if appropriate
  89      *
  90      * \param[in] rsc       Resource to check for shutdown lock
  91      */
  92     void (*shutdown_lock)(pe_resource_t *rsc);
  93 };
  94 
  95 GHashTable *pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs,
  96                                        GHashTable *nodes, const char *attr,
  97                                        float factor, uint32_t flags);
  98 
  99 GHashTable *pcmk__group_merge_weights(pe_resource_t *rsc, const char *rhs,
 100                                       GHashTable *nodes, const char *attr,
 101                                       float factor, uint32_t flags);
 102 
 103 pe_node_t *pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *preferred,
 104                                  pe_working_set_t *data_set);
 105 extern void native_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
 106 extern void native_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
 107 void native_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary,
 108                               pcmk__colocation_t *constraint,
 109                               pe_working_set_t *data_set);
 110 void native_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
 111                               pcmk__colocation_t *constraint,
 112                               pe_working_set_t *data_set);
 113 extern enum pe_action_flags native_action_flags(pe_action_t * action, pe_node_t * node);
 114 
 115 void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
 116 extern void native_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
 117 extern gboolean native_create_probe(pe_resource_t * rsc, pe_node_t * node, pe_action_t * complete,
 118                                     gboolean force, pe_working_set_t * data_set);
 119 extern void native_append_meta(pe_resource_t * rsc, xmlNode * xml);
 120 void pcmk__primitive_add_utilization(pe_resource_t *rsc,
 121                                      pe_resource_t *orig_rsc, GList *all_rscs,
 122                                      GHashTable *utilization);
 123 void pcmk__primitive_shutdown_lock(pe_resource_t *rsc);
 124 
 125 pe_node_t *pcmk__group_allocate(pe_resource_t *rsc, pe_node_t *preferred,
 126                                 pe_working_set_t *data_set);
 127 extern void group_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
 128 extern void group_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
 129 void group_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary,
 130                              pcmk__colocation_t *constraint,
 131                              pe_working_set_t *data_set);
 132 void group_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
 133                              pcmk__colocation_t *constraint,
 134                              pe_working_set_t *data_set);
 135 extern enum pe_action_flags group_action_flags(pe_action_t * action, pe_node_t * node);
 136 void group_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
 137 extern void group_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
 138 extern void group_append_meta(pe_resource_t * rsc, xmlNode * xml);
 139 void pcmk__group_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc,
 140                                  GList *all_rscs, GHashTable *utilization);
 141 void pcmk__group_shutdown_lock(pe_resource_t *rsc);
 142 
 143 pe_node_t *pcmk__bundle_allocate(pe_resource_t *rsc, pe_node_t *preferred,
 144                                  pe_working_set_t *data_set);
 145 void pcmk__bundle_create_actions(pe_resource_t *rsc,
 146                                  pe_working_set_t *data_set);
 147 gboolean pcmk__bundle_create_probe(pe_resource_t *rsc, pe_node_t *node,
 148                                    pe_action_t *complete, gboolean force,
 149                                    pe_working_set_t *data_set);
 150 void pcmk__bundle_internal_constraints(pe_resource_t *rsc,
 151                                        pe_working_set_t *data_set);
 152 void pcmk__bundle_rsc_colocation_lh(pe_resource_t *dependent,
 153                                     pe_resource_t *primary,
 154                                     pcmk__colocation_t *constraint,
 155                                     pe_working_set_t *data_set);
 156 void pcmk__bundle_rsc_colocation_rh(pe_resource_t *dependent,
 157                                     pe_resource_t *primary,
 158                                     pcmk__colocation_t *constraint,
 159                                     pe_working_set_t *data_set);
 160 void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
 161 enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action,
 162                                                pe_node_t *node);
 163 void pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t *data_set);
 164 void pcmk__bundle_append_meta(pe_resource_t *rsc, xmlNode *xml);
 165 void pcmk__bundle_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc,
 166                                   GList *all_rscs, GHashTable *utilization);
 167 void pcmk__bundle_shutdown_lock(pe_resource_t *rsc);
 168 
 169 pe_node_t *pcmk__clone_allocate(pe_resource_t *rsc, pe_node_t *preferred,
 170                                 pe_working_set_t *data_set);
 171 extern void clone_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
 172 extern void clone_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
 173 void clone_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary,
 174                              pcmk__colocation_t *constraint,
 175                              pe_working_set_t *data_set);
 176 void clone_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
 177                              pcmk__colocation_t *constraint,
 178                              pe_working_set_t *data_set);
 179 void clone_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
 180 extern enum pe_action_flags clone_action_flags(pe_action_t * action, pe_node_t * node);
 181 extern void clone_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
 182 extern gboolean clone_create_probe(pe_resource_t * rsc, pe_node_t * node, pe_action_t * complete,
 183                                    gboolean force, pe_working_set_t * data_set);
 184 extern void clone_append_meta(pe_resource_t * rsc, xmlNode * xml);
 185 void pcmk__clone_add_utilization(pe_resource_t *rsc, pe_resource_t *orig_rsc,
 186                                  GList *all_rscs, GHashTable *utilization);
 187 void pcmk__clone_shutdown_lock(pe_resource_t *rsc);
 188 
 189 void pcmk__add_promotion_scores(pe_resource_t *rsc);
 190 pe_node_t *pcmk__set_instance_roles(pe_resource_t *rsc,
 191                                     pe_working_set_t *data_set);
 192 void create_promotable_actions(pe_resource_t *rsc, pe_working_set_t *data_set);
 193 void promote_demote_constraints(pe_resource_t *rsc, pe_working_set_t *data_set);
 194 void promotable_constraints(pe_resource_t *rsc, pe_working_set_t *data_set);
 195 void promotable_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
 196                               pcmk__colocation_t *constraint,
 197                               pe_working_set_t *data_set);
 198 
 199 enum pe_graph_flags native_update_actions(pe_action_t *first, pe_action_t *then,
 200                                           pe_node_t *node,
 201                                           enum pe_action_flags flags,
 202                                           enum pe_action_flags filter,
 203                                           enum pe_ordering type,
 204                                           pe_working_set_t *data_set);
 205 enum pe_graph_flags group_update_actions(pe_action_t *first, pe_action_t *then,
 206                                          pe_node_t *node,
 207                                          enum pe_action_flags flags,
 208                                          enum pe_action_flags filter,
 209                                          enum pe_ordering type,
 210                                          pe_working_set_t *data_set);
 211 enum pe_graph_flags pcmk__multi_update_actions(pe_action_t *first,
 212                                                pe_action_t *then,
 213                                                pe_node_t *node,
 214                                                enum pe_action_flags flags,
 215                                                enum pe_action_flags filter,
 216                                                enum pe_ordering type,
 217                                                pe_working_set_t *data_set);
 218 
 219 void pcmk__log_transition_summary(const char *filename);
 220 void clone_create_pseudo_actions(
 221     pe_resource_t * rsc, GList *children, notify_data_t **start_notify, notify_data_t **stop_notify,  pe_working_set_t * data_set);
 222 #endif

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