pacemaker  3.0.0-d8340737c4
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 <stdbool.h> // bool
14 #include <stdint.h> // uint32_t
15 #include <crm/common/scheduler_types.h> // pcmk_resource_t, pcmk_action_t
16 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 // Flags to indicate the relationship between two actions
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 
149 // Action sequenced relative to another action
150 typedef struct pcmk__related_action {
151  pcmk_action_t *action; // Action to be sequenced
152  uint32_t flags; // Group of enum pcmk__action_relation_flags
153  bool graphed; // Whether action has been added to graph yet
155 
163 #define pcmk__set_relation_flags(ar_flags, flags_to_set) do { \
164  ar_flags = pcmk__set_flags_as(__func__, __LINE__, LOG_TRACE, \
165  "Action relation", "constraint", \
166  ar_flags, (flags_to_set), \
167  #flags_to_set); \
168  } while (0)
169 
177 #define pcmk__clear_relation_flags(ar_flags, flags_to_clear) do { \
178  ar_flags = pcmk__clear_flags_as(__func__, __LINE__, LOG_TRACE, \
179  "Action relation", "constraint", \
180  ar_flags, (flags_to_clear), \
181  #flags_to_clear); \
182  } while (0)
183 
184 #ifdef __cplusplus
185 }
186 #endif
187 
188 #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.
struct pcmk__related_action pcmk__related_action_t
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)