MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / start_test

Function start_test

lrmd/test.c:179–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

177}
178
179static gboolean
180start_test(gpointer user_data)
181{
182 int rc = 0;
183
184 if (!options.no_connect) {
185 try_connect();
186 }
187 lrmd_conn->cmds->set_callback(lrmd_conn, read_events);
188
189 if (options.timeout) {
190 g_timeout_add(options.timeout, timeout_err, NULL);
191 }
192
193 if (!options.api_call) {
194 return 0;
195 }
196
197 if (safe_str_eq(options.api_call, "exec")) {
198 rc = lrmd_conn->cmds->exec(lrmd_conn,
199 options.rsc_id,
200 options.action,
201 NULL,
202 options.interval,
203 options.timeout,
204 options.start_delay, exec_call_opts, options.params);
205
206 if (rc > 0) {
207 exec_call_id = rc;
208 print_result(printf("API-CALL 'exec' action pending, waiting on response\n"));
209 }
210
211 } else if (safe_str_eq(options.api_call, "register_rsc")) {
212 rc = lrmd_conn->cmds->register_rsc(lrmd_conn,
213 options.rsc_id,
214 options.class, options.provider, options.type, 0);
215 } else if (safe_str_eq(options.api_call, "get_rsc_info")) {
216 lrmd_rsc_info_t *rsc_info;
217
218 rsc_info = lrmd_conn->cmds->get_rsc_info(lrmd_conn, options.rsc_id, 0);
219
220 if (rsc_info) {
221 print_result(printf("RSC_INFO: id:%s class:%s provider:%s type:%s\n",
222 rsc_info->id, rsc_info->class,
223 rsc_info->provider ? rsc_info->provider : "<none>",
224 rsc_info->type));
225 lrmd_free_rsc_info(rsc_info);
226 rc = pcmk_ok;
227 } else {
228 rc = -1;
229 }
230 } else if (safe_str_eq(options.api_call, "unregister_rsc")) {
231 rc = lrmd_conn->cmds->unregister_rsc(lrmd_conn, options.rsc_id, 0);
232 } else if (safe_str_eq(options.api_call, "cancel")) {
233 rc = lrmd_conn->cmds->cancel(lrmd_conn, options.rsc_id, options.action, options.interval);
234 } else if (safe_str_eq(options.api_call, "metadata")) {
235 char *output = NULL;
236

Callers

nothing calls this directly

Calls 4

try_connectFunction · 0.85
lrmd_free_rsc_infoFunction · 0.85
lrmd_list_freeallFunction · 0.85
test_exitFunction · 0.85

Tested by

no test coverage detected