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

Function ccm_age_callback

tools/crm_node.c:252–302  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

250}
251
252static void
253ccm_age_callback(oc_ed_t event, void *cookie, size_t size, const void *data)
254{
255 int lpc;
256 int node_list_size;
257 const oc_ev_membership_t *oc = (const oc_ev_membership_t *)data;
258
259 int (*ccm_api_callback_done) (void *cookie) =
260 find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_callback_done", 1);
261
262 node_list_size = oc->m_n_member;
263 if (command == 'q') {
264 crm_debug("Processing \"%s\" event.",
265 event == OC_EV_MS_NEW_MEMBERSHIP ? "NEW MEMBERSHIP" :
266 event == OC_EV_MS_NOT_PRIMARY ? "NOT PRIMARY" :
267 event == OC_EV_MS_PRIMARY_RESTORED ? "PRIMARY RESTORED" :
268 event == OC_EV_MS_EVICTED ? "EVICTED" : "NO QUORUM MEMBERSHIP");
269 if (ccm_have_quorum(event)) {
270 fprintf(stdout, "1\n");
271 } else {
272 fprintf(stdout, "0\n");
273 }
274
275 } else if (command == 'e') {
276 crm_debug("Searching %d members for our birth", oc->m_n_member);
277 }
278 for (lpc = 0; lpc < node_list_size; lpc++) {
279 if (command == 'p') {
280 fprintf(stdout, "%s ", oc->m_array[oc->m_memb_idx + lpc].node_uname);
281
282 } else if (command == 'e') {
283 int (*ccm_api_is_my_nodeid) (const oc_ev_t * token, const oc_node_t * node) =
284 find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_is_my_nodeid", 1);
285 if ((*ccm_api_is_my_nodeid) (ccm_token, &(oc->m_array[lpc]))) {
286 crm_debug("MATCH: nodeid=%d, uname=%s, born=%d",
287 oc->m_array[oc->m_memb_idx + lpc].node_id,
288 oc->m_array[oc->m_memb_idx + lpc].node_uname,
289 oc->m_array[oc->m_memb_idx + lpc].node_born_on);
290 fprintf(stdout, "%d\n", oc->m_array[oc->m_memb_idx + lpc].node_born_on);
291 }
292 }
293 }
294
295 (*ccm_api_callback_done) (cookie);
296
297 if (command == 'p') {
298 fprintf(stdout, "\n");
299 }
300 fflush(stdout);
301 crm_exit(0);
302}
303
304static gboolean
305ccm_age_connect(int *ccm_fd)

Callers

nothing calls this directly

Calls 3

find_library_functionFunction · 0.85
ccm_have_quorumFunction · 0.85
crm_exitFunction · 0.85

Tested by

no test coverage detected