pacemaker  1.1.12-561c4cf
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
status.h
Go to the documentation of this file.
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 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 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 PENGINE_STATUS__H
19 # define PENGINE_STATUS__H
20 
21 # include <glib.h>
22 # include <crm/common/iso8601.h>
23 # include <crm/pengine/common.h>
24 
25 typedef struct node_s pe_node_t;
26 typedef struct node_s node_t;
27 typedef struct pe_action_s action_t;
28 typedef struct pe_action_s pe_action_t;
29 typedef struct resource_s resource_t;
30 typedef struct ticket_s ticket_t;
31 
32 typedef enum no_quorum_policy_e {
38 
39 enum node_type {
43 };
44 
45 enum pe_restart {
48 };
49 
50 enum pe_find {
51  pe_find_renamed = 0x001,
52  pe_find_clone = 0x004,
53  pe_find_current = 0x008,
55 };
56 
57 # define pe_flag_have_quorum 0x00000001ULL
58 # define pe_flag_symmetric_cluster 0x00000002ULL
59 # define pe_flag_is_managed_default 0x00000004ULL
60 # define pe_flag_maintenance_mode 0x00000008ULL
61 
62 # define pe_flag_stonith_enabled 0x00000010ULL
63 # define pe_flag_have_stonith_resource 0x00000020ULL
64 # define pe_flag_enable_unfencing 0x00000040ULL
65 
66 # define pe_flag_stop_rsc_orphans 0x00000100ULL
67 # define pe_flag_stop_action_orphans 0x00000200ULL
68 # define pe_flag_stop_everything 0x00000400ULL
69 
70 # define pe_flag_start_failure_fatal 0x00001000ULL
71 # define pe_flag_remove_after_stop 0x00002000ULL
72 
73 # define pe_flag_startup_probes 0x00010000ULL
74 # define pe_flag_have_status 0x00020000ULL
75 # define pe_flag_have_remote_nodes 0x00040000ULL
76 
77 # define pe_flag_quick_location 0x00100000ULL
78 
79 typedef struct pe_working_set_s {
80  xmlNode *input;
82 
83  /* options extracted from the input */
84  char *dc_uuid;
86  const char *stonith_action;
87  const char *placement_strategy;
88 
89  unsigned long long flags;
90 
94 
95  GHashTable *config_hash;
96  GHashTable *tickets;
97  GHashTable *singletons; /* Actions for which there can be only one - ie. fence nodeX */
98 
105 
107  xmlNode *failed;
108  xmlNode *op_defaults;
109  xmlNode *rsc_defaults;
110 
111  /* stats */
114  int order_id;
116 
117  /* final output */
118  xmlNode *graph;
119 
120  GHashTable *template_rsc_sets;
121  const char *localhost;
122  GHashTable *tags;
123 
125 
127  const char *id;
128  const char *uname;
129 /* Make all these flags into a bitfield one day */
130  gboolean online;
131  gboolean standby;
132  gboolean standby_onfail;
133  gboolean pending;
134  gboolean unclean;
135  gboolean unseen;
136  gboolean shutdown;
137  gboolean expected_up;
138  gboolean is_dc;
140  GListPtr running_rsc; /* resource_t* */
141  GListPtr allocated_rsc; /* resource_t* */
142 
144 
145  GHashTable *attrs; /* char* => char* */
147 
148  GHashTable *utilization;
149 
151  GHashTable *digest_cache;
152 
153  gboolean maintenance;
154 };
155 
156 struct node_s {
157  int weight;
158  gboolean fixed;
159  int count;
161 };
162 
163 # include <crm/pengine/complex.h>
164 
165 # define pe_rsc_orphan 0x00000001ULL
166 # define pe_rsc_managed 0x00000002ULL
167 # define pe_rsc_block 0x00000004ULL /* Further operations are prohibited due to failure policy */
168 # define pe_rsc_orphan_container_filler 0x00000008ULL
169 
170 # define pe_rsc_notify 0x00000010ULL
171 # define pe_rsc_unique 0x00000020ULL
172 # define pe_rsc_fence_device 0x00000040ULL
173 
174 # define pe_rsc_provisional 0x00000100ULL
175 # define pe_rsc_allocating 0x00000200ULL
176 # define pe_rsc_merging 0x00000400ULL
177 # define pe_rsc_munging 0x00000800ULL
178 
179 # define pe_rsc_try_reload 0x00001000ULL
180 # define pe_rsc_reload 0x00002000ULL
181 
182 # define pe_rsc_failed 0x00010000ULL
183 # define pe_rsc_shutdown 0x00020000ULL
184 # define pe_rsc_runnable 0x00040000ULL
185 # define pe_rsc_start_pending 0x00080000ULL
186 
187 # define pe_rsc_starting 0x00100000ULL
188 # define pe_rsc_stopping 0x00200000ULL
189 # define pe_rsc_migrating 0x00400000ULL
190 # define pe_rsc_allow_migrate 0x00800000ULL
191 
192 # define pe_rsc_failure_ignored 0x01000000ULL
193 # define pe_rsc_unexpectedly_running 0x02000000ULL
194 # define pe_rsc_maintenance 0x04000000ULL
195 
196 # define pe_rsc_needs_quorum 0x10000000ULL
197 # define pe_rsc_needs_fencing 0x20000000ULL
198 # define pe_rsc_needs_unfencing 0x40000000ULL
199 # define pe_rsc_have_unfencing 0x80000000ULL
200 
202  pe_graph_none = 0x00000,
205  pe_graph_disable = 0x00004,
206 };
207 
208 /* *INDENT-OFF* */
210  pe_action_pseudo = 0x00001,
214 
219 
220  pe_action_dumped = 0x00100,
222  pe_action_clear = 0x00400,
223  pe_action_dangle = 0x00800,
224 
225  pe_action_requires_any = 0x01000, /* This action requires one or mre of its dependancies to be runnable
226  * We use this to clear the runnable flag before checking dependancies
227  */
228 };
229 /* *INDENT-ON* */
230 
231 struct resource_s {
232  char *id;
233  char *clone_name;
234  xmlNode *xml;
235  xmlNode *orig_xml;
236  xmlNode *ops_xml;
237 
243 
246 
247  int priority;
253 
254  gboolean is_remote_node;
255 
256  unsigned long long flags;
257 
258  GListPtr rsc_cons_lhs; /* rsc_colocation_t* */
259  GListPtr rsc_cons; /* rsc_colocation_t* */
260  GListPtr rsc_location; /* rsc_to_node_t* */
261  GListPtr actions; /* action_t* */
262  GListPtr rsc_tickets; /* rsc_ticket* */
263 
265  GListPtr running_on; /* node_t* */
266  GHashTable *known_on; /* node_t* */
267  GHashTable *allowed_nodes; /* node_t* */
268 
271 
272  GHashTable *meta;
273  GHashTable *parameters;
274  GHashTable *utilization;
275 
276  GListPtr children; /* resource_t* */
278 
281 
284 
286 };
287 
288 struct pe_action_s {
289  int id;
290  int priority;
291 
294  xmlNode *op_entry;
295 
296  char *task;
297  char *uuid;
298  char *cancel_task;
299 
304 
309 
311 
312  GHashTable *meta;
313  GHashTable *extra;
314 
315  GListPtr actions_before; /* action_warpper_t* */
316  GListPtr actions_after; /* action_warpper_t* */
317 };
318 
319 struct ticket_s {
320  char *id;
321  gboolean granted;
322  time_t last_granted;
323  gboolean standby;
324  GHashTable *state;
325 };
326 
327 typedef struct tag_s {
328  char *id;
330 } tag_t;
331 
336 };
337 
338 /* *INDENT-OFF* */
340  pe_order_none = 0x0, /* deleted */
341  pe_order_optional = 0x1, /* pure ordering, nothing implied */
342  pe_order_apply_first_non_migratable = 0x2, /* Only apply this constraint's ordering if first is not migratable. */
343 
344  pe_order_implies_first = 0x10, /* If 'then' is required, ensure 'first' is too */
345  pe_order_implies_then = 0x20, /* If 'first' is required, ensure 'then' is too */
346  pe_order_implies_first_master = 0x40, /* Imply 'first' is required when 'then' is required and then's rsc holds Master role. */
347 
348  /* first requires then to be both runnable and migrate runnable. */
350 
351  pe_order_runnable_left = 0x100, /* 'then' requires 'first' to be runnable */
352 
353  pe_order_pseudo_left = 0x200, /* 'then' can only be pseudo if 'first' is runnable */
354  pe_order_implies_then_on_node = 0x400, /* If 'first' is required on 'nodeX',
355  * ensure instances of 'then' on 'nodeX' are too.
356  * Only really useful if 'then' is a clone and 'first' is not
357  */
358 
359  pe_order_restart = 0x1000, /* 'then' is runnable if 'first' is optional or runnable */
360  pe_order_stonith_stop = 0x2000, /* only applies if the action is non-pseudo */
361  pe_order_serialize_only = 0x4000, /* serialize */
362 
363  pe_order_implies_first_printed = 0x10000, /* Like ..implies_first but only ensures 'first' is printed, not manditory */
364  pe_order_implies_then_printed = 0x20000, /* Like ..implies_then but only ensures 'then' is printed, not manditory */
365 
366  pe_order_asymmetrical = 0x100000, /* Indicates asymmetrical one way ordering constraint. */
367  pe_order_load = 0x200000, /* Only relevant if... */
368  pe_order_one_or_more = 0x400000, /* 'then' is only runnable if one or more of it's dependancies are too */
370 
371  pe_order_preserve = 0x1000000, /* Hack for breaking user ordering constraints with container resources */
372  pe_order_trace = 0x4000000, /* test marker */
373 };
374 /* *INDENT-ON* */
375 
381 };
382 
383 const char *rsc_printable_id(resource_t *rsc);
384 gboolean cluster_status(pe_working_set_t * data_set);
386 void cleanup_calculations(pe_working_set_t * data_set);
387 resource_t *pe_find_resource(GListPtr rsc_list, const char *id_rh);
388 node_t *pe_find_node(GListPtr node_list, const char *uname);
389 node_t *pe_find_node_id(GListPtr node_list, const char *id);
390 node_t *pe_find_node_any(GListPtr node_list, const char *id, const char *uname);
391 GListPtr find_operations(const char *rsc, const char *node, gboolean active_filter,
392  pe_working_set_t * data_set);
393 #endif
GHashTable * tags
Definition: status.h:122
GListPtr nodes
Definition: status.h:99
const char * uname
Definition: status.h:128
enum rsc_start_requirement needs
Definition: status.h:301
int count
Definition: status.h:159
enum pe_ordering type
Definition: status.h:378
xmlNode * xml
Definition: status.h:234
xmlNode * failed
Definition: status.h:107
GHashTable * utilization
Definition: status.h:274
int priority
Definition: status.h:290
int default_resource_stickiness
Definition: status.h:92
const char * id
Definition: status.h:127
int weight
Definition: status.h:157
int sort_index
Definition: status.h:249
pe_graph_flags
Definition: status.h:201
struct crm_time_s crm_time_t
Definition: iso8601.h:37
time_t last_granted
Definition: status.h:322
xmlNode * op_defaults
Definition: status.h:108
enum action_fail_response on_fail
Definition: status.h:302
GListPtr rsc_location
Definition: status.h:260
char * cancel_task
Definition: status.h:298
GListPtr running_rsc
Definition: status.h:140
enum pe_obj_types variant
Definition: status.h:240
gboolean pending
Definition: status.h:133
node_t * partial_migration_source
Definition: status.h:280
gboolean fixed
Definition: status.h:158
GListPtr resources
Definition: status.h:100
node_t * pe_find_node(GListPtr node_list, const char *uname)
no_quorum_policy_t no_quorum_policy
Definition: status.h:93
char * clone_name
Definition: status.h:233
xmlNode * orig_xml
Definition: status.h:235
xmlNode * op_entry
Definition: status.h:294
int max_valid_nodes
Definition: status.h:113
int id
Definition: status.h:289
resource_t * remote_rsc
Definition: status.h:143
action_t * pre_notify
Definition: status.h:305
GHashTable * tickets
Definition: status.h:96
node_t * dc_node
Definition: status.h:85
enum rsc_role_e role
Definition: status.h:269
GListPtr children
Definition: status.h:276
enum pe_restart restart_type
Definition: status.h:245
GListPtr actions_before
Definition: status.h:315
action_fail_response
Definition: common.h:29
char * dc_uuid
Definition: status.h:84
gboolean is_remote_node
Definition: status.h:254
int stonith_timeout
Definition: status.h:91
gboolean standby
Definition: status.h:131
pe_action_flags
Definition: status.h:209
GHashTable * extra
Definition: status.h:313
char * id
Definition: status.h:232
GHashTable * parameters
Definition: status.h:273
GListPtr placement_constraints
Definition: status.h:101
GHashTable * utilization
Definition: status.h:148
char uname[MAX_NAME]
Definition: internal.h:53
struct tag_s tag_t
GListPtr find_operations(const char *rsc, const char *node, gboolean active_filter, pe_working_set_t *data_set)
rsc_recovery_type
Definition: common.h:58
struct node_shared_s * details
Definition: status.h:160
void cleanup_calculations(pe_working_set_t *data_set)
GListPtr rsc_cons_lhs
Definition: status.h:258
gboolean unclean
Definition: status.h:134
pe_restart
Definition: status.h:45
int effective_priority
Definition: status.h:251
char * pending_task
Definition: status.h:285
enum rsc_recovery_type recovery_type
Definition: status.h:244
xmlNode * rsc_defaults
Definition: status.h:109
pe_obj_types
Definition: complex.h:30
node_t * partial_migration_target
Definition: status.h:279
action_t * post_notified
Definition: status.h:308
resource_object_functions_t * fns
Definition: status.h:241
char * task
Definition: status.h:296
enum no_quorum_policy_e no_quorum_policy_t
resource_t * container
Definition: status.h:282
GHashTable * allowed_nodes
Definition: status.h:267
void * variant_opaque
Definition: status.h:239
GHashTable * digest_cache
Definition: status.h:151
GListPtr rsc_cons
Definition: status.h:259
GHashTable * meta
Definition: status.h:312
void set_working_set_defaults(pe_working_set_t *data_set)
GListPtr refs
Definition: status.h:329
const char * stonith_action
Definition: status.h:86
action_t * pre_notified
Definition: status.h:306
node_type
Definition: status.h:39
pe_find
Definition: status.h:50
int migration_threshold
Definition: status.h:252
GListPtr actions
Definition: status.h:106
GHashTable * config_hash
Definition: status.h:95
action_t * post_notify
Definition: status.h:307
ISO_8601 Date handling.
gboolean is_dc
Definition: status.h:138
unsigned long long flags
Definition: status.h:256
pe_link_state
Definition: status.h:332
rsc_start_requirement
Definition: common.h:64
resource_t * parent
Definition: status.h:238
no_quorum_policy_e
Definition: status.h:32
char * uuid
Definition: status.h:297
GListPtr dangling_migrations
Definition: status.h:277
xmlNode * input
Definition: status.h:80
GListPtr fillers
Definition: status.h:283
GListPtr rsc_tickets
Definition: status.h:262
const char * placement_strategy
Definition: status.h:87
gboolean unseen
Definition: status.h:135
int failure_timeout
Definition: status.h:250
GListPtr ordering_constraints
Definition: status.h:102
node_t * node
Definition: status.h:293
GListPtr colocation_constraints
Definition: status.h:103
action_t * action
Definition: status.h:380
int stickiness
Definition: status.h:248
GListPtr actions
Definition: status.h:261
gboolean maintenance
Definition: status.h:153
pe_ordering
Definition: status.h:339
const char * localhost
Definition: status.h:121
GHashTable * meta
Definition: status.h:272
node_t * pe_find_node_any(GListPtr node_list, const char *id, const char *uname)
enum pe_link_state state
Definition: status.h:379
gboolean standby_onfail
Definition: status.h:132
int seen_count
Definition: status.h:310
GListPtr ticket_constraints
Definition: status.h:104
gboolean cluster_status(pe_working_set_t *data_set)
GHashTable * attrs
Definition: status.h:145
enum rsc_role_e next_role
Definition: status.h:270
gboolean online
Definition: status.h:130
gboolean shutdown
Definition: status.h:136
GListPtr actions_after
Definition: status.h:316
enum rsc_role_e fail_role
Definition: status.h:303
char * id
Definition: status.h:328
enum node_type type
Definition: status.h:146
node_t * allocated_to
Definition: status.h:264
rsc_role_e
Definition: common.h:70
node_t * pe_find_node_id(GListPtr node_list, const char *id)
enum pe_action_flags flags
Definition: status.h:300
GHashTable * known_on
Definition: status.h:266
gboolean standby
Definition: status.h:323
Definition: status.h:327
struct resource_alloc_functions_s resource_alloc_functions_t
Definition: complex.h:59
gboolean expected_up
Definition: status.h:137
gboolean granted
Definition: status.h:321
Definition: status.h:156
int num_resources
Definition: status.h:139
resource_t * rsc
Definition: status.h:292
GHashTable * singletons
Definition: status.h:97
unsigned long long flags
Definition: status.h:89
resource_alloc_functions_t * cmds
Definition: status.h:242
xmlNode * ops_xml
Definition: status.h:236
resource_t * pe_find_resource(GListPtr rsc_list, const char *id_rh)
char * id
Definition: status.h:320
GList * GListPtr
Definition: crm.h:189
crm_time_t * now
Definition: status.h:81
struct pe_working_set_s pe_working_set_t
GHashTable * template_rsc_sets
Definition: status.h:120
const char * rsc_printable_id(resource_t *rsc)
GHashTable * state
Definition: status.h:324
GListPtr allocated_rsc
Definition: status.h:141
int priority
Definition: status.h:247
xmlNode * graph
Definition: status.h:118
GListPtr running_on
Definition: status.h:265