pacemaker  1.1.16-94ff4df
Scalable High-Availability cluster resource manager
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules
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 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 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 # define pe_flag_concurrent_fencing 0x00000080ULL
66 
67 # define pe_flag_stop_rsc_orphans 0x00000100ULL
68 # define pe_flag_stop_action_orphans 0x00000200ULL
69 # define pe_flag_stop_everything 0x00000400ULL
70 
71 # define pe_flag_start_failure_fatal 0x00001000ULL
72 # define pe_flag_remove_after_stop 0x00002000ULL
73 
74 # define pe_flag_startup_probes 0x00010000ULL
75 # define pe_flag_have_status 0x00020000ULL
76 # define pe_flag_have_remote_nodes 0x00040000ULL
77 
78 # define pe_flag_quick_location 0x00100000ULL
79 # define pe_flag_sanitized 0x00200000ULL
80 
81 typedef struct pe_working_set_s {
82  xmlNode *input;
84 
85  /* options extracted from the input */
86  char *dc_uuid;
88  const char *stonith_action;
89  const char *placement_strategy;
90 
91  unsigned long long flags;
92 
96 
97  GHashTable *config_hash;
98  GHashTable *tickets;
99  GHashTable *singletons; /* Actions for which there can be only one - ie. fence nodeX */
100 
107 
109  xmlNode *failed;
110  xmlNode *op_defaults;
111  xmlNode *rsc_defaults;
112 
113  /* stats */
116  int order_id;
118 
119  /* final output */
120  xmlNode *graph;
121 
122  GHashTable *template_rsc_sets;
123  const char *localhost;
124  GHashTable *tags;
125 
128 
130 
132  const char *id;
133  const char *uname;
134 /* Make all these flags into a bitfield one day */
135  gboolean online;
136  gboolean standby;
137  gboolean standby_onfail;
138  gboolean pending;
139  gboolean unclean;
140  gboolean unseen;
141  gboolean shutdown;
142  gboolean expected_up;
143  gboolean is_dc;
144 
146  GListPtr running_rsc; /* resource_t* */
147  GListPtr allocated_rsc; /* resource_t* */
148 
150 
151  GHashTable *attrs; /* char* => char* */
153 
154  GHashTable *utilization;
155 
157  GHashTable *digest_cache;
158 
159  gboolean maintenance;
163 };
164 
165 struct node_s {
166  int weight;
167  gboolean fixed;
168  int count;
171 };
172 
173 # include <crm/pengine/complex.h>
174 
175 # define pe_rsc_orphan 0x00000001ULL
176 # define pe_rsc_managed 0x00000002ULL
177 # define pe_rsc_block 0x00000004ULL /* Further operations are prohibited due to failure policy */
178 # define pe_rsc_orphan_container_filler 0x00000008ULL
179 
180 # define pe_rsc_notify 0x00000010ULL
181 # define pe_rsc_unique 0x00000020ULL
182 # define pe_rsc_fence_device 0x00000040ULL
183 
184 # define pe_rsc_provisional 0x00000100ULL
185 # define pe_rsc_allocating 0x00000200ULL
186 # define pe_rsc_merging 0x00000400ULL
187 # define pe_rsc_munging 0x00000800ULL
188 
189 # define pe_rsc_try_reload 0x00001000ULL
190 # define pe_rsc_reload 0x00002000ULL
191 
192 # define pe_rsc_failed 0x00010000ULL
193 # define pe_rsc_shutdown 0x00020000ULL
194 # define pe_rsc_runnable 0x00040000ULL
195 # define pe_rsc_start_pending 0x00080000ULL
196 
197 # define pe_rsc_starting 0x00100000ULL
198 # define pe_rsc_stopping 0x00200000ULL
199 # define pe_rsc_migrating 0x00400000ULL
200 # define pe_rsc_allow_migrate 0x00800000ULL
201 
202 # define pe_rsc_failure_ignored 0x01000000ULL
203 # define pe_rsc_unexpectedly_running 0x02000000ULL
204 # define pe_rsc_maintenance 0x04000000ULL
205 
206 # define pe_rsc_needs_quorum 0x10000000ULL
207 # define pe_rsc_needs_fencing 0x20000000ULL
208 # define pe_rsc_needs_unfencing 0x40000000ULL
209 # define pe_rsc_have_unfencing 0x80000000ULL /* obsolete (not set or used by cluster) */
210 
212  pe_graph_none = 0x00000,
215  pe_graph_disable = 0x00004,
216 };
217 
218 /* *INDENT-OFF* */
220  pe_action_pseudo = 0x00001,
224 
226  pe_action_failure_is_fatal = 0x00020, /* no longer used, here for API compatibility */
229 
230  pe_action_dumped = 0x00100,
232  pe_action_clear = 0x00400,
233  pe_action_dangle = 0x00800,
234 
235  pe_action_requires_any = 0x01000, /* This action requires one or mre of its dependencies to be runnable
236  * We use this to clear the runnable flag before checking dependencies
237  */
240 };
241 /* *INDENT-ON* */
242 
243 struct resource_s {
244  char *id;
245  char *clone_name;
246  xmlNode *xml;
247  xmlNode *orig_xml;
248  xmlNode *ops_xml;
249 
255 
258 
259  int priority;
265 
266  gboolean is_remote_node;
267 
268  unsigned long long flags;
269 
270  GListPtr rsc_cons_lhs; /* rsc_colocation_t* */
271  GListPtr rsc_cons; /* rsc_colocation_t* */
272  GListPtr rsc_location; /* rsc_to_node_t* */
273  GListPtr actions; /* action_t* */
274  GListPtr rsc_tickets; /* rsc_ticket* */
275 
277  GListPtr running_on; /* node_t* */
278  GHashTable *known_on; /* node_t* */
279  GHashTable *allowed_nodes; /* node_t* */
280 
283 
284  GHashTable *meta;
285  GHashTable *parameters;
286  GHashTable *utilization;
287 
288  GListPtr children; /* resource_t* */
290 
293 
296 
298 
299  const char *isolation_wrapper;
302 
304 };
305 
306 struct pe_action_s {
307  int id;
308  int priority;
309 
312  xmlNode *op_entry;
313 
314  char *task;
315  char *uuid;
316  char *cancel_task;
317 
322 
327 
329 
330  GHashTable *meta;
331  GHashTable *extra;
332 
333  /*
334  * These two varables are associated with the constraint logic
335  * that involves first having one or more actions runnable before
336  * then allowing this action to execute.
337  *
338  * These varables are used with features such as 'clone-min' which
339  * requires at minimum X number of cloned instances to be running
340  * before an order dependency can run. Another option that uses
341  * this is 'require-all=false' in ordering constrants. This option
342  * says "only required one instance of a resource to start before
343  * allowing dependencies to start" basicall require-all=false is
344  * the same as clone-min=1.
345  */
346 
347  /* current number of known runnable actions in the before list. */
349  /* the number of "before" runnable actions required for this action
350  * to be considered runnable */
352 
353  GListPtr actions_before; /* action_warpper_t* */
354  GListPtr actions_after; /* action_warpper_t* */
355 };
356 
357 struct ticket_s {
358  char *id;
359  gboolean granted;
360  time_t last_granted;
361  gboolean standby;
362  GHashTable *state;
363 };
364 
365 typedef struct tag_s {
366  char *id;
368 } tag_t;
369 
374 };
375 
376 /* *INDENT-OFF* */
378  pe_order_none = 0x0, /* deleted */
379  pe_order_optional = 0x1, /* pure ordering, nothing implied */
380  pe_order_apply_first_non_migratable = 0x2, /* Only apply this constraint's ordering if first is not migratable. */
381 
382  pe_order_implies_first = 0x10, /* If 'then' is required, ensure 'first' is too */
383  pe_order_implies_then = 0x20, /* If 'first' is required, ensure 'then' is too */
384  pe_order_implies_first_master = 0x40, /* Imply 'first' is required when 'then' is required and then's rsc holds Master role. */
385 
386  /* first requires then to be both runnable and migrate runnable. */
388 
389  pe_order_runnable_left = 0x100, /* 'then' requires 'first' to be runnable */
390 
391  pe_order_pseudo_left = 0x200, /* 'then' can only be pseudo if 'first' is runnable */
392  pe_order_implies_then_on_node = 0x400, /* If 'first' is required on 'nodeX',
393  * ensure instances of 'then' on 'nodeX' are too.
394  * Only really useful if 'then' is a clone and 'first' is not
395  */
396 
397  pe_order_restart = 0x1000, /* 'then' is runnable if 'first' is optional or runnable */
398  pe_order_stonith_stop = 0x2000, /* only applies if the action is non-pseudo */
399  pe_order_serialize_only = 0x4000, /* serialize */
400  pe_order_same_node = 0x8000, /* applies only if 'first' and 'then' are on same node */
401 
402  pe_order_implies_first_printed = 0x10000, /* Like ..implies_first but only ensures 'first' is printed, not mandatory */
403  pe_order_implies_then_printed = 0x20000, /* Like ..implies_then but only ensures 'then' is printed, not mandatory */
404 
405  pe_order_asymmetrical = 0x100000, /* Indicates asymmetrical one way ordering constraint. */
406  pe_order_load = 0x200000, /* Only relevant if... */
407  pe_order_one_or_more = 0x400000, /* 'then' is runnable only if one or more of its dependencies are too */
409 
410  pe_order_preserve = 0x1000000, /* Hack for breaking user ordering constraints with container resources */
411  pe_order_trace = 0x4000000, /* test marker */
412 };
413 /* *INDENT-ON* */
414 
420 };
421 
422 const char *rsc_printable_id(resource_t *rsc);
423 gboolean cluster_status(pe_working_set_t * data_set);
425 void cleanup_calculations(pe_working_set_t * data_set);
426 resource_t *pe_find_resource(GListPtr rsc_list, const char *id_rh);
427 node_t *pe_find_node(GListPtr node_list, const char *uname);
428 node_t *pe_find_node_id(GListPtr node_list, const char *id);
429 node_t *pe_find_node_any(GListPtr node_list, const char *id, const char *uname);
430 GListPtr find_operations(const char *rsc, const char *node, gboolean active_filter,
431  pe_working_set_t * data_set);
432 #endif
GHashTable * tags
Definition: status.h:124
GListPtr nodes
Definition: status.h:101
const char * uname
Definition: status.h:133
enum rsc_start_requirement needs
Definition: status.h:319
int count
Definition: status.h:168
enum pe_ordering type
Definition: status.h:417
xmlNode * xml
Definition: status.h:246
xmlNode * failed
Definition: status.h:109
GHashTable * utilization
Definition: status.h:286
int runnable_before
Definition: status.h:348
int priority
Definition: status.h:308
int default_resource_stickiness
Definition: status.h:94
const char * id
Definition: status.h:132
int weight
Definition: status.h:166
int sort_index
Definition: status.h:261
pe_graph_flags
Definition: status.h:211
struct crm_time_s crm_time_t
Definition: iso8601.h:37
time_t last_granted
Definition: status.h:360
xmlNode * op_defaults
Definition: status.h:110
gboolean exclusive_discover
Definition: status.h:300
enum action_fail_response on_fail
Definition: status.h:320
GListPtr rsc_location
Definition: status.h:272
char * cancel_task
Definition: status.h:316
GListPtr running_rsc
Definition: status.h:146
enum pe_obj_types variant
Definition: status.h:252
gboolean pending
Definition: status.h:138
node_t * partial_migration_source
Definition: status.h:292
gboolean fixed
Definition: status.h:167
GListPtr resources
Definition: status.h:102
node_t * pe_find_node(GListPtr node_list, const char *uname)
Definition: status.c:298
no_quorum_policy_t no_quorum_policy
Definition: status.h:95
char * clone_name
Definition: status.h:245
xmlNode * orig_xml
Definition: status.h:247
xmlNode * op_entry
Definition: status.h:312
int max_valid_nodes
Definition: status.h:115
int id
Definition: status.h:307
resource_t * remote_rsc
Definition: status.h:149
action_t * pre_notify
Definition: status.h:323
GHashTable * tickets
Definition: status.h:98
node_t * dc_node
Definition: status.h:87
enum rsc_role_e role
Definition: status.h:281
GListPtr children
Definition: status.h:288
enum pe_restart restart_type
Definition: status.h:257
GListPtr actions_before
Definition: status.h:353
action_fail_response
Definition: common.h:29
char * dc_uuid
Definition: status.h:86
gboolean is_remote_node
Definition: status.h:266
int stonith_timeout
Definition: status.h:93
gboolean standby
Definition: status.h:136
pe_action_flags
Definition: status.h:219
GHashTable * extra
Definition: status.h:331
char * id
Definition: status.h:244
GHashTable * parameters
Definition: status.h:285
const char * isolation_wrapper
Definition: status.h:299
GListPtr placement_constraints
Definition: status.h:103
GHashTable * utilization
Definition: status.h:154
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)
Definition: unpack.c:3376
rsc_recovery_type
Definition: common.h:69
struct node_shared_s * details
Definition: status.h:169
pe_working_set_t * cluster
Definition: status.h:303
void cleanup_calculations(pe_working_set_t *data_set)
Definition: status.c:181
GListPtr rsc_cons_lhs
Definition: status.h:270
gboolean unclean
Definition: status.h:139
pe_restart
Definition: status.h:45
int effective_priority
Definition: status.h:263
char * pending_task
Definition: status.h:297
enum rsc_recovery_type recovery_type
Definition: status.h:256
xmlNode * rsc_defaults
Definition: status.h:111
pe_obj_types
Definition: complex.h:30
node_t * partial_migration_target
Definition: status.h:291
action_t * post_notified
Definition: status.h:326
resource_object_functions_t * fns
Definition: status.h:253
char * task
Definition: status.h:314
enum no_quorum_policy_e no_quorum_policy_t
resource_t * container
Definition: status.h:294
GHashTable * allowed_nodes
Definition: status.h:279
void * variant_opaque
Definition: status.h:251
GHashTable * digest_cache
Definition: status.h:157
GListPtr rsc_cons
Definition: status.h:271
GHashTable * meta
Definition: status.h:330
int blocked_resources
Definition: status.h:126
void set_working_set_defaults(pe_working_set_t *data_set)
Definition: status.c:234
GListPtr refs
Definition: status.h:367
const char * stonith_action
Definition: status.h:88
action_t * pre_notified
Definition: status.h:324
node_type
Definition: status.h:39
pe_find
Definition: status.h:50
int migration_threshold
Definition: status.h:264
GListPtr actions
Definition: status.h:108
GHashTable * config_hash
Definition: status.h:97
action_t * post_notify
Definition: status.h:325
ISO_8601 Date handling.
gboolean is_dc
Definition: status.h:143
unsigned long long flags
Definition: status.h:268
pe_link_state
Definition: status.h:370
rsc_start_requirement
Definition: common.h:75
resource_t * parent
Definition: status.h:250
no_quorum_policy_e
Definition: status.h:32
char * uuid
Definition: status.h:315
GListPtr dangling_migrations
Definition: status.h:289
xmlNode * input
Definition: status.h:82
GListPtr fillers
Definition: status.h:295
GListPtr rsc_tickets
Definition: status.h:274
const char * placement_strategy
Definition: status.h:89
gboolean unseen
Definition: status.h:140
int failure_timeout
Definition: status.h:262
int remote_reconnect_interval
Definition: status.h:301
GListPtr ordering_constraints
Definition: status.h:104
node_t * node
Definition: status.h:311
GListPtr colocation_constraints
Definition: status.h:105
action_t * action
Definition: status.h:419
int stickiness
Definition: status.h:260
GListPtr actions
Definition: status.h:273
gboolean maintenance
Definition: status.h:159
pe_ordering
Definition: status.h:377
const char * localhost
Definition: status.h:123
GHashTable * meta
Definition: status.h:284
node_t * pe_find_node_any(GListPtr node_list, const char *id, const char *uname)
Definition: status.c:270
enum pe_link_state state
Definition: status.h:418
gboolean standby_onfail
Definition: status.h:137
int seen_count
Definition: status.h:328
GListPtr ticket_constraints
Definition: status.h:106
int disabled_resources
Definition: status.h:127
gboolean cluster_status(pe_working_set_t *data_set)
Definition: status.c:51
GHashTable * attrs
Definition: status.h:151
enum rsc_role_e next_role
Definition: status.h:282
gboolean online
Definition: status.h:135
gboolean shutdown
Definition: status.h:141
gboolean rsc_discovery_enabled
Definition: status.h:160
GListPtr actions_after
Definition: status.h:354
enum rsc_role_e fail_role
Definition: status.h:321
gboolean remote_requires_reset
Definition: status.h:161
char * id
Definition: status.h:366
enum node_type type
Definition: status.h:152
node_t * allocated_to
Definition: status.h:276
rsc_role_e
Definition: common.h:81
node_t * pe_find_node_id(GListPtr node_list, const char *id)
Definition: status.c:282
enum pe_action_flags flags
Definition: status.h:318
GHashTable * known_on
Definition: status.h:278
gboolean standby
Definition: status.h:361
Definition: status.h:365
struct resource_alloc_functions_s resource_alloc_functions_t
Definition: complex.h:59
gboolean expected_up
Definition: status.h:142
int rsc_discover_mode
Definition: status.h:170
gboolean granted
Definition: status.h:359
Definition: status.h:165
gboolean remote_was_fenced
Definition: status.h:162
int num_resources
Definition: status.h:145
resource_t * rsc
Definition: status.h:310
GHashTable * singletons
Definition: status.h:99
unsigned long long flags
Definition: status.h:91
resource_alloc_functions_t * cmds
Definition: status.h:254
xmlNode * ops_xml
Definition: status.h:248
resource_t * pe_find_resource(GListPtr rsc_list, const char *id_rh)
Definition: status.c:252
char * id
Definition: status.h:358
GList * GListPtr
Definition: crm.h:198
crm_time_t * now
Definition: status.h:83
struct pe_working_set_s pe_working_set_t
GHashTable * template_rsc_sets
Definition: status.h:122
const char * rsc_printable_id(resource_t *rsc)
Definition: utils.c:2018
GHashTable * state
Definition: status.h:362
int required_runnable_before
Definition: status.h:351
GListPtr allocated_rsc
Definition: status.h:147
int priority
Definition: status.h:259
xmlNode * graph
Definition: status.h:120
GListPtr running_on
Definition: status.h:277