pacemaker  3.0.0-d8340737c4
Scalable High-Availability cluster resource manager
pcmki_transition.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-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__PCMKI_PCMKI_TRANSITION__H
11 #define PCMK__PCMKI_PCMKI_TRANSITION__H
12 
13 #include <stdbool.h> // bool
14 #include <stdint.h> // uint32_t
15 #include <sys/types.h> // time_t
16 #include <glib.h> // guint, GList, GHashTable
17 #include <libxml/tree.h> // xmlNode
18 
19 #include <crm/common/scheduler_types.h> // pcmk_scheduler_t
20 #include <crm/lrmd_events.h> // lrmd_event_data_t
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
30 };
31 
33  pcmk__synapse_ready = (1 << 0),
37 };
38 
39 typedef struct {
40  int id;
41  int priority;
42 
43  uint32_t flags; // Group of pcmk__synapse_flags
44 
45  GList *actions; /* pcmk__graph_action_t* */
46  GList *inputs; /* pcmk__graph_action_t* */
48 
49 #define pcmk__set_synapse_flags(synapse, flags_to_set) do { \
50  (synapse)->flags = pcmk__set_flags_as(__func__, __LINE__, \
51  LOG_TRACE, \
52  "Synapse", "synapse", \
53  (synapse)->flags, (flags_to_set), #flags_to_set); \
54  } while (0)
55 
56 #define pcmk__clear_synapse_flags(synapse, flags_to_clear) do { \
57  (synapse)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
58  LOG_TRACE, \
59  "Synapse", "synapse", \
60  (synapse)->flags, (flags_to_clear), #flags_to_clear); \
61  } while (0)
62 
64  pcmk__graph_action_sent_update = (1 << 0), /* sent to the CIB */
65  pcmk__graph_action_executed = (1 << 1), /* sent to the CRM */
68 };
69 
70 typedef struct {
71  int id;
72  int timeout;
73  int timer;
74  guint interval_ms;
75  GHashTable *params;
78 
79  uint32_t flags; // Group of pcmk__graph_action_flags
80 
81  xmlNode *xml;
82 
84 
85 #define pcmk__set_graph_action_flags(action, flags_to_set) do { \
86  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
87  LOG_TRACE, \
88  "Action", "action", \
89  (action)->flags, (flags_to_set), #flags_to_set); \
90  } while (0)
91 
92 #define pcmk__clear_graph_action_flags(action, flags_to_clear) do { \
93  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
94  LOG_TRACE, \
95  "Action", "action", \
96  (action)->flags, (flags_to_clear), #flags_to_clear); \
97  } while (0)
98 
99 // What to do after finished processing a transition graph
101  // Order matters: lowest priority to highest
102  pcmk__graph_done, // Transition complete, nothing further needed
103  pcmk__graph_wait, // Transition interrupted, wait for further changes
104  pcmk__graph_restart, // Transition interrupted, start a new one
105  pcmk__graph_shutdown, // Transition interrupted, local shutdown needed
106 };
107 
108 typedef struct {
109  int id;
110  char *source;
112 
113  bool complete;
114  const char *abort_reason;
115  enum pcmk__graph_next completion_action;
116 
119 
123 
124  int fired;
125  int pending;
126  int skipped;
129 
130  GList *synapses; /* pcmk__graph_synapse_t* */
131 
133 
136 
139 
141  time_t recheck_by;
142 } pcmk__graph_t;
143 
144 
145 typedef struct {
146  int (*pseudo) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
148  int (*cluster) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
149  int (*fence) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
150  bool (*allowed) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
152 
154  pcmk__graph_active, // Some actions have been performed
155  pcmk__graph_pending, // No actions performed yet
158 };
159 
161 pcmk__graph_t *pcmk__unpack_graph(const xmlNode *xml_graph,
162  const char *reference);
166 void pcmk__free_graph(pcmk__graph_t *graph);
167 const char *pcmk__graph_status2text(enum pcmk__graph_status state);
168 void pcmk__log_graph(unsigned int log_level, pcmk__graph_t *graph);
171  const char *filename);
172 lrmd_event_data_t *pcmk__event_from_graph_action(const xmlNode *resource,
174  int status, int rc,
175  const char *exit_reason);
176 
177 #ifdef __cplusplus
178 }
179 #endif
180 
181 #endif // PCMK__PCMKI_PCMKI_TRANSITION__H
enum pcmk_ipc_server type
Definition: cpg.c:51
Type aliases needed to define scheduler objects.
char * failed_start_offset
Failcount after one failed start action.
pcmk__graph_action_type
const char * action
Definition: pcmk_fence.c:32
enum pcmk__graph_status pcmk__execute_graph(pcmk__graph_t *graph)
char * failed_stop_offset
Failcount after one failed stop action.
pcmk__graph_status
void pcmk__set_graph_functions(pcmk__graph_functions_t *fns)
lrmd_event_data_t * pcmk__event_from_graph_action(const xmlNode *resource, const pcmk__graph_action_t *action, int status, int rc, const char *exit_reason)
void pcmk__update_graph(pcmk__graph_t *graph, const pcmk__graph_action_t *action)
time_t recheck_by
Time (from epoch) by which the controller should re-run the scheduler.
void pcmk__free_graph(pcmk__graph_t *graph)
pcmk__graph_next
pcmk__graph_t * pcmk__unpack_graph(const xmlNode *xml_graph, const char *reference)
const char * abort_reason
pcmk__graph_synapse_t * synapse
pcmk_scheduler_t * scheduler
pcmk__synapse_flags
void pcmk__log_graph_action(int log_level, pcmk__graph_action_t *action)
const char * pcmk__graph_status2text(enum pcmk__graph_status state)
void pcmk__log_graph(unsigned int log_level, pcmk__graph_t *graph)
void pcmk__log_transition_summary(const pcmk_scheduler_t *scheduler, const char *filename)
Resource agent executor events.
pcmk__graph_action_flags