1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 #include <crmd_messages.h>
20 #include <crmd_metadata.h>
21
22 extern gboolean verify_stopped(enum crmd_fsa_state cur_state, int log_level);
23 extern void lrm_clear_last_failure(const char *rsc_id, const char *node_name,
24 const char *operation, int interval);
25 void lrm_op_callback(lrmd_event_data_t * op);
26 lrmd_t *crmd_local_lrmd_conn(void);
27
28 typedef struct resource_history_s {
29 char *id;
30 uint32_t last_callid;
31 lrmd_rsc_info_t rsc;
32 lrmd_event_data_t *last;
33 lrmd_event_data_t *failed;
34 GList *recurring_op_list;
35
36
37
38
39
40 GHashTable *stop_params;
41 } rsc_history_t;
42
43 void history_free(gpointer data);
44
45
46 struct recurring_op_s {
47 int call_id;
48 int interval;
49 gboolean remove;
50 gboolean cancelled;
51 unsigned int start_time;
52 char *rsc_id;
53 char *op_type;
54 char *op_key;
55 char *user_data;
56 GHashTable *params;
57 };
58
59 typedef struct lrm_state_s {
60 const char *node_name;
61
62 void *conn;
63
64 void *remote_ra_data;
65
66 GHashTable *resource_history;
67 GHashTable *pending_ops;
68 GHashTable *deletion_ops;
69 GHashTable *rsc_info_cache;
70 GHashTable *metadata_cache;
71
72 int num_lrm_register_fails;
73 } lrm_state_t;
74
75 struct pending_deletion_op_s {
76 char *rsc;
77 ha_msg_input_t *input;
78 };
79
80
81
82
83 gboolean
84 lrm_state_is_local(lrm_state_t *lrm_state);
85
86
87
88
89
90
91 void lrm_state_reset_tables(lrm_state_t * lrm_state, gboolean reset_metadata);
92 GList *lrm_state_get_list(void);
93
94
95
96
97 gboolean lrm_state_init_local(void);
98
99
100
101
102 void lrm_state_destroy_all(void);
103
104
105
106
107 lrm_state_t *lrm_state_create(const char *node_name);
108
109
110
111
112 void lrm_state_destroy(const char *node_name);
113
114
115
116
117 lrm_state_t *lrm_state_find(const char *node_name);
118
119
120
121
122 lrm_state_t *lrm_state_find_or_create(const char *node_name);
123
124
125
126
127
128
129
130
131 void lrm_state_disconnect_only(lrm_state_t * lrm_state);
132 void lrm_state_disconnect(lrm_state_t * lrm_state);
133 int lrm_state_ipc_connect(lrm_state_t * lrm_state);
134 int lrm_state_remote_connect_async(lrm_state_t * lrm_state, const char *server, int port,
135 int timeout);
136 int lrm_state_is_connected(lrm_state_t * lrm_state);
137 int lrm_state_poke_connection(lrm_state_t * lrm_state);
138
139 int lrm_state_get_metadata(lrm_state_t * lrm_state,
140 const char *class,
141 const char *provider,
142 const char *agent, char **output, enum lrmd_call_options options);
143 int lrm_state_cancel(lrm_state_t * lrm_state, const char *rsc_id, const char *action, int interval);
144 int lrm_state_exec(lrm_state_t * lrm_state, const char *rsc_id, const char *action, const char *userdata, int interval,
145 int timeout,
146 int start_delay,
147 lrmd_key_value_t * params);
148 lrmd_rsc_info_t *lrm_state_get_rsc_info(lrm_state_t * lrm_state,
149 const char *rsc_id, enum lrmd_call_options options);
150 int lrm_state_register_rsc(lrm_state_t * lrm_state,
151 const char *rsc_id,
152 const char *class,
153 const char *provider, const char *agent, enum lrmd_call_options options);
154 int lrm_state_unregister_rsc(lrm_state_t * lrm_state,
155 const char *rsc_id, enum lrmd_call_options options);
156
157
158 void remote_lrm_op_callback(lrmd_event_data_t * op);
159 gboolean is_remote_lrmd_ra(const char *agent, const char *provider, const char *id);
160 lrmd_rsc_info_t *remote_ra_get_rsc_info(lrm_state_t * lrm_state, const char *rsc_id);
161 int remote_ra_cancel(lrm_state_t * lrm_state, const char *rsc_id, const char *action, int interval);
162 int remote_ra_exec(lrm_state_t * lrm_state, const char *rsc_id, const char *action, const char *userdata, int interval,
163 int timeout,
164 int start_delay,
165 lrmd_key_value_t * params);
166 void remote_ra_cleanup(lrm_state_t * lrm_state);
167 void remote_ra_fail(const char *node_name);
168 void remote_ra_process_pseudo(xmlNode *xml);
169 gboolean remote_ra_is_in_maintenance(lrm_state_t * lrm_state);
170 void remote_ra_process_maintenance_nodes(xmlNode *xml);
171
172 gboolean process_lrm_event(lrm_state_t * lrm_state, lrmd_event_data_t * op, struct recurring_op_s *pending);