1
2
3
4
5
6
7
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 void (*rsc_location) (pe_resource_t *, pe__location_t *);
34
35 enum pe_action_flags (*action_flags) (pe_action_t *, pe_node_t *);
36 enum pe_graph_flags (*update_actions) (pe_action_t *, pe_action_t *,
37 pe_node_t *, enum pe_action_flags,
38 enum pe_action_flags,
39 enum pe_ordering,
40 pe_working_set_t *data_set);
41
42 void (*expand) (pe_resource_t *, pe_working_set_t *);
43 void (*append_meta) (pe_resource_t * rsc, xmlNode * xml);
44 };
45
46 GHashTable *pcmk__native_merge_weights(pe_resource_t *rsc, const char *rhs,
47 GHashTable *nodes, const char *attr,
48 float factor, uint32_t flags);
49
50 GHashTable *pcmk__group_merge_weights(pe_resource_t *rsc, const char *rhs,
51 GHashTable *nodes, const char *attr,
52 float factor, uint32_t flags);
53
54 pe_node_t *pcmk__native_allocate(pe_resource_t *rsc, pe_node_t *preferred,
55 pe_working_set_t *data_set);
56 extern void native_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
57 extern void native_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
58 void native_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc,
59 pcmk__colocation_t *constraint,
60 pe_working_set_t *data_set);
61 void native_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc,
62 pcmk__colocation_t *constraint,
63 pe_working_set_t *data_set);
64 extern void rsc_ticket_constraint(pe_resource_t * lh_rsc, rsc_ticket_t * rsc_ticket,
65 pe_working_set_t * data_set);
66 extern enum pe_action_flags native_action_flags(pe_action_t * action, pe_node_t * node);
67
68 void native_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
69 extern void native_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
70 extern gboolean native_create_probe(pe_resource_t * rsc, pe_node_t * node, pe_action_t * complete,
71 gboolean force, pe_working_set_t * data_set);
72 extern void native_append_meta(pe_resource_t * rsc, xmlNode * xml);
73
74 pe_node_t *pcmk__group_allocate(pe_resource_t *rsc, pe_node_t *preferred,
75 pe_working_set_t *data_set);
76 extern void group_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
77 extern void group_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
78 void group_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc,
79 pcmk__colocation_t *constraint,
80 pe_working_set_t *data_set);
81 void group_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc,
82 pcmk__colocation_t *constraint,
83 pe_working_set_t *data_set);
84 extern enum pe_action_flags group_action_flags(pe_action_t * action, pe_node_t * node);
85 void group_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
86 extern void group_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
87 extern void group_append_meta(pe_resource_t * rsc, xmlNode * xml);
88
89 pe_node_t *pcmk__bundle_allocate(pe_resource_t *rsc, pe_node_t *preferred,
90 pe_working_set_t *data_set);
91 void pcmk__bundle_create_actions(pe_resource_t *rsc,
92 pe_working_set_t *data_set);
93 gboolean pcmk__bundle_create_probe(pe_resource_t *rsc, pe_node_t *node,
94 pe_action_t *complete, gboolean force,
95 pe_working_set_t *data_set);
96 void pcmk__bundle_internal_constraints(pe_resource_t *rsc,
97 pe_working_set_t *data_set);
98 void pcmk__bundle_rsc_colocation_lh(pe_resource_t *lh_rsc,
99 pe_resource_t *rh_rsc,
100 pcmk__colocation_t *constraint,
101 pe_working_set_t *data_set);
102 void pcmk__bundle_rsc_colocation_rh(pe_resource_t *lh_rsc,
103 pe_resource_t *rh_rsc,
104 pcmk__colocation_t *constraint,
105 pe_working_set_t *data_set);
106 void pcmk__bundle_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
107 enum pe_action_flags pcmk__bundle_action_flags(pe_action_t *action,
108 pe_node_t *node);
109 void pcmk__bundle_expand(pe_resource_t *rsc, pe_working_set_t *data_set);
110 void pcmk__bundle_append_meta(pe_resource_t *rsc, xmlNode *xml);
111
112 pe_node_t *pcmk__clone_allocate(pe_resource_t *rsc, pe_node_t *preferred,
113 pe_working_set_t *data_set);
114 extern void clone_create_actions(pe_resource_t * rsc, pe_working_set_t * data_set);
115 extern void clone_internal_constraints(pe_resource_t * rsc, pe_working_set_t * data_set);
116 void clone_rsc_colocation_lh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc,
117 pcmk__colocation_t *constraint,
118 pe_working_set_t *data_set);
119 void clone_rsc_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc,
120 pcmk__colocation_t *constraint,
121 pe_working_set_t *data_set);
122 void clone_rsc_location(pe_resource_t *rsc, pe__location_t *constraint);
123 extern enum pe_action_flags clone_action_flags(pe_action_t * action, pe_node_t * node);
124 extern void clone_expand(pe_resource_t * rsc, pe_working_set_t * data_set);
125 extern gboolean clone_create_probe(pe_resource_t * rsc, pe_node_t * node, pe_action_t * complete,
126 gboolean force, pe_working_set_t * data_set);
127 extern void clone_append_meta(pe_resource_t * rsc, xmlNode * xml);
128
129 void pcmk__add_promotion_scores(pe_resource_t *rsc);
130 pe_node_t *pcmk__set_instance_roles(pe_resource_t *rsc,
131 pe_working_set_t *data_set);
132 void create_promotable_actions(pe_resource_t *rsc, pe_working_set_t *data_set);
133 void promote_demote_constraints(pe_resource_t *rsc, pe_working_set_t *data_set);
134 void promotable_constraints(pe_resource_t *rsc, pe_working_set_t *data_set);
135 void promotable_colocation_rh(pe_resource_t *lh_rsc, pe_resource_t *rh_rsc,
136 pcmk__colocation_t *constraint,
137 pe_working_set_t *data_set);
138
139
140 extern resource_alloc_functions_t resource_class_alloc_functions[];
141
142 extern gboolean unpack_rsc_order(xmlNode * xml_obj, pe_working_set_t * data_set);
143
144 extern gboolean unpack_rsc_ticket(xmlNode * xml_obj, pe_working_set_t * data_set);
145
146 void LogNodeActions(pe_working_set_t * data_set);
147 void LogActions(pe_resource_t * rsc, pe_working_set_t * data_set);
148 void pcmk__bundle_log_actions(pe_resource_t *rsc, pe_working_set_t *data_set);
149
150 extern void rsc_stonith_ordering(pe_resource_t * rsc, pe_action_t * stonith_op,
151 pe_working_set_t * data_set);
152
153 enum pe_graph_flags native_update_actions(pe_action_t *first, pe_action_t *then,
154 pe_node_t *node,
155 enum pe_action_flags flags,
156 enum pe_action_flags filter,
157 enum pe_ordering type,
158 pe_working_set_t *data_set);
159 enum pe_graph_flags group_update_actions(pe_action_t *first, pe_action_t *then,
160 pe_node_t *node,
161 enum pe_action_flags flags,
162 enum pe_action_flags filter,
163 enum pe_ordering type,
164 pe_working_set_t *data_set);
165 enum pe_graph_flags pcmk__multi_update_actions(pe_action_t *first,
166 pe_action_t *then,
167 pe_node_t *node,
168 enum pe_action_flags flags,
169 enum pe_action_flags filter,
170 enum pe_ordering type,
171 pe_working_set_t *data_set);
172
173 gboolean update_action(pe_action_t *action, pe_working_set_t *data_set);
174 void complex_set_cmds(pe_resource_t * rsc);
175 void pcmk__log_transition_summary(const char *filename);
176 void clone_create_pseudo_actions(
177 pe_resource_t * rsc, GList *children, notify_data_t **start_notify, notify_data_t **stop_notify, pe_working_set_t * data_set);
178 #endif