1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 #ifndef CRMD_FSA__H
19 # define CRMD_FSA__H
20
21 # include <fsa_defines.h>
22
23 # include <crm/crm.h>
24 # include <crm/cib.h>
25 # include <crm/common/xml.h>
26 # include <crm/common/mainloop.h>
27 # include <crm/cluster.h>
28 # include <crm/cluster/election.h>
29 # include <crm/common/ipcs.h>
30
31 # if SUPPORT_HEARTBEAT
32 extern ll_cluster_t *fsa_cluster_conn;
33 # endif
34
35
36
37
38
39 struct crm_subsystem_s {
40 pid_t pid;
41 const char *name;
42 const char *path;
43 const char *command;
44 const char *args;
45 crm_client_t *client;
46
47 gboolean sent_kill;
48 mainloop_io_t *source;
49 long long flag_connected;
50 long long flag_required;
51 };
52
53 typedef struct fsa_timer_s fsa_timer_t;
54 struct fsa_timer_s {
55 guint source_id;
56 int period_ms;
57 enum crmd_fsa_input fsa_input;
58 gboolean(*callback) (gpointer data);
59 gboolean repeat;
60 int counter;
61 };
62
63 enum fsa_data_type {
64 fsa_dt_none,
65 fsa_dt_ha_msg,
66 fsa_dt_xml,
67 fsa_dt_lrm,
68 };
69
70 typedef struct fsa_data_s fsa_data_t;
71 struct fsa_data_s {
72 int id;
73 enum crmd_fsa_input fsa_input;
74 enum crmd_fsa_cause fsa_cause;
75 long long actions;
76 const char *origin;
77 void *data;
78 enum fsa_data_type data_type;
79 };
80
81 extern enum crmd_fsa_state s_crmd_fsa(enum crmd_fsa_cause cause);
82
83
84 extern volatile gboolean do_fsa_stall;
85 extern volatile enum crmd_fsa_state fsa_state;
86 extern volatile long long fsa_input_register;
87 extern volatile long long fsa_actions;
88
89 extern cib_t *fsa_cib_conn;
90
91 extern char *fsa_our_uname;
92 extern char *fsa_our_uuid;
93 extern char *fsa_pe_ref;
94 extern char *fsa_our_dc;
95 extern char *fsa_our_dc_version;
96 extern GListPtr fsa_message_queue;
97
98 extern char *fsa_cluster_name;
99
100 extern election_t *fsa_election;
101 extern fsa_timer_t *election_trigger;
102 extern fsa_timer_t *election_timeout;
103 extern fsa_timer_t *shutdown_escalation_timer;
104 extern fsa_timer_t *transition_timer;
105 extern fsa_timer_t *integration_timer;
106 extern fsa_timer_t *finalization_timer;
107 extern fsa_timer_t *wait_timer;
108 extern fsa_timer_t *recheck_timer;
109
110 extern crm_trigger_t *fsa_source;
111 extern crm_trigger_t *config_read;
112
113 extern struct crm_subsystem_s *cib_subsystem;
114 extern struct crm_subsystem_s *te_subsystem;
115 extern struct crm_subsystem_s *pe_subsystem;
116
117
118 extern void do_update_cib_nodes(gboolean overwrite, const char *caller);
119 int crmd_cib_smart_opt(void);
120
121 # define AM_I_DC is_set(fsa_input_register, R_THE_DC)
122 # define AM_I_OPERATIONAL (is_set(fsa_input_register, R_STARTING)==FALSE)
123 extern unsigned long long saved_ccm_membership_id;
124 extern gboolean ever_had_quorum;
125
126 # include <fsa_proto.h>
127 # include <crmd_utils.h>
128
129 # define trigger_fsa(source) crm_trace("Triggering FSA: %s", __FUNCTION__); \
130 mainloop_set_trigger(source);
131
132 #endif