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

Function ccm_age_connect

tools/crm_node.c:304–351  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

302}
303
304static gboolean
305ccm_age_connect(int *ccm_fd)
306{
307 gboolean did_fail = FALSE;
308 int ret = 0;
309
310 int (*ccm_api_register) (oc_ev_t ** token) =
311 find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_register", 1);
312
313 int (*ccm_api_set_callback) (const oc_ev_t * token,
314 oc_ev_class_t class,
315 oc_ev_callback_t * fn,
316 oc_ev_callback_t ** prev_fn) =
317 find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_set_callback", 1);
318
319 void (*ccm_api_special) (const oc_ev_t *, oc_ev_class_t, int) =
320 find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_special", 1);
321 int (*ccm_api_activate) (const oc_ev_t * token, int *fd) =
322 find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_activate", 1);
323
324 crm_debug("Registering with CCM");
325 ret = (*ccm_api_register) (&ccm_token);
326 if (ret != 0) {
327 crm_info("CCM registration failed: %d", ret);
328 did_fail = TRUE;
329 }
330
331 if (did_fail == FALSE) {
332 crm_debug("Setting up CCM callbacks");
333 ret = (*ccm_api_set_callback) (ccm_token, OC_EV_MEMB_CLASS, ccm_age_callback, NULL);
334 if (ret != 0) {
335 crm_warn("CCM callback not set: %d", ret);
336 did_fail = TRUE;
337 }
338 }
339 if (did_fail == FALSE) {
340 (*ccm_api_special) (ccm_token, OC_EV_MEMB_CLASS, 0 /*don't care */ );
341
342 crm_debug("Activating CCM token");
343 ret = (*ccm_api_activate) (ccm_token, ccm_fd);
344 if (ret != 0) {
345 crm_warn("CCM Activation failed: %d", ret);
346 did_fail = TRUE;
347 }
348 }
349
350 return !did_fail;
351}
352
353static gboolean
354try_heartbeat(int command, enum cluster_type_e stack)

Callers 1

try_heartbeatFunction · 0.85

Calls 1

find_library_functionFunction · 0.85

Tested by

no test coverage detected