pacemaker  2.1.7-0f7f88312f
Scalable High-Availability cluster resource manager
pcmki_transition.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2023 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 <glib.h>
14 # include <crm/crm.h>
15 # include <crm/msg_xml.h>
16 # include <crm/common/xml.h>
17 # include <crm/lrmd_events.h> // lrmd_event_data_t
18 
19 #ifdef __cplusplus
20 extern "C" {
21 #endif
22 
27 };
28 
30  pcmk__synapse_ready = (1 << 0),
34 };
35 
36 typedef struct {
37  int id;
38  int priority;
39 
40  uint32_t flags; // Group of pcmk__synapse_flags
41 
42  GList *actions; /* pcmk__graph_action_t* */
43  GList *inputs; /* pcmk__graph_action_t* */
45 
46 #define pcmk__set_synapse_flags(synapse, flags_to_set) do { \
47  (synapse)->flags = pcmk__set_flags_as(__func__, __LINE__, \
48  LOG_TRACE, \
49  "Synapse", "synapse", \
50  (synapse)->flags, (flags_to_set), #flags_to_set); \
51  } while (0)
52 
53 #define pcmk__clear_synapse_flags(synapse, flags_to_clear) do { \
54  (synapse)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
55  LOG_TRACE, \
56  "Synapse", "synapse", \
57  (synapse)->flags, (flags_to_clear), #flags_to_clear); \
58  } while (0)
59 
61  pcmk__graph_action_sent_update = (1 << 0), /* sent to the CIB */
62  pcmk__graph_action_executed = (1 << 1), /* sent to the CRM */
66 };
67 
68 typedef struct {
69  int id;
70  int timeout;
71  int timer;
72  guint interval_ms;
73  GHashTable *params;
76 
77  uint32_t flags; // Group of pcmk__graph_action_flags
78 
79  xmlNode *xml;
80 
82 
83 #define pcmk__set_graph_action_flags(action, flags_to_set) do { \
84  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
85  LOG_TRACE, \
86  "Action", "action", \
87  (action)->flags, (flags_to_set), #flags_to_set); \
88  } while (0)
89 
90 #define pcmk__clear_graph_action_flags(action, flags_to_clear) do { \
91  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
92  LOG_TRACE, \
93  "Action", "action", \
94  (action)->flags, (flags_to_clear), #flags_to_clear); \
95  } while (0)
96 
97 // What to do after finished processing a transition graph
99  // Order matters: lowest priority to highest
100  pcmk__graph_done, // Transition complete, nothing further needed
101  pcmk__graph_wait, // Transition interrupted, wait for further changes
102  pcmk__graph_restart, // Transition interrupted, start a new one
103  pcmk__graph_shutdown, // Transition interrupted, local shutdown needed
104 };
105 
106 typedef struct {
107  int id;
108  char *source;
110 
111  bool complete;
112  const char *abort_reason;
113  enum pcmk__graph_next completion_action;
114 
117 
121 
122  int fired;
123  int pending;
124  int skipped;
127 
128  GList *synapses; /* pcmk__graph_synapse_t* */
129 
131 
134 
137 
139  time_t recheck_by;
140 } pcmk__graph_t;
141 
142 
143 typedef struct {
144  int (*pseudo) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
146  int (*cluster) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
147  int (*fence) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
148  bool (*allowed) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
150 
152  pcmk__graph_active, // Some actions have been performed
153  pcmk__graph_pending, // No actions performed yet
156 };
157 
159 pcmk__graph_t *pcmk__unpack_graph(const xmlNode *xml_graph,
160  const char *reference);
164 void pcmk__free_graph(pcmk__graph_t *graph);
165 const char *pcmk__graph_status2text(enum pcmk__graph_status state);
166 void pcmk__log_graph(unsigned int log_level, pcmk__graph_t *graph);
168 void pcmk__log_transition_summary(const char *filename);
169 lrmd_event_data_t *pcmk__event_from_graph_action(const xmlNode *resource,
171  int status, int rc,
172  const char *exit_reason);
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif
A dumping ground.
char * failed_start_offset
Failcount after one failed start action.
pcmk__graph_action_type
enum crm_ais_msg_types type
Definition: cpg.c:48
const char * action
Definition: pcmk_fence.c:30
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)
Wrappers for and extensions to libxml2.
pcmk__graph_next
pcmk__graph_t * pcmk__unpack_graph(const xmlNode *xml_graph, const char *reference)
void pcmk__log_transition_summary(const char *filename)
const char * abort_reason
pcmk__graph_synapse_t * synapse
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)
Resource agent executor events.
pcmk__graph_action_flags