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