pacemaker  2.0.1-57cc9c14bf
Scalable High-Availability cluster resource manager
transition.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2004 Andrew Beekhof <andrew@beekhof.net>
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This software is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17  */
18 #ifndef CRM_TRANSITION__H
19 # define CRM_TRANSITION__H
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <crm/crm.h>
26 #include <crm/msg_xml.h>
27 #include <crm/common/xml.h>
28 
29 typedef enum {
34 
36 typedef struct crm_graph_s crm_graph_t;
37 
38 typedef struct synapse_s {
39  int id;
40  int priority;
41 
42  gboolean ready;
43  gboolean failed;
44  gboolean executed;
45  gboolean confirmed;
46 
47  GListPtr actions; /* crm_action_t* */
48  GListPtr inputs; /* crm_action_t* */
49 } synapse_t;
50 
51 typedef struct crm_action_s {
52  int id;
53  int timeout;
54  guint interval_ms;
55  GHashTable *params;
56  action_type_e type;
57 
60 
61  gboolean sent_update; /* sent to the CIB */
62  gboolean executed; /* sent to the CRM */
63  gboolean confirmed;
64 
65  gboolean failed;
66  gboolean can_fail;
67 
68  xmlNode *xml;
69 
70 } crm_action_t;
71 
72 struct te_timer_s {
73  int source_id;
74  int timeout;
76 };
77 
78 /* order matters here */
84 };
85 
86 struct crm_graph_s {
87  int id;
88  char *source;
90 
91  gboolean complete;
92  const char *abort_reason;
93  enum transition_action completion_action;
94 
97 
102 
103  int fired;
104  int pending;
105  int skipped;
108 
109  GListPtr synapses; /* synapse_t* */
110 
112 };
113 
114 typedef struct crm_graph_functions_s {
115  gboolean(*pseudo) (crm_graph_t * graph, crm_action_t * action);
116  gboolean(*rsc) (crm_graph_t * graph, crm_action_t * action);
117  gboolean(*crmd) (crm_graph_t * graph, crm_action_t * action);
118  gboolean(*stonith) (crm_graph_t * graph, crm_action_t * action);
119  gboolean(*allowed) (crm_graph_t * graph, crm_action_t * action);
121 
124  transition_pending, /* active but no actions performed this time */
130 };
131 
132 void set_default_graph_functions(void);
134 crm_graph_t *unpack_graph(xmlNode * xml_graph, const char *reference);
135 int run_graph(crm_graph_t * graph);
136 gboolean update_graph(crm_graph_t * graph, crm_action_t * action);
137 void destroy_graph(crm_graph_t * graph);
138 const char *transition_status(enum transition_status state);
139 void print_graph(unsigned int log_level, crm_graph_t * graph);
140 void print_action(int log_level, const char *prefix, crm_action_t * action);
141 bool update_abort_priority(crm_graph_t * graph, int priority,
142  enum transition_action action, const char *abort_reason);
143 const char *actiontype2text(action_type_e type);
144 lrmd_event_data_t *convert_graph_action(xmlNode * resource, crm_action_t * action, int status,
145  int rc);
146 
147 #ifdef __cplusplus
148 }
149 #endif
150 
151 #endif
GListPtr actions
Definition: transition.h:47
gboolean sent_update
Definition: transition.h:61
gboolean confirmed
Definition: transition.h:45
A dumping ground.
action_type_e type
Definition: transition.h:56
bool update_abort_priority(crm_graph_t *graph, int priority, enum transition_action action, const char *abort_reason)
Definition: utils.c:263
guint interval_ms
Definition: transition.h:54
xmlNode * xml
Definition: transition.h:68
void destroy_graph(crm_graph_t *graph)
Definition: unpack.c:280
void print_action(int log_level, const char *prefix, crm_action_t *action)
Definition: utils.c:217
lrmd_event_data_t * convert_graph_action(xmlNode *resource, crm_action_t *action, int status, int rc)
Definition: unpack.c:297
struct synapse_s synapse_t
gboolean can_fail
Definition: transition.h:66
const char * actiontype2text(action_type_e type)
Definition: utils.c:105
void set_graph_functions(crm_graph_functions_t *fns)
Definition: utils.c:70
int num_synapses
Definition: transition.h:96
transition_action
Definition: transition.h:79
GHashTable * params
Definition: transition.h:55
crm_action_timer_t * timer
Definition: transition.h:58
gboolean ready
Definition: transition.h:42
int transition_timeout
Definition: transition.h:101
int incomplete
Definition: transition.h:107
int priority
Definition: transition.h:40
void set_default_graph_functions(void)
Definition: utils.c:64
void print_graph(unsigned int log_level, crm_graph_t *graph)
Definition: utils.c:223
gboolean executed
Definition: transition.h:62
Wrappers for and extensions to libxml2.
transition_status
Definition: transition.h:122
GListPtr synapses
Definition: transition.h:109
gboolean complete
Definition: transition.h:91
gboolean update_graph(crm_graph_t *graph, crm_action_t *action)
Definition: graph.c:102
struct crm_action_s crm_action_t
int stonith_timeout
Definition: transition.h:100
int batch_limit
Definition: transition.h:98
GListPtr inputs
Definition: transition.h:48
gboolean failed
Definition: transition.h:43
crm_graph_t * unpack_graph(xmlNode *xml_graph, const char *reference)
Definition: unpack.c:172
char * source
Definition: transition.h:88
int network_delay
Definition: transition.h:99
int num_actions
Definition: transition.h:95
gboolean failed
Definition: transition.h:65
int migration_limit
Definition: transition.h:111
int run_graph(crm_graph_t *graph)
Definition: graph.c:247
int timeout
Definition: transition.h:74
int abort_priority
Definition: transition.h:89
struct crm_graph_functions_s crm_graph_functions_t
int source_id
Definition: transition.h:73
gboolean confirmed
Definition: transition.h:63
crm_action_t * action
Definition: transition.h:75
action_type_e
Definition: transition.h:29
GList * GListPtr
Definition: crm.h:190
gboolean executed
Definition: transition.h:44
synapse_t * synapse
Definition: transition.h:59
const char * abort_reason
Definition: transition.h:92
enum crm_ais_msg_types type
Definition: internal.h:83