pacemaker 2.1.4-dc6eb4362e
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
19extern "C" {
20#endif
21
22typedef enum {
27
29typedef struct crm_graph_s crm_graph_t;
30
36};
37
38typedef struct synapse_s {
39 int id;
41
42 uint32_t flags; // Group of pcmk__synapse_flags
43
44 GList *actions; /* crm_action_t* */
45 GList *inputs; /* crm_action_t* */
47
48const 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
72typedef struct crm_action_s {
73 int id;
76 GHashTable *params;
78
81
82 uint32_t flags; // Group of pcmk__graph_action_flags
83
84 xmlNode *xml;
85
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
108};
109
110/* order matters here */
116};
117
119 int id;
120 char *source;
122
123 gboolean complete;
124 const char *abort_reason;
126
129
133
134 int fired;
139
140 GList *synapses; /* synapse_t* */
141
143};
144
145typedef 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
164crm_graph_t *pcmk__unpack_graph(xmlNode *xml_graph, const char *reference);
167void pcmk__free_graph(crm_graph_t *graph);
168const char *pcmk__graph_status2text(enum transition_status state);
169void pcmk__log_graph(unsigned int log_level, crm_graph_t *graph);
170void 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
A dumping ground.
const char * action
Definition: pcmk_fence.c:29
pcmk__graph_action_flags
@ pcmk__graph_action_confirmed
@ pcmk__graph_action_sent_update
@ pcmk__graph_action_can_fail
@ pcmk__graph_action_failed
@ pcmk__graph_action_executed
crm_graph_t * pcmk__unpack_graph(xmlNode *xml_graph, const char *reference)
void pcmk__log_graph(unsigned int log_level, crm_graph_t *graph)
void pcmk__free_graph(crm_graph_t *graph)
const char * synapse_state_str(synapse_t *synapse)
transition_status
@ transition_action_failed
@ transition_active
@ transition_failed
@ transition_complete
@ transition_terminated
@ transition_pending
@ transition_stopped
enum transition_status pcmk__execute_graph(crm_graph_t *graph)
void pcmk__update_graph(crm_graph_t *graph, crm_action_t *action)
struct synapse_s synapse_t
void pcmk__log_graph_action(int log_level, crm_action_t *action)
pcmk__synapse_flags
@ pcmk__synapse_ready
@ pcmk__synapse_executed
@ pcmk__synapse_confirmed
@ pcmk__synapse_failed
transition_action
@ tg_shutdown
@ tg_done
@ tg_stop
@ tg_restart
void pcmk__set_graph_functions(crm_graph_functions_t *fns)
lrmd_event_data_t * pcmk__event_from_graph_action(xmlNode *resource, crm_action_t *action, int status, int rc, const char *exit_reason)
const char * action_state_str(crm_action_t *action)
const char * pcmk__graph_status2text(enum transition_status state)
action_type_e
@ action_type_rsc
@ action_type_pseudo
@ action_type_crm
struct crm_action_s crm_action_t
struct crm_graph_functions_s crm_graph_functions_t
synapse_t * synapse
action_type_e type
GHashTable * params
crm_action_timer_t * timer
gboolean(* stonith)(crm_graph_t *graph, crm_action_t *action)
gboolean(* pseudo)(crm_graph_t *graph, crm_action_t *action)
gboolean(* crmd)(crm_graph_t *graph, crm_action_t *action)
gboolean(* rsc)(crm_graph_t *graph, crm_action_t *action)
gboolean(* allowed)(crm_graph_t *graph, crm_action_t *action)
enum transition_action completion_action
const char * abort_reason
gboolean complete
GList * inputs
uint32_t flags
GList * actions
crm_action_t * action
Wrappers for and extensions to libxml2.