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

Function sync_our_cib

cib/messages.c:421–465  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

419
420#ifndef CIBPIPE
421int
422sync_our_cib(xmlNode * request, gboolean all)
423{
424 int result = pcmk_ok;
425 char *digest = NULL;
426 const char *host = crm_element_value(request, F_ORIG);
427 const char *op = crm_element_value(request, F_CIB_OPERATION);
428
429 xmlNode *replace_request = cib_msg_copy(request, FALSE);
430
431 CRM_CHECK(the_cib != NULL,;);
432 CRM_CHECK(replace_request != NULL,;);
433
434 crm_debug("Syncing CIB to %s", all ? "all peers" : host);
435 if (all == FALSE && host == NULL) {
436 crm_log_xml_err(request, "bad sync");
437 }
438
439 /* remove the "all == FALSE" condition
440 *
441 * sync_from was failing, the local client wasnt being notified
442 * because it didnt know it was a reply
443 * setting this does not prevent the other nodes from applying it
444 * if all == TRUE
445 */
446 if (host != NULL) {
447 crm_xml_add(replace_request, F_CIB_ISREPLY, host);
448 }
449 crm_xml_add(replace_request, F_CIB_OPERATION, CIB_OP_REPLACE);
450 crm_xml_add(replace_request, "original_" F_CIB_OPERATION, op);
451 crm_xml_add(replace_request, F_CIB_GLOBAL_UPDATE, XML_BOOLEAN_TRUE);
452
453 crm_xml_add(replace_request, XML_ATTR_CRM_VERSION, CRM_FEATURE_SET);
454 digest = calculate_xml_versioned_digest(the_cib, FALSE, TRUE, CRM_FEATURE_SET);
455 crm_xml_add(replace_request, XML_ATTR_DIGEST, digest);
456
457 add_message_xml(replace_request, F_CIB_CALLDATA, the_cib);
458
459 if (send_cluster_message(all ? NULL : crm_get_peer(0, host), crm_msg_cib, replace_request, FALSE) == FALSE) {
460 result = -ENOTCONN;
461 }
462 free_xml(replace_request);
463 free(digest);
464 return result;
465}
466#endif

Callers 2

cib_process_syncFunction · 0.85
cib_process_sync_oneFunction · 0.85

Calls 8

crm_element_valueFunction · 0.85
cib_msg_copyFunction · 0.85
crm_xml_addFunction · 0.85
add_message_xmlFunction · 0.85
send_cluster_messageFunction · 0.85
crm_get_peerFunction · 0.85
free_xmlFunction · 0.85

Tested by

no test coverage detected