This source file includes following definitions.
- pcmk__colocated_resources
1
2
3
4
5
6
7
8
9
10 #include <crm_internal.h>
11 #include <crm/msg_xml.h>
12 #include <pacemaker-internal.h>
13
14 #include "libpacemaker_private.h"
15
16
17 GList *
18 pcmk__colocated_resources(pe_resource_t *rsc, pe_resource_t *orig_rsc,
19 GList *colocated_rscs)
20 {
21 GList *gIter = NULL;
22
23 if (orig_rsc == NULL) {
24 orig_rsc = rsc;
25 }
26
27 if ((rsc == NULL) || (g_list_find(colocated_rscs, rsc) != NULL)) {
28 return colocated_rscs;
29 }
30
31 pe_rsc_trace(orig_rsc, "%s is in colocation chain with %s",
32 rsc->id, orig_rsc->id);
33 colocated_rscs = g_list_append(colocated_rscs, rsc);
34
35
36 for (gIter = rsc->rsc_cons; gIter != NULL; gIter = gIter->next) {
37 pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data;
38 pe_resource_t *primary = constraint->primary;
39
40 if (primary == orig_rsc) {
41 continue;
42 }
43
44 if ((constraint->score == INFINITY) &&
45 (pcmk__colocation_affects(rsc, primary, constraint,
46 true) == pcmk__coloc_affects_location)) {
47
48 colocated_rscs = primary->cmds->colocated_resources(primary,
49 orig_rsc,
50 colocated_rscs);
51 }
52 }
53
54
55 for (gIter = rsc->rsc_cons_lhs; gIter != NULL; gIter = gIter->next) {
56 pcmk__colocation_t *constraint = (pcmk__colocation_t *) gIter->data;
57 pe_resource_t *dependent = constraint->dependent;
58
59 if (dependent == orig_rsc) {
60 continue;
61 }
62
63 if (pe_rsc_is_clone(rsc) && !pe_rsc_is_clone(dependent)) {
64 continue;
65 }
66
67 if ((constraint->score == INFINITY) &&
68 (pcmk__colocation_affects(dependent, rsc, constraint,
69 true) == pcmk__coloc_affects_location)) {
70
71 colocated_rscs = dependent->cmds->colocated_resources(dependent,
72 orig_rsc,
73 colocated_rscs);
74 }
75 }
76
77 return colocated_rscs;
78 }