pacemaker  1.1.17-b36b869ca8
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 #include <crm/crm.h>
22 #include <crm/msg_xml.h>
23 #include <crm/common/xml.h>
24 
25 typedef enum {
30 
32 
33 typedef struct synapse_s {
34  int id;
35  int priority;
36 
37  gboolean ready;
38  gboolean failed;
39  gboolean executed;
40  gboolean confirmed;
41 
42  GListPtr actions; /* crm_action_t* */
43  GListPtr inputs; /* crm_action_t* */
44 } synapse_t;
45 
46 typedef struct crm_action_s {
47  int id;
48  int timeout;
49  int interval;
50  GHashTable *params;
52 
55 
56  gboolean sent_update; /* sent to the CIB */
57  gboolean executed; /* sent to the CRM */
58  gboolean confirmed;
59 
60  gboolean failed;
61  gboolean can_fail;
62 
63  xmlNode *xml;
64 
65 } crm_action_t;
66 
67 /* @COMPAT: This enum has deprecated. It has apparently never been used in a
68  * Pacemaker release, but it is kept for API backward compatibility.
69  */
74 };
75 
76 struct te_timer_s {
77  int source_id;
78  int timeout;
79  enum timer_reason reason; /* @COMPAT: unused, API backward compatibility */
81 };
82 
83 /* order matters here */
89 };
90 
91 typedef struct crm_graph_s {
92  int id;
93  char *source;
95 
96  gboolean complete;
97  const char *abort_reason;
98  enum transition_action completion_action;
99 
102 
107 
108  int fired;
109  int pending;
110  int skipped;
113 
114  GListPtr synapses; /* synpase_t* */
115 
117 
118 } crm_graph_t;
119 
120 typedef struct crm_graph_functions_s {
121  gboolean(*pseudo) (crm_graph_t * graph, crm_action_t * action);
122  gboolean(*rsc) (crm_graph_t * graph, crm_action_t * action);
123  gboolean(*crmd) (crm_graph_t * graph, crm_action_t * action);
124  gboolean(*stonith) (crm_graph_t * graph, crm_action_t * action);
125  gboolean(*allowed) (crm_graph_t * graph, crm_action_t * action);
127 
130  transition_pending, /* active but no actions performed this time */
136 };
137 
138 void set_default_graph_functions(void);
140 crm_graph_t *unpack_graph(xmlNode * xml_graph, const char *reference);
141 int run_graph(crm_graph_t * graph);
142 gboolean update_graph(crm_graph_t * graph, crm_action_t * action);
143 void destroy_graph(crm_graph_t * graph);
144 const char *transition_status(enum transition_status state);
145 void print_graph(unsigned int log_level, crm_graph_t * graph);
146 void print_action(int log_level, const char *prefix, crm_action_t * action);
147 bool update_abort_priority(crm_graph_t * graph, int priority,
148  enum transition_action action, const char *abort_reason);
149 const char *actiontype2text(action_type_e type);
150 lrmd_event_data_t *convert_graph_action(xmlNode * resource, crm_action_t * action, int status,
151  int rc);
152 
153 #endif
GListPtr actions
Definition: transition.h:42
gboolean sent_update
Definition: transition.h:56
gboolean confirmed
Definition: transition.h:40
A dumping ground.
action_type_e type
Definition: transition.h:51
bool update_abort_priority(crm_graph_t *graph, int priority, enum transition_action action, const char *abort_reason)
Definition: utils.c:263
xmlNode * xml
Definition: transition.h:63
void destroy_graph(crm_graph_t *graph)
Definition: unpack.c:276
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:293
struct synapse_s synapse_t
gboolean can_fail
Definition: transition.h:61
const char * actiontype2text(action_type_e type)
Definition: utils.c:105
void set_graph_functions(crm_graph_functions_t *fns)
Definition: utils.c:70
struct crm_graph_s crm_graph_t
int num_synapses
Definition: transition.h:101
transition_action
Definition: transition.h:84
GHashTable * params
Definition: transition.h:50
crm_action_timer_t * timer
Definition: transition.h:53
gboolean ready
Definition: transition.h:37
int transition_timeout
Definition: transition.h:106
int incomplete
Definition: transition.h:112
int priority
Definition: transition.h:35
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:57
Wrappers for and extensions to libxml2.
timer_reason
Definition: transition.h:70
transition_status
Definition: transition.h:128
GListPtr synapses
Definition: transition.h:114
gboolean complete
Definition: transition.h:96
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:105
int batch_limit
Definition: transition.h:103
GListPtr inputs
Definition: transition.h:43
gboolean failed
Definition: transition.h:38
crm_graph_t * unpack_graph(xmlNode *xml_graph, const char *reference)
Definition: unpack.c:168
char * source
Definition: transition.h:93
int network_delay
Definition: transition.h:104
int num_actions
Definition: transition.h:100
gboolean failed
Definition: transition.h:60
int migration_limit
Definition: transition.h:116
int run_graph(crm_graph_t *graph)
Definition: graph.c:247
int timeout
Definition: transition.h:78
int abort_priority
Definition: transition.h:94
struct crm_graph_functions_s crm_graph_functions_t
int source_id
Definition: transition.h:77
gboolean confirmed
Definition: transition.h:58
crm_action_t * action
Definition: transition.h:80
action_type_e
Definition: transition.h:25
GList * GListPtr
Definition: crm.h:202
gboolean executed
Definition: transition.h:39
synapse_t * synapse
Definition: transition.h:54
const char * abort_reason
Definition: transition.h:97
enum crm_ais_msg_types type
Definition: internal.h:51