This source file includes following definitions.
- pcmk__colocation_has_influence
1
2
3
4
5
6
7
8
9
10 #ifndef PCMK__LIBPACEMAKER_PRIVATE__H
11 # define PCMK__LIBPACEMAKER_PRIVATE__H
12
13
14
15
16
17 #include <crm/pengine/pe_types.h>
18
19
20 enum pcmk__coloc_select {
21
22 pcmk__coloc_select_default = 0,
23
24
25 pcmk__coloc_select_this_with = (1 << 0),
26
27
28 pcmk__coloc_select_nonnegative = (1 << 1),
29
30
31 pcmk__coloc_select_active = (1 << 2),
32 };
33
34
35 enum pcmk__updated {
36 pcmk__updated_none = 0,
37 pcmk__updated_first = (1 << 0),
38 pcmk__updated_then = (1 << 1),
39 };
40
41 #define pcmk__set_updated_flags(au_flags, action, flags_to_set) do { \
42 au_flags = pcmk__set_flags_as(__func__, __LINE__, \
43 LOG_TRACE, "Action update", \
44 (action)->uuid, au_flags, \
45 (flags_to_set), #flags_to_set); \
46 } while (0)
47
48 #define pcmk__clear_updated_flags(au_flags, action, flags_to_clear) do { \
49 au_flags = pcmk__clear_flags_as(__func__, __LINE__, \
50 LOG_TRACE, "Action update", \
51 (action)->uuid, au_flags, \
52 (flags_to_clear), #flags_to_clear); \
53 } while (0)
54
55
56 struct resource_alloc_functions_s {
57
58
59
60
61
62
63
64
65
66 pe_node_t *(*assign)(pe_resource_t *rsc, const pe_node_t *prefer);
67
68
69
70
71
72
73
74 void (*create_actions)(pe_resource_t *rsc);
75
76
77
78
79
80
81
82
83
84
85 bool (*create_probe)(pe_resource_t *rsc, pe_node_t *node);
86
87
88
89
90
91
92
93 void (*internal_constraints)(pe_resource_t *rsc);
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108 void (*apply_coloc_score) (pe_resource_t *dependent,
109 const pe_resource_t *primary,
110 const pcmk__colocation_t *colocation,
111 bool for_dependent);
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130 GList *(*colocated_resources)(pe_resource_t *rsc, pe_resource_t *orig_rsc,
131 GList *colocated_rscs);
132
133
134
135
136
137
138
139
140 void (*apply_location)(pe_resource_t *rsc, pe__location_t *location);
141
142
143
144
145
146
147
148
149
150
151
152
153
154 enum pe_action_flags (*action_flags)(pe_action_t *action,
155 const pe_node_t *node);
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179 uint32_t (*update_ordered_actions)(pe_action_t *first, pe_action_t *then,
180 const pe_node_t *node, uint32_t flags,
181 uint32_t filter, uint32_t type,
182 pe_working_set_t *data_set);
183
184 void (*output_actions)(pe_resource_t *rsc);
185
186
187
188
189
190
191
192 void (*add_actions_to_graph)(pe_resource_t *rsc);
193
194
195
196
197
198
199
200
201
202
203
204 void (*add_graph_meta)(pe_resource_t *rsc, xmlNode *xml);
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221 void (*add_utilization)(const pe_resource_t *rsc,
222 const pe_resource_t *orig_rsc, GList *all_rscs,
223 GHashTable *utilization);
224
225
226
227
228
229
230
231 void (*shutdown_lock)(pe_resource_t *rsc);
232 };
233
234
235
236 G_GNUC_INTERNAL
237 void pcmk__update_action_for_orderings(pe_action_t *action,
238 pe_working_set_t *data_set);
239
240 G_GNUC_INTERNAL
241 uint32_t pcmk__update_ordered_actions(pe_action_t *first, pe_action_t *then,
242 const pe_node_t *node, uint32_t flags,
243 uint32_t filter, uint32_t type,
244 pe_working_set_t *data_set);
245
246 G_GNUC_INTERNAL
247 void pcmk__log_action(const char *pre_text, pe_action_t *action, bool details);
248
249 G_GNUC_INTERNAL
250 pe_action_t *pcmk__new_cancel_action(pe_resource_t *rsc, const char *name,
251 guint interval_ms, const pe_node_t *node);
252
253 G_GNUC_INTERNAL
254 pe_action_t *pcmk__new_shutdown_action(pe_node_t *node);
255
256 G_GNUC_INTERNAL
257 bool pcmk__action_locks_rsc_to_node(const pe_action_t *action);
258
259 G_GNUC_INTERNAL
260 void pcmk__deduplicate_action_inputs(pe_action_t *action);
261
262 G_GNUC_INTERNAL
263 void pcmk__output_actions(pe_working_set_t *data_set);
264
265 G_GNUC_INTERNAL
266 bool pcmk__check_action_config(pe_resource_t *rsc, pe_node_t *node,
267 xmlNode *xml_op);
268
269 G_GNUC_INTERNAL
270 void pcmk__handle_rsc_config_changes(pe_working_set_t *data_set);
271
272
273
274
275 G_GNUC_INTERNAL
276 void pcmk__create_recurring_actions(pe_resource_t *rsc);
277
278 G_GNUC_INTERNAL
279 void pcmk__schedule_cancel(pe_resource_t *rsc, const char *call_id,
280 const char *task, guint interval_ms,
281 const pe_node_t *node, const char *reason);
282
283 G_GNUC_INTERNAL
284 void pcmk__reschedule_recurring(pe_resource_t *rsc, const char *task,
285 guint interval_ms, pe_node_t *node);
286
287 G_GNUC_INTERNAL
288 bool pcmk__action_is_recurring(const pe_action_t *action);
289
290
291
292
293 G_GNUC_INTERNAL
294 bool pcmk__graph_has_loop(pe_action_t *init_action, pe_action_t *action,
295 pe_action_wrapper_t *input);
296
297 G_GNUC_INTERNAL
298 void pcmk__add_rsc_actions_to_graph(pe_resource_t *rsc);
299
300 G_GNUC_INTERNAL
301 void pcmk__create_graph(pe_working_set_t *data_set);
302
303
304
305
306 G_GNUC_INTERNAL
307 void pcmk__order_vs_fence(pe_action_t *stonith_op, pe_working_set_t *data_set);
308
309 G_GNUC_INTERNAL
310 void pcmk__order_vs_unfence(pe_resource_t *rsc, pe_node_t *node,
311 pe_action_t *action, enum pe_ordering order);
312
313 G_GNUC_INTERNAL
314 void pcmk__fence_guest(pe_node_t *node);
315
316 G_GNUC_INTERNAL
317 bool pcmk__node_unfenced(pe_node_t *node);
318
319 G_GNUC_INTERNAL
320 void pcmk__order_restart_vs_unfence(gpointer data, gpointer user_data);
321
322
323
324
325 void pcmk__inject_scheduler_input(pe_working_set_t *data_set, cib_t *cib,
326 pcmk_injections_t *injections);
327
328
329
330
331 G_GNUC_INTERNAL
332 pe_resource_t *pcmk__find_constraint_resource(GList *rsc_list, const char *id);
333
334 G_GNUC_INTERNAL
335 xmlNode *pcmk__expand_tags_in_sets(xmlNode *xml_obj,
336 pe_working_set_t *data_set);
337
338 G_GNUC_INTERNAL
339 bool pcmk__valid_resource_or_tag(pe_working_set_t *data_set, const char *id,
340 pe_resource_t **rsc, pe_tag_t **tag);
341
342 G_GNUC_INTERNAL
343 bool pcmk__tag_to_set(xmlNode *xml_obj, xmlNode **rsc_set, const char *attr,
344 bool convert_rsc, pe_working_set_t *data_set);
345
346 G_GNUC_INTERNAL
347 void pcmk__create_internal_constraints(pe_working_set_t *data_set);
348
349
350
351
352 G_GNUC_INTERNAL
353 void pcmk__unpack_location(xmlNode *xml_obj, pe_working_set_t *data_set);
354
355 G_GNUC_INTERNAL
356 pe__location_t *pcmk__new_location(const char *id, pe_resource_t *rsc,
357 int node_weight, const char *discover_mode,
358 pe_node_t *foo_node,
359 pe_working_set_t *data_set);
360
361 G_GNUC_INTERNAL
362 void pcmk__apply_locations(pe_working_set_t *data_set);
363
364 G_GNUC_INTERNAL
365 void pcmk__apply_location(pe_resource_t *rsc, pe__location_t *constraint);
366
367
368
369
370 enum pcmk__coloc_affects {
371 pcmk__coloc_affects_nothing = 0,
372 pcmk__coloc_affects_location,
373 pcmk__coloc_affects_role,
374 };
375
376 G_GNUC_INTERNAL
377 enum pcmk__coloc_affects pcmk__colocation_affects(const pe_resource_t *dependent,
378 const pe_resource_t *primary,
379 const pcmk__colocation_t *colocation,
380 bool preview);
381
382 G_GNUC_INTERNAL
383 void pcmk__apply_coloc_to_weights(pe_resource_t *dependent,
384 const pe_resource_t *primary,
385 const pcmk__colocation_t *colocation);
386
387 G_GNUC_INTERNAL
388 void pcmk__apply_coloc_to_priority(pe_resource_t *dependent,
389 const pe_resource_t *primary,
390 const pcmk__colocation_t *colocation);
391
392 G_GNUC_INTERNAL
393 void pcmk__add_colocated_node_scores(pe_resource_t *rsc, const char *log_id,
394 GHashTable **nodes, const char *attr,
395 float factor, uint32_t flags);
396
397 G_GNUC_INTERNAL
398 void pcmk__unpack_colocation(xmlNode *xml_obj, pe_working_set_t *data_set);
399
400 G_GNUC_INTERNAL
401 void pcmk__add_this_with(pe_resource_t *rsc, pcmk__colocation_t *colocation);
402
403 G_GNUC_INTERNAL
404 void pcmk__add_with_this(pe_resource_t *rsc, pcmk__colocation_t *colocation);
405
406 G_GNUC_INTERNAL
407 void pcmk__new_colocation(const char *id, const char *node_attr, int score,
408 pe_resource_t *dependent, pe_resource_t *primary,
409 const char *dependent_role, const char *primary_role,
410 bool influence, pe_working_set_t *data_set);
411
412 G_GNUC_INTERNAL
413 void pcmk__block_colocation_dependents(pe_action_t *action,
414 pe_working_set_t *data_set);
415
416
417
418
419
420
421
422
423
424
425
426
427
428 static inline bool
429 pcmk__colocation_has_influence(const pcmk__colocation_t *colocation,
430 const pe_resource_t *rsc)
431 {
432 if (rsc == NULL) {
433 rsc = colocation->primary;
434 }
435
436
437
438
439
440
441
442
443
444
445
446
447
448 if (pcmk_is_set(colocation->dependent->flags, pe_rsc_allow_remote_remotes)
449 && !pcmk_is_set(rsc->flags, pe_rsc_failed)
450 && pcmk__list_of_1(rsc->running_on)) {
451 return false;
452 }
453
454
455
456
457 return colocation->influence || (rsc->running_on == NULL);
458 }
459
460
461
462
463 G_GNUC_INTERNAL
464 void pcmk__new_ordering(pe_resource_t *first_rsc, char *first_task,
465 pe_action_t *first_action, pe_resource_t *then_rsc,
466 char *then_task, pe_action_t *then_action,
467 uint32_t flags, pe_working_set_t *data_set);
468
469 G_GNUC_INTERNAL
470 void pcmk__unpack_ordering(xmlNode *xml_obj, pe_working_set_t *data_set);
471
472 G_GNUC_INTERNAL
473 void pcmk__disable_invalid_orderings(pe_working_set_t *data_set);
474
475 G_GNUC_INTERNAL
476 void pcmk__order_stops_before_shutdown(pe_node_t *node,
477 pe_action_t *shutdown_op);
478
479 G_GNUC_INTERNAL
480 void pcmk__apply_orderings(pe_working_set_t *data_set);
481
482 G_GNUC_INTERNAL
483 void pcmk__order_after_each(pe_action_t *after, GList *list);
484
485
486
487
488
489
490
491
492
493
494
495
496
497 #define pcmk__order_resource_actions(first_rsc, first_task, \
498 then_rsc, then_task, flags) \
499 pcmk__new_ordering((first_rsc), \
500 pcmk__op_key((first_rsc)->id, (first_task), 0), \
501 NULL, \
502 (then_rsc), \
503 pcmk__op_key((then_rsc)->id, (then_task), 0), \
504 NULL, (flags), (first_rsc)->cluster)
505
506 #define pcmk__order_starts(rsc1, rsc2, flags) \
507 pcmk__order_resource_actions((rsc1), CRMD_ACTION_START, \
508 (rsc2), CRMD_ACTION_START, (flags))
509
510 #define pcmk__order_stops(rsc1, rsc2, flags) \
511 pcmk__order_resource_actions((rsc1), CRMD_ACTION_STOP, \
512 (rsc2), CRMD_ACTION_STOP, (flags))
513
514
515
516
517 G_GNUC_INTERNAL
518 void pcmk__unpack_rsc_ticket(xmlNode *xml_obj, pe_working_set_t *data_set);
519
520
521
522
523 G_GNUC_INTERNAL
524 void pcmk__add_promotion_scores(pe_resource_t *rsc);
525
526 G_GNUC_INTERNAL
527 void pcmk__require_promotion_tickets(pe_resource_t *rsc);
528
529 G_GNUC_INTERNAL
530 void pcmk__set_instance_roles(pe_resource_t *rsc);
531
532 G_GNUC_INTERNAL
533 void pcmk__create_promotable_actions(pe_resource_t *clone);
534
535 G_GNUC_INTERNAL
536 void pcmk__promotable_restart_ordering(pe_resource_t *rsc);
537
538 G_GNUC_INTERNAL
539 void pcmk__order_promotable_instances(pe_resource_t *clone);
540
541 G_GNUC_INTERNAL
542 void pcmk__update_dependent_with_promotable(const pe_resource_t *primary,
543 pe_resource_t *dependent,
544 const pcmk__colocation_t *colocation);
545
546 G_GNUC_INTERNAL
547 void pcmk__update_promotable_dependent_priority(const pe_resource_t *primary,
548 pe_resource_t *dependent,
549 const pcmk__colocation_t *colocation);
550
551
552
553
554 G_GNUC_INTERNAL
555 bool pcmk__is_failed_remote_node(pe_node_t *node);
556
557 G_GNUC_INTERNAL
558 void pcmk__order_remote_connection_actions(pe_working_set_t *data_set);
559
560 G_GNUC_INTERNAL
561 bool pcmk__rsc_corresponds_to_guest(pe_resource_t *rsc, pe_node_t *node);
562
563 G_GNUC_INTERNAL
564 pe_node_t *pcmk__connection_host_for_action(pe_action_t *action);
565
566 G_GNUC_INTERNAL
567 void pcmk__substitute_remote_addr(pe_resource_t *rsc, GHashTable *params);
568
569 G_GNUC_INTERNAL
570 void pcmk__add_bundle_meta_to_xml(xmlNode *args_xml, pe_action_t *action);
571
572
573
574
575 G_GNUC_INTERNAL
576 pe_node_t *pcmk__primitive_assign(pe_resource_t *rsc, const pe_node_t *prefer);
577
578 G_GNUC_INTERNAL
579 void pcmk__primitive_create_actions(pe_resource_t *rsc);
580
581 G_GNUC_INTERNAL
582 void pcmk__primitive_internal_constraints(pe_resource_t *rsc);
583
584 G_GNUC_INTERNAL
585 enum pe_action_flags pcmk__primitive_action_flags(pe_action_t *action,
586 const pe_node_t *node);
587
588 G_GNUC_INTERNAL
589 void pcmk__primitive_apply_coloc_score(pe_resource_t *dependent,
590 const pe_resource_t *primary,
591 const pcmk__colocation_t *colocation,
592 bool for_dependent);
593
594 G_GNUC_INTERNAL
595 void pcmk__schedule_cleanup(pe_resource_t *rsc, const pe_node_t *node,
596 bool optional);
597
598 G_GNUC_INTERNAL
599 void pcmk__primitive_add_graph_meta(pe_resource_t *rsc, xmlNode *xml);
600
601 G_GNUC_INTERNAL
602 void pcmk__primitive_add_utilization(const pe_resource_t *rsc,
603 const pe_resource_t *orig_rsc,
604 GList *all_rscs, GHashTable *utilization);
605
606 G_GNUC_INTERNAL
607 void pcmk__primitive_shutdown_lock(pe_resource_t *rsc);
608
609
610
611
612 G_GNUC_INTERNAL
613 pe_node_t *pcmk__group_assign(pe_resource_t *rsc, const pe_node_t *prefer);
614
615 G_GNUC_INTERNAL
616 void pcmk__group_create_actions(pe_resource_t *rsc);
617
618 G_GNUC_INTERNAL
619 void pcmk__group_internal_constraints(pe_resource_t *rsc);
620
621 G_GNUC_INTERNAL
622 void pcmk__group_apply_coloc_score(pe_resource_t *dependent,
623 const pe_resource_t *primary,
624 const pcmk__colocation_t *colocation,
625 bool for_dependent);
626
627 G_GNUC_INTERNAL
628 void pcmk__group_apply_location(pe_resource_t *rsc, pe__location_t *location);
629
630 G_GNUC_INTERNAL
631 enum pe_action_flags pcmk__group_action_flags(pe_action_t *action,
632 const pe_node_t *node);
633
634 G_GNUC_INTERNAL
635 uint32_t pcmk__group_update_ordered_actions(pe_action_t *first,
636 pe_action_t *then,
637 const pe_node_t *node,
638 uint32_t flags, uint32_t filter,
639 uint32_t type,
640 pe_working_set_t *data_set);
641
642 G_GNUC_INTERNAL
643 GList *pcmk__group_colocated_resources(pe_resource_t *rsc,
644 pe_resource_t *orig_rsc,
645 GList *colocated_rscs);
646
647 G_GNUC_INTERNAL
648 void pcmk__group_add_utilization(const pe_resource_t *rsc,
649 const pe_resource_t *orig_rsc, GList *all_rscs,
650 GHashTable *utilization);
651
652 G_GNUC_INTERNAL
653 void pcmk__group_shutdown_lock(pe_resource_t *rsc);
654
655
656
657
658 G_GNUC_INTERNAL
659 void pcmk__clone_apply_coloc_score(pe_resource_t *dependent,
660 const pe_resource_t *primary,
661 const pcmk__colocation_t *colocation,
662 bool for_dependent);
663
664
665
666 G_GNUC_INTERNAL
667 void pcmk__bundle_apply_coloc_score(pe_resource_t *dependent,
668 const pe_resource_t *primary,
669 const pcmk__colocation_t *colocation,
670 bool for_dependent);
671
672 G_GNUC_INTERNAL
673 void pcmk__output_bundle_actions(pe_resource_t *rsc);
674
675
676
677
678 G_GNUC_INTERNAL
679 xmlNode *pcmk__inject_node(cib_t *cib_conn, const char *node, const char *uuid);
680
681 G_GNUC_INTERNAL
682 xmlNode *pcmk__inject_node_state_change(cib_t *cib_conn, const char *node,
683 bool up);
684
685 G_GNUC_INTERNAL
686 xmlNode *pcmk__inject_resource_history(pcmk__output_t *out, xmlNode *cib_node,
687 const char *resource,
688 const char *lrm_name,
689 const char *rclass,
690 const char *rtype,
691 const char *rprovider);
692
693 G_GNUC_INTERNAL
694 void pcmk__inject_failcount(pcmk__output_t *out, xmlNode *cib_node,
695 const char *resource, const char *task,
696 guint interval_ms, int rc);
697
698 G_GNUC_INTERNAL
699 xmlNode *pcmk__inject_action_result(xmlNode *cib_resource,
700 lrmd_event_data_t *op, int target_rc);
701
702
703
704
705 G_GNUC_INTERNAL
706 bool pcmk__node_available(const pe_node_t *node, bool consider_score,
707 bool consider_guest);
708
709 G_GNUC_INTERNAL
710 bool pcmk__any_node_available(GHashTable *nodes);
711
712 G_GNUC_INTERNAL
713 GHashTable *pcmk__copy_node_table(GHashTable *nodes);
714
715 G_GNUC_INTERNAL
716 GList *pcmk__sort_nodes(GList *nodes, pe_node_t *active_node);
717
718 G_GNUC_INTERNAL
719 void pcmk__apply_node_health(pe_working_set_t *data_set);
720
721 G_GNUC_INTERNAL
722 pe_node_t *pcmk__top_allowed_node(const pe_resource_t *rsc,
723 const pe_node_t *node);
724
725
726
727
728 G_GNUC_INTERNAL
729 void pcmk__set_allocation_methods(pe_working_set_t *data_set);
730
731 G_GNUC_INTERNAL
732 bool pcmk__rsc_agent_changed(pe_resource_t *rsc, pe_node_t *node,
733 const xmlNode *rsc_entry, bool active_on_node);
734
735 G_GNUC_INTERNAL
736 GList *pcmk__rscs_matching_id(const char *id, pe_working_set_t *data_set);
737
738 G_GNUC_INTERNAL
739 GList *pcmk__colocated_resources(pe_resource_t *rsc, pe_resource_t *orig_rsc,
740 GList *colocated_rscs);
741
742 G_GNUC_INTERNAL
743 void pcmk__noop_add_graph_meta(pe_resource_t *rsc, xmlNode *xml);
744
745 G_GNUC_INTERNAL
746 void pcmk__output_resource_actions(pe_resource_t *rsc);
747
748 G_GNUC_INTERNAL
749 bool pcmk__finalize_assignment(pe_resource_t *rsc, pe_node_t *chosen,
750 bool force);
751
752 G_GNUC_INTERNAL
753 bool pcmk__assign_resource(pe_resource_t *rsc, pe_node_t *node, bool force);
754
755 G_GNUC_INTERNAL
756 void pcmk__unassign_resource(pe_resource_t *rsc);
757
758 G_GNUC_INTERNAL
759 bool pcmk__threshold_reached(pe_resource_t *rsc, pe_node_t *node,
760 pe_resource_t **failed);
761
762 G_GNUC_INTERNAL
763 void pcmk__sort_resources(pe_working_set_t *data_set);
764
765 G_GNUC_INTERNAL
766 gint pcmk__cmp_instance(gconstpointer a, gconstpointer b);
767
768 G_GNUC_INTERNAL
769 gint pcmk__cmp_instance_number(gconstpointer a, gconstpointer b);
770
771
772
773
774 G_GNUC_INTERNAL
775 bool pcmk__probe_rsc_on_node(pe_resource_t *rsc, pe_node_t *node);
776
777 G_GNUC_INTERNAL
778 void pcmk__order_probes(pe_working_set_t *data_set);
779
780 G_GNUC_INTERNAL
781 bool pcmk__probe_resource_list(GList *rscs, pe_node_t *node);
782
783 G_GNUC_INTERNAL
784 void pcmk__schedule_probes(pe_working_set_t *data_set);
785
786
787
788
789 void pcmk__create_migration_actions(pe_resource_t *rsc,
790 const pe_node_t *current);
791
792 void pcmk__abort_dangling_migration(void *data, void *user_data);
793
794 bool pcmk__rsc_can_migrate(const pe_resource_t *rsc, const pe_node_t *current);
795
796 void pcmk__order_migration_equivalents(pe__ordering_t *order);
797
798
799
800
801 G_GNUC_INTERNAL
802 int pcmk__compare_node_capacities(const pe_node_t *node1,
803 const pe_node_t *node2);
804
805 G_GNUC_INTERNAL
806 void pcmk__consume_node_capacity(GHashTable *current_utilization,
807 pe_resource_t *rsc);
808
809 G_GNUC_INTERNAL
810 void pcmk__release_node_capacity(GHashTable *current_utilization,
811 const pe_resource_t *rsc);
812
813 G_GNUC_INTERNAL
814 const pe_node_t *pcmk__ban_insufficient_capacity(pe_resource_t *rsc);
815
816 G_GNUC_INTERNAL
817 void pcmk__create_utilization_constraints(pe_resource_t *rsc,
818 GList *allowed_nodes);
819
820 G_GNUC_INTERNAL
821 void pcmk__show_node_capacities(const char *desc, pe_working_set_t *data_set);
822
823 #endif