root/pengine/allocate.h

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

INCLUDED FROM


   1 /* 
   2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
   3  * 
   4  * This program is free software; you can redistribute it and/or
   5  * modify it under the terms of the GNU Lesser General Public
   6  * License as published by the Free Software Foundation; either
   7  * version 2 of the License, or (at your option) any later version.
   8  * 
   9  * This software is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12  * General Public License for more details.
  13  * 
  14  * You should have received a copy of the GNU Lesser General Public
  15  * License along with this library; if not, write to the Free Software
  16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  17  */
  18 #ifndef CRM_PENGINE_COMPLEX_ALLOC__H
  19 #  define CRM_PENGINE_COMPLEX_ALLOC__H
  20 
  21 #  include <glib.h>
  22 #  include <crm/common/xml.h>
  23 #  include <crm/pengine/status.h>
  24 #  include <crm/pengine/complex.h>
  25 #  include <crm/pengine/internal.h>
  26 #  include <pengine.h>
  27 
  28 struct resource_alloc_functions_s {
  29     GHashTable *(*merge_weights) (resource_t *, const char *, GHashTable *, const char *, float,
  30                                   enum pe_weights);
  31     node_t *(*allocate) (resource_t *, node_t *, pe_working_set_t *);
  32     void (*create_actions) (resource_t *, pe_working_set_t *);
  33      gboolean(*create_probe) (resource_t *, node_t *, action_t *, gboolean, pe_working_set_t *);
  34     void (*internal_constraints) (resource_t *, pe_working_set_t *);
  35 
  36     void (*rsc_colocation_lh) (resource_t *, resource_t *, rsc_colocation_t *);
  37     void (*rsc_colocation_rh) (resource_t *, resource_t *, rsc_colocation_t *);
  38 
  39     void (*rsc_location) (resource_t *, rsc_to_node_t *);
  40 
  41     enum pe_action_flags (*action_flags) (action_t *, node_t *);
  42     enum pe_graph_flags (*update_actions) (action_t *, action_t *, node_t *, enum pe_action_flags,
  43                                            enum pe_action_flags, enum pe_ordering);
  44 
  45     void (*expand) (resource_t *, pe_working_set_t *);
  46     void (*append_meta) (resource_t * rsc, xmlNode * xml);
  47 };
  48 
  49 extern GHashTable *rsc_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
  50                                      const char *attr, float factor, enum pe_weights flags);
  51 
  52 extern GHashTable *clone_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
  53                                        const char *attr, float factor, enum pe_weights flags);
  54 
  55 extern GHashTable *container_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
  56                                        const char *attr, float factor, enum pe_weights flags);
  57 
  58 extern GHashTable *master_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
  59                                         const char *attr, float factor, enum pe_weights flags);
  60 
  61 extern GHashTable *native_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
  62                                         const char *attr, float factor, enum pe_weights flags);
  63 
  64 extern GHashTable *group_merge_weights(resource_t * rsc, const char *rhs, GHashTable * nodes,
  65                                        const char *attr, float factor, enum pe_weights flags);
  66 
  67 extern node_t *native_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
  68 extern void native_create_actions(resource_t * rsc, pe_working_set_t * data_set);
  69 extern void native_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
  70 extern void native_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc,
  71                                      rsc_colocation_t * constraint);
  72 extern void native_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
  73                                      rsc_colocation_t * constraint);
  74 extern void rsc_ticket_constraint(resource_t * lh_rsc, rsc_ticket_t * rsc_ticket,
  75                                   pe_working_set_t * data_set);
  76 extern enum pe_action_flags native_action_flags(action_t * action, node_t * node);
  77 
  78 extern void native_rsc_location(resource_t * rsc, rsc_to_node_t * constraint);
  79 extern void native_expand(resource_t * rsc, pe_working_set_t * data_set);
  80 extern void native_dump(resource_t * rsc, const char *pre_text, gboolean details);
  81 extern gboolean native_create_probe(resource_t * rsc, node_t * node, action_t * complete,
  82                                     gboolean force, pe_working_set_t * data_set);
  83 extern void native_append_meta(resource_t * rsc, xmlNode * xml);
  84 
  85 extern int group_num_allowed_nodes(resource_t * rsc);
  86 extern node_t *group_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
  87 extern void group_create_actions(resource_t * rsc, pe_working_set_t * data_set);
  88 extern void group_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
  89 extern void group_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc,
  90                                     rsc_colocation_t * constraint);
  91 extern void group_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
  92                                     rsc_colocation_t * constraint);
  93 extern enum pe_action_flags group_action_flags(action_t * action, node_t * node);
  94 extern void group_rsc_location(resource_t * rsc, rsc_to_node_t * constraint);
  95 extern void group_expand(resource_t * rsc, pe_working_set_t * data_set);
  96 extern void group_append_meta(resource_t * rsc, xmlNode * xml);
  97 
  98 extern int container_num_allowed_nodes(resource_t * rsc);
  99 extern node_t *container_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
 100 extern void container_create_actions(resource_t * rsc, pe_working_set_t * data_set);
 101 extern void container_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
 102 extern void container_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc,
 103                                     rsc_colocation_t * constraint);
 104 extern void container_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
 105                                     rsc_colocation_t * constraint);
 106 extern void container_rsc_location(resource_t * rsc, rsc_to_node_t * constraint);
 107 extern enum pe_action_flags container_action_flags(action_t * action, node_t * node);
 108 extern void container_expand(resource_t * rsc, pe_working_set_t * data_set);
 109 extern gboolean container_create_probe(resource_t * rsc, node_t * node, action_t * complete,
 110                                    gboolean force, pe_working_set_t * data_set);
 111 extern void container_append_meta(resource_t * rsc, xmlNode * xml);
 112 
 113 extern int clone_num_allowed_nodes(resource_t * rsc);
 114 extern node_t *clone_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
 115 extern void clone_create_actions(resource_t * rsc, pe_working_set_t * data_set);
 116 extern void clone_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
 117 extern void clone_rsc_colocation_lh(resource_t * lh_rsc, resource_t * rh_rsc,
 118                                     rsc_colocation_t * constraint);
 119 extern void clone_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
 120                                     rsc_colocation_t * constraint);
 121 extern void clone_rsc_location(resource_t * rsc, rsc_to_node_t * constraint);
 122 extern enum pe_action_flags clone_action_flags(action_t * action, node_t * node);
 123 extern void clone_expand(resource_t * rsc, pe_working_set_t * data_set);
 124 extern gboolean clone_create_probe(resource_t * rsc, node_t * node, action_t * complete,
 125                                    gboolean force, pe_working_set_t * data_set);
 126 extern void clone_append_meta(resource_t * rsc, xmlNode * xml);
 127 
 128 extern gboolean master_unpack(resource_t * rsc, pe_working_set_t * data_set);
 129 extern node_t *master_color(resource_t * rsc, node_t * preferred, pe_working_set_t * data_set);
 130 extern void master_create_actions(resource_t * rsc, pe_working_set_t * data_set);
 131 extern void master_internal_constraints(resource_t * rsc, pe_working_set_t * data_set);
 132 extern void master_rsc_colocation_rh(resource_t * lh_rsc, resource_t * rh_rsc,
 133                                      rsc_colocation_t * constraint);
 134 extern void master_append_meta(resource_t * rsc, xmlNode * xml);
 135 
 136 /* extern resource_object_functions_t resource_variants[]; */
 137 extern resource_alloc_functions_t resource_class_alloc_functions[];
 138 extern gboolean is_active(rsc_to_node_t * cons);
 139 
 140 extern gboolean native_constraint_violated(resource_t * rsc_lh, resource_t * rsc_rh,
 141                                            rsc_colocation_t * constraint);
 142 
 143 extern gboolean unpack_rsc_to_attr(xmlNode * xml_obj, pe_working_set_t * data_set);
 144 
 145 extern gboolean unpack_rsc_to_node(xmlNode * xml_obj, pe_working_set_t * data_set);
 146 
 147 extern gboolean unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set);
 148 
 149 extern gboolean unpack_rsc_colocation(xmlNode * xml_obj, pe_working_set_t * data_set);
 150 
 151 extern gboolean unpack_location(xmlNode * xml_obj, pe_working_set_t * data_set);
 152 
 153 extern gboolean unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set);
 154 
 155 void LogNodeActions(pe_working_set_t * data_set, gboolean terminal);
 156 void LogActions(resource_t * rsc, pe_working_set_t * data_set, gboolean terminal);
 157 void container_LogActions(resource_t * rsc, pe_working_set_t * data_set, gboolean terminal);
 158 
 159 extern void cleanup_alloc_calculations(pe_working_set_t * data_set);
 160 
 161 extern void rsc_stonith_ordering(resource_t * rsc, action_t * stonith_op,
 162                                  pe_working_set_t * data_set);
 163 
 164 extern enum pe_graph_flags native_update_actions(action_t * first, action_t * then, node_t * node,
 165                                                  enum pe_action_flags flags,
 166                                                  enum pe_action_flags filter,
 167                                                  enum pe_ordering type);
 168 extern enum pe_graph_flags group_update_actions(action_t * first, action_t * then, node_t * node,
 169                                                 enum pe_action_flags flags,
 170                                                 enum pe_action_flags filter, enum pe_ordering type);
 171 extern enum pe_graph_flags container_update_actions(action_t * first, action_t * then, node_t * node,
 172                                                     enum pe_action_flags flags,
 173                                                     enum pe_action_flags filter, enum pe_ordering type);
 174 
 175 gboolean update_action_flags(action_t * action, enum pe_action_flags flags, const char *source, int line);
 176 gboolean update_action(action_t * action);
 177 void complex_set_cmds(resource_t * rsc);
 178 
 179 void master_promotion_constraints(resource_t * rsc, pe_working_set_t * data_set);
 180 void clone_create_pseudo_actions(
 181     resource_t * rsc, GListPtr children, notify_data_t **start_notify, notify_data_t **stop_notify,  pe_working_set_t * data_set);
 182 
 183 #endif

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