pacemaker 2.1.5-a3f44794f94
Scalable High-Availability cluster resource manager
pcmki_transition.h
Go to the documentation of this file.
1/*
2 * Copyright 2004-2022 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
26};
27
33};
34
35typedef struct {
36 int id;
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
67typedef struct {
68 int id;
70 int timer;
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
105typedef struct {
106 int id;
107 char *source;
109
111 const char *abort_reason;
113
116
120
121 int fired;
126
127 GList *synapses; /* pcmk__graph_synapse_t* */
128
131
132
133typedef struct {
134 int (*pseudo) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
136 int (*cluster) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
138 bool (*allowed) (pcmk__graph_t *graph, pcmk__graph_action_t *action);
140
142 pcmk__graph_active, // Some actions have been performed
143 pcmk__graph_pending, // No actions performed yet
146};
147
149pcmk__graph_t *pcmk__unpack_graph(xmlNode *xml_graph, const char *reference);
153const char *pcmk__graph_status2text(enum pcmk__graph_status state);
154void pcmk__log_graph(unsigned int log_level, pcmk__graph_t *graph);
156lrmd_event_data_t *pcmk__event_from_graph_action(const xmlNode *resource,
158 int status, int rc,
159 const char *exit_reason);
160
161#ifdef __cplusplus
162}
163#endif
164
165#endif
A dumping ground.
const char * action
Definition: pcmk_fence.c:30
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
pcmk__graph_next
@ pcmk__graph_done
@ pcmk__graph_restart
@ pcmk__graph_shutdown
@ pcmk__graph_wait
void pcmk__free_graph(pcmk__graph_t *graph)
void pcmk__log_graph_action(int log_level, pcmk__graph_action_t *action)
pcmk__graph_t * pcmk__unpack_graph(xmlNode *xml_graph, const char *reference)
void pcmk__update_graph(pcmk__graph_t *graph, pcmk__graph_action_t *action)
void pcmk__set_graph_functions(pcmk__graph_functions_t *fns)
const char * pcmk__graph_status2text(enum pcmk__graph_status state)
pcmk__synapse_flags
@ pcmk__synapse_ready
@ pcmk__synapse_executed
@ pcmk__synapse_confirmed
@ pcmk__synapse_failed
enum pcmk__graph_status pcmk__execute_graph(pcmk__graph_t *graph)
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)
pcmk__graph_status
@ pcmk__graph_pending
@ pcmk__graph_terminated
@ pcmk__graph_active
@ pcmk__graph_complete
void pcmk__log_graph(unsigned int log_level, pcmk__graph_t *graph)
pcmk__graph_action_type
@ pcmk__pseudo_graph_action
@ pcmk__cluster_graph_action
@ pcmk__rsc_graph_action
enum pcmk__graph_action_type type
pcmk__graph_synapse_t * synapse
enum pcmk__graph_next completion_action
const char * abort_reason
Wrappers for and extensions to libxml2.