pacemaker  2.1.8-3980678f03
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 <glib.h>
14 # include <crm/crm.h>
15 # include <crm/common/xml.h>
16 # include <crm/lrmd_events.h> // lrmd_event_data_t
17 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
26 };
27 
29  pcmk__synapse_ready = (1 << 0),
33 };
34 
35 typedef struct {
36  int id;
37  int priority;
38 
39  uint32_t flags; // Group of pcmk__synapse_flags
40 
41  GList *actions; /* pcmk__graph_action_t* */
42  GList *inputs; /* pcmk__graph_action_t* */
44 
45 #define pcmk__set_synapse_flags(synapse, flags_to_set) do { \
46  (synapse)->flags = pcmk__set_flags_as(__func__, __LINE__, \
47  LOG_TRACE, \
48  "Synapse", "synapse", \
49  (synapse)->flags, (flags_to_set), #flags_to_set); \
50  } while (0)
51 
52 #define pcmk__clear_synapse_flags(synapse, flags_to_clear) do { \
53  (synapse)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
54  LOG_TRACE, \
55  "Synapse", "synapse", \
56  (synapse)->flags, (flags_to_clear), #flags_to_clear); \
57  } while (0)
58 
60  pcmk__graph_action_sent_update = (1 << 0), /* sent to the CIB */
61  pcmk__graph_action_executed = (1 << 1), /* sent to the CRM */
65 };
66 
67 typedef struct {
68  int id;
69  int timeout;
70  int timer;
71  guint interval_ms;
72  GHashTable *params;
75 
76  uint32_t flags; // Group of pcmk__graph_action_flags
77 
78  xmlNode *xml;
79 
81 
82 #define pcmk__set_graph_action_flags(action, flags_to_set) do { \
83  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
84  LOG_TRACE, \
85  "Action", "action", \
86  (action)->flags, (flags_to_set), #flags_to_set); \
87  } while (0)
88 
89 #define pcmk__clear_graph_action_flags(action, flags_to_clear) do { \
90  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
91  LOG_TRACE, \
92  "Action", "action", \
93  (action)->flags, (flags_to_clear), #flags_to_clear); \
94  } while (0)
95 
96 // What to do after finished processing a transition graph
98  // Order matters: lowest priority to highest
99  pcmk__graph_done, // Transition complete, nothing further needed
100  pcmk__graph_wait, // Transition interrupted, wait for further changes
101  pcmk__graph_restart, // Transition interrupted, start a new one
102  pcmk__graph_shutdown, // Transition interrupted, local shutdown needed
103 };
104 
105 typedef struct {
106  int id;
107  char *source;
109 
110  bool complete;
111  const char *abort_reason;
112  enum pcmk__graph_next completion_action;
113 
116 
120 
121  int fired;
122  int pending;
123  int skipped;
126 
127  GList *synapses; /* pcmk__graph_synapse_t* */
128 
130 
133 
136 
138  time_t recheck_by;
139 } pcmk__graph_t;
140 
141 
142 typedef struct {
143  int (*pseudo) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
145  int (*cluster) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
146  int (*fence) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
147  bool (*allowed) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
149 
151  pcmk__graph_active, // Some actions have been performed
152  pcmk__graph_pending, // No actions performed yet
155 };
156 
158 pcmk__graph_t *pcmk__unpack_graph(const xmlNode *xml_graph,
159  const char *reference);
163 void pcmk__free_graph(pcmk__graph_t *graph);
164 const char *pcmk__graph_status2text(enum pcmk__graph_status state);
165 void pcmk__log_graph(unsigned int log_level, pcmk__graph_t *graph);
167 void pcmk__log_transition_summary(const char *filename);
168 lrmd_event_data_t *pcmk__event_from_graph_action(const xmlNode *resource,
170  int status, int rc,
171  const char *exit_reason);
172 
173 #ifdef __cplusplus
174 }
175 #endif
176 
177 #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:51
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