root/include/pcmki/pcmki_sched_allocate.h

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

INCLUDED FROM


   1 /*
   2  * Copyright 2004-2021 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 SCHED_ALLOCATE__H
  11 #  define 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/pengine/internal.h>
  18 #  include <pcmki/pcmki_scheduler.h>
  19 
  20 struct resource_alloc_functions_s {
  21     GHashTable *(*merge_weights) (pe_resource_t *, const char *, GHashTable *, const char *, float,
  22                                   enum pe_weights);
  23     pe_node_t *(*allocate) (pe_resource_t *, pe_node_t *, pe_working_set_t *);
  24     void (*create_actions) (pe_resource_t *, pe_working_set_t *);
  25      gboolean(*create_probe) (pe_resource_t *, pe_node_t *, pe_action_t *, gboolean, pe_working_set_t *);
  26     void (*internal_constraints) (pe_resource_t *, pe_working_set_t *);
  27 
  28     void (*rsc_colocation_lh) (pe_resource_t *, pe_resource_t *,
  29                                pcmk__colocation_t *, pe_working_set_t *);
  30     void (*rsc_colocation_rh) (pe_resource_t *, pe_resource_t *,
  31                                pcmk__colocation_t *, pe_working_set_t *);
  32 
  33     /*!
  34      * \internal
  35      * \brief Create list of all resources in colocations with a given resource
  36      *
  37      * Given a resource, create a list of all resources involved in mandatory
  38      * colocations with it, whether directly or indirectly via chained colocations.
  39      *
  40      * \param[in] rsc             Resource to add to colocated list
  41      * \param[in] orig_rsc        Resource originally requested
  42      * \param[in] colocated_rscs  Existing list
  43      *
  44      * \return List of given resource and all resources involved in colocations
  45      *
  46      * \note This function is recursive; top-level callers should pass NULL as
  47      *       \p colocated_rscs and \p orig_rsc, and the desired resource as
  48      *       \p rsc. The recursive calls will use other values.
  49      */
  50     GList *(*colocated_resources)(pe_resource_t *rsc, pe_resource_t *orig_rsc,
  51                                   GList *colocated_rscs);
  52 
  53     void (*rsc_location) (pe_resource_t *, pe__location_t *);
  54 
  55     enum pe_action_flags (*action_flags) (pe_action_t *, pe_node_t *);
  56     enum pe_graph_flags (*update_actions) (pe_action_t *, pe_action_t *,
  57                                            pe_node_t *, enum pe_action_flags,
  58                                            enum pe_action_flags,
  59                                            enum pe_ordering,
  60                                            pe_working_set_t *data_set);
  61 
  62     void (*expand) (pe_resource_t *, pe_working_set_t *);
  63     void (*append_meta) (pe_resource_t * rsc, xmlNode * xml);
  64 };
  65 
  66 GHashTable *pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs,
  67                                        GHashTable *nodes, const char *attr,
  68                                        float factor, uint32_t flags);
  69 
  70 GHashTable *pcmk__group_merge_weights(pe_resource_t *rsc, const char *rhs,
  71                                       GHashTable *nodes, const char *attr,
  72                                       float factor, uint32_t flags);
  73 
  74 pe_node_t *pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *preferred,
  75                                  pe_working_set_t *data_set);
  76 extern void native_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
  77 extern void native_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
  78 void native_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary,
  79                               pcmk__colocation_t *constraint,
  80                               pe_working_set_t *data_set);
  81 void native_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
  82                               pcmk__colocation_t *constraint,
  83                               pe_working_set_t *data_set);
  84 extern enum pe_action_flags native_action_flags(pe_action_t * action, pe_node_t * node);
  85 
  86 void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
  87 extern void native_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
  88 extern gboolean native_create_probe(pe_resource_t * rsc, pe_node_t * node, pe_action_t * complete,
  89                                     gboolean force, pe_working_set_t * data_set);
  90 extern void native_append_meta(pe_resource_t * rsc, xmlNode * xml);
  91 
  92 pe_node_t *pcmk__group_allocate(pe_resource_t *rsc, pe_node_t *preferred,
  93                                 pe_working_set_t *data_set);
  94 extern void group_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
  95 extern void group_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
  96 void group_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary,
  97                              pcmk__colocation_t *constraint,
  98                              pe_working_set_t *data_set);
  99 void group_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
 100                              pcmk__colocation_t *constraint,
 101                              pe_working_set_t *data_set);
 102 extern enum pe_action_flags group_action_flags(pe_action_t * action, pe_node_t * node);
 103 void group_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
 104 extern void group_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
 105 extern void group_append_meta(pe_resource_t * rsc, xmlNode * xml);
 106 
 107 pe_node_t *pcmk__bundle_allocate(pe_resource_t *rsc, pe_node_t *preferred,
 108                                  pe_working_set_t *data_set);
 109 void pcmk__bundle_create_actions(pe_resource_t *rsc,
 110                                  pe_working_set_t *data_set);
 111 gboolean pcmk__bundle_create_probe(pe_resource_t *rsc, pe_node_t *node,
 112                                    pe_action_t *complete, gboolean force,
 113                                    pe_working_set_t *data_set);
 114 void pcmk__bundle_internal_constraints(pe_resource_t *rsc,
 115                                        pe_working_set_t *data_set);
 116 void pcmk__bundle_rsc_colocation_lh(pe_resource_t *dependent,
 117                                     pe_resource_t *primary,
 118                                     pcmk__colocation_t *constraint,
 119                                     pe_working_set_t *data_set);
 120 void pcmk__bundle_rsc_colocation_rh(pe_resource_t *dependent,
 121                                     pe_resource_t *primary,
 122                                     pcmk__colocation_t *constraint,
 123                                     pe_working_set_t *data_set);
 124 void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
 125 enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action,
 126                                                pe_node_t *node);
 127 void pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t *data_set);
 128 void pcmk__bundle_append_meta(pe_resource_t *rsc, xmlNode *xml);
 129 
 130 pe_node_t *pcmk__clone_allocate(pe_resource_t *rsc, pe_node_t *preferred,
 131                                 pe_working_set_t *data_set);
 132 extern void clone_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
 133 extern void clone_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
 134 void clone_rsc_colocation_lh(pe_resource_t *dependent, pe_resource_t *primary,
 135                              pcmk__colocation_t *constraint,
 136                              pe_working_set_t *data_set);
 137 void clone_rsc_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
 138                              pcmk__colocation_t *constraint,
 139                              pe_working_set_t *data_set);
 140 void clone_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
 141 extern enum pe_action_flags clone_action_flags(pe_action_t * action, pe_node_t * node);
 142 extern void clone_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
 143 extern gboolean clone_create_probe(pe_resource_t * rsc, pe_node_t * node, pe_action_t * complete,
 144                                    gboolean force, pe_working_set_t * data_set);
 145 extern void clone_append_meta(pe_resource_t * rsc, xmlNode * xml);
 146 
 147 void pcmk__add_promotion_scores(pe_resource_t *rsc);
 148 pe_node_t *pcmk__set_instance_roles(pe_resource_t *rsc,
 149                                     pe_working_set_t *data_set);
 150 void create_promotable_actions(pe_resource_t *rsc, pe_working_set_t *data_set);
 151 void promote_demote_constraints(pe_resource_t *rsc, pe_working_set_t *data_set);
 152 void promotable_constraints(pe_resource_t *rsc, pe_working_set_t *data_set);
 153 void promotable_colocation_rh(pe_resource_t *dependent, pe_resource_t *primary,
 154                               pcmk__colocation_t *constraint,
 155                               pe_working_set_t *data_set);
 156 
 157 /* extern resource_object_functions_t resource_variants[]; */
 158 extern resource_alloc_functions_t resource_class_alloc_functions[];
 159 
 160 void LogNodeActions(pe_working_set_t * data_set);
 161 void LogActions(pe_resource_t * rsc, pe_working_set_t * data_set);
 162 void pcmk__bundle_log_actions(pe_resource_t *rsc, pe_working_set_t *data_set);
 163 
 164 enum pe_graph_flags native_update_actions(pe_action_t *first, pe_action_t *then,
 165                                           pe_node_t *node,
 166                                           enum pe_action_flags flags,
 167                                           enum pe_action_flags filter,
 168                                           enum pe_ordering type,
 169                                           pe_working_set_t *data_set);
 170 enum pe_graph_flags group_update_actions(pe_action_t *first, pe_action_t *then,
 171                                          pe_node_t *node,
 172                                          enum pe_action_flags flags,
 173                                          enum pe_action_flags filter,
 174                                          enum pe_ordering type,
 175                                          pe_working_set_t *data_set);
 176 enum pe_graph_flags pcmk__multi_update_actions(pe_action_t *first,
 177                                                pe_action_t *then,
 178                                                pe_node_t *node,
 179                                                enum pe_action_flags flags,
 180                                                enum pe_action_flags filter,
 181                                                enum pe_ordering type,
 182                                                pe_working_set_t *data_set);
 183 
 184 gboolean update_action(pe_action_t *action, pe_working_set_t *data_set);
 185 void complex_set_cmds(pe_resource_t * rsc);
 186 void pcmk__log_transition_summary(const char *filename);
 187 void clone_create_pseudo_actions(
 188     pe_resource_t * rsc, GList *children, notify_data_t **start_notify, notify_data_t **stop_notify,  pe_working_set_t * data_set);
 189 #endif

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