pacemaker  2.1.4-dc6eb4362
Scalable High-Availability cluster resource manager
pcmki_transition.h
Go to the documentation of this file.
1 /*
2  * Copyright 2004-2021 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 
18 #ifdef __cplusplus
19 extern "C" {
20 #endif
21 
22 typedef enum {
27 
29 typedef struct crm_graph_s crm_graph_t;
30 
32  pcmk__synapse_ready = (1 << 0),
36 };
37 
38 typedef struct synapse_s {
39  int id;
40  int priority;
41 
42  uint32_t flags; // Group of pcmk__synapse_flags
43 
44  GList *actions; /* crm_action_t* */
45  GList *inputs; /* crm_action_t* */
46 } synapse_t;
47 
48 const char *synapse_state_str(synapse_t *synapse);
49 
50 #define pcmk__set_synapse_flags(synapse, flags_to_set) do { \
51  (synapse)->flags = pcmk__set_flags_as(__func__, __LINE__, \
52  LOG_TRACE, \
53  "Synapse", "synapse", \
54  (synapse)->flags, (flags_to_set), #flags_to_set); \
55  } while (0)
56 
57 #define pcmk__clear_synapse_flags(synapse, flags_to_clear) do { \
58  (synapse)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
59  LOG_TRACE, \
60  "Synapse", "synapse", \
61  (synapse)->flags, (flags_to_clear), #flags_to_clear); \
62  } while (0)
63 
65  pcmk__graph_action_sent_update = (1 << 0), /* sent to the CIB */
66  pcmk__graph_action_executed = (1 << 1), /* sent to the CRM */
70 };
71 
72 typedef struct crm_action_s {
73  int id;
74  int timeout;
75  guint interval_ms;
76  GHashTable *params;
78 
81 
82  uint32_t flags; // Group of pcmk__graph_action_flags
83 
84  xmlNode *xml;
85 
86 } crm_action_t;
87 
89 
90 #define crm__set_graph_action_flags(action, flags_to_set) do { \
91  (action)->flags = pcmk__set_flags_as(__func__, __LINE__, \
92  LOG_TRACE, \
93  "Action", "action", \
94  (action)->flags, (flags_to_set), #flags_to_set); \
95  } while (0)
96 
97 #define crm__clear_graph_action_flags(action, flags_to_clear) do { \
98  (action)->flags = pcmk__clear_flags_as(__func__, __LINE__, \
99  LOG_TRACE, \
100  "Action", "action", \
101  (action)->flags, (flags_to_clear), #flags_to_clear); \
102  } while (0)
103 
104 struct te_timer_s {
106  int timeout;
108 };
109 
110 /* order matters here */
116 };
117 
118 struct crm_graph_s {
119  int id;
120  char *source;
122 
123  gboolean complete;
124  const char *abort_reason;
126 
129 
133 
134  int fired;
135  int pending;
136  int skipped;
139 
140  GList *synapses; /* synapse_t* */
141 
143 };
144 
145 typedef struct crm_graph_functions_s {
146  gboolean(*pseudo) (crm_graph_t * graph, crm_action_t * action);
147  gboolean(*rsc) (crm_graph_t * graph, crm_action_t * action);
148  gboolean(*crmd) (crm_graph_t * graph, crm_action_t * action);
149  gboolean(*stonith) (crm_graph_t * graph, crm_action_t * action);
150  gboolean(*allowed) (crm_graph_t * graph, crm_action_t * action);
152 
155  transition_pending, /* active but no actions performed this time */
161 };
162 
164 crm_graph_t *pcmk__unpack_graph(xmlNode *xml_graph, const char *reference);
167 void pcmk__free_graph(crm_graph_t *graph);
168 const char *pcmk__graph_status2text(enum transition_status state);
169 void pcmk__log_graph(unsigned int log_level, crm_graph_t *graph);
170 void pcmk__log_graph_action(int log_level, crm_action_t *action);
173  int status, int rc,
174  const char *exit_reason);
175 
176 #ifdef __cplusplus
177 }
178 #endif
179 
180 #endif
void pcmk__update_graph(crm_graph_t *graph, crm_action_t *action)
A dumping ground.
action_type_e type
const char * pcmk__graph_status2text(enum transition_status state)
enum transition_action completion_action
struct synapse_s synapse_t
struct crm_graph_functions_s crm_graph_functions_t
transition_status
gboolean(* stonith)(crm_graph_t *graph, crm_action_t *action)
GHashTable * params
crm_action_timer_t * timer
const char * action
Definition: pcmk_fence.c:29
uint32_t flags
gboolean(* crmd)(crm_graph_t *graph, crm_action_t *action)
const char * action_state_str(crm_action_t *action)
lrmd_event_data_t * pcmk__event_from_graph_action(xmlNode *resource, crm_action_t *action, int status, int rc, const char *exit_reason)
GList * inputs
void pcmk__set_graph_functions(crm_graph_functions_t *fns)
GList * actions
Wrappers for and extensions to libxml2.
void pcmk__free_graph(crm_graph_t *graph)
gboolean complete
gboolean(* rsc)(crm_graph_t *graph, crm_action_t *action)
void pcmk__log_graph(unsigned int log_level, crm_graph_t *graph)
void pcmk__log_graph_action(int log_level, crm_action_t *action)
gboolean(* pseudo)(crm_graph_t *graph, crm_action_t *action)
struct crm_action_s crm_action_t
pcmk__synapse_flags
const char * synapse_state_str(synapse_t *synapse)
transition_action
enum transition_status pcmk__execute_graph(crm_graph_t *graph)
crm_graph_t * pcmk__unpack_graph(xmlNode *xml_graph, const char *reference)
action_type_e
gboolean(* allowed)(crm_graph_t *graph, crm_action_t *action)
crm_action_t * action
synapse_t * synapse
const char * abort_reason
pcmk__graph_action_flags