pacemaker  2.1.9-49aab99839
Scalable High-Availability cluster resource manager
action_relation_internal.h
Go to the documentation of this file.
1 /*
2  * Copyright 2023-2024 the Pacemaker project contributors
3  *
4  * The version control history for this file may have further details.
5  *
6  * This source code is licensed under the GNU Lesser General Public License
7  * version 2.1 or later (LGPLv2.1+) WITHOUT ANY WARRANTY.
8  */
9 
10 #ifndef PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H
11 #define PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H
12 
13 #include <stdint.h> // uint32_t
14 #include <crm/common/scheduler_types.h> // pcmk_resource_t, pcmk_action_t
15 
25 
27  pcmk__ar_ordered = (1U << 0),
28 
31 
38 
44 
50 
56 
59 
62 
65 
76 
92 
103  pcmk__ar_serialize = (1U << 14),
104 
107 
110 
113 
115  pcmk__ar_asymmetric = (1U << 20),
116 
119 
121  pcmk__ar_min_runnable = (1U << 22),
122 
125 
128 
131 };
132 
133 /* Action relation object
134  *
135  * The most common type of relation is an ordering, in which case action1 etc.
136  * refers to the "first" action, and action2 etc. refers to the "then" action.
137  */
138 typedef struct {
139  int id; // Counter to identify relation
140  uint32_t flags; // Group of enum pcmk__action_relation_flags
141  pcmk_resource_t *rsc1; // Resource for first action, if any
142  pcmk_action_t *action1; // First action in relation
143  char *task1; // Action name or key for first action
144  pcmk_resource_t *rsc2; // Resource for second action, if any
145  pcmk_action_t *action2; // Second action in relation
146  char *task2; // Action name or key for second action
148 
150 
158 #define pcmk__set_relation_flags(ar_flags, flags_to_set) do { \
159  ar_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
160  "Action relation", "constraint", \
161  ar_flags, (flags_to_set), \
162  #flags_to_set); \
163  } while (0)
164 
172 #define pcmk__clear_relation_flags(ar_flags, flags_to_clear) do { \
173  ar_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
174  "Action relation", "constraint", \
175  ar_flags, (flags_to_clear), \
176  #flags_to_clear); \
177  } while (0)
178 
179 #endif // PCMK__CRM_COMMON_ACTION_RELATION_INTERNAL__H
Relation applies only if actions are on same node.
&#39;then&#39; is runnable (and migratable) only if &#39;first&#39; is runnable
Actions are ordered if on same node (or migration target for migrate_to)
User-configured asymmetric ordering.
Type aliases needed to define scheduler objects.
If &#39;first&#39; is unrunnable, &#39;then&#39; becomes a real, unmigratable action.
If &#39;first&#39; is required, &#39;then&#39; action for instance on same node is.
Ordering applies even if &#39;first&#39; runs on guest node created by &#39;then&#39;.
pcmk__action_relation_flags
Actions are ordered (optionally, if no other flags are set)
Ordering applies only if &#39;first&#39; is required and on same node as &#39;then&#39;.
If &#39;then&#39; is required, &#39;first&#39; must be added to the transition graph.
If &#39;first&#39; is required and runnable, &#39;then&#39; must be in graph.
Relation applies only if &#39;first&#39; cannot be part of a live migration.
If &#39;then&#39; action becomes required, &#39;first&#39; becomes optional.
&#39;then&#39; action is runnable if certain number of &#39;first&#39; instances are
No relation (compare with equality rather than bit set)