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

Function send_peer_reply

cib/callbacks.c:577–624  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

575}
576
577static gboolean
578send_peer_reply(xmlNode * msg, xmlNode * result_diff, const char *originator, gboolean broadcast)
579{
580 CRM_ASSERT(msg != NULL);
581
582 if (broadcast) {
583 /* this (successful) call modified the CIB _and_ the
584 * change needs to be broadcast...
585 * send via HA to other nodes
586 */
587 int diff_add_updates = 0;
588 int diff_add_epoch = 0;
589 int diff_add_admin_epoch = 0;
590
591 int diff_del_updates = 0;
592 int diff_del_epoch = 0;
593 int diff_del_admin_epoch = 0;
594
595 const char *digest = NULL;
596
597 digest = crm_element_value(result_diff, XML_ATTR_DIGEST);
598 cib_diff_version_details(result_diff,
599 &diff_add_admin_epoch, &diff_add_epoch, &diff_add_updates,
600 &diff_del_admin_epoch, &diff_del_epoch, &diff_del_updates);
601
602 crm_trace("Sending update diff %d.%d.%d -> %d.%d.%d %s",
603 diff_del_admin_epoch, diff_del_epoch, diff_del_updates,
604 diff_add_admin_epoch, diff_add_epoch, diff_add_updates, digest);
605
606 crm_xml_add(msg, F_CIB_ISREPLY, originator);
607 crm_xml_add(msg, F_CIB_GLOBAL_UPDATE, XML_BOOLEAN_TRUE);
608 crm_xml_add(msg, F_CIB_OPERATION, CIB_OP_APPLY_DIFF);
609
610 CRM_ASSERT(digest != NULL);
611
612 add_message_xml(msg, F_CIB_UPDATE_DIFF, result_diff);
613 crm_log_xml_trace(msg, "copy");
614 return send_cluster_message(NULL, crm_msg_cib, msg, TRUE);
615
616 } else if (originator != NULL) {
617 /* send reply via HA to originating node */
618 crm_trace("Sending request result to originator only");
619 crm_xml_add(msg, F_CIB_ISREPLY, originator);
620 return send_cluster_message(crm_get_peer(0, originator), crm_msg_cib, msg, FALSE);
621 }
622
623 return FALSE;
624}
625
626void
627cib_process_request(xmlNode * request, gboolean force_synchronous, gboolean privileged,

Callers 1

cib_process_requestFunction · 0.85

Calls 6

crm_element_valueFunction · 0.85
cib_diff_version_detailsFunction · 0.85
crm_xml_addFunction · 0.85
add_message_xmlFunction · 0.85
send_cluster_messageFunction · 0.85
crm_get_peerFunction · 0.85

Tested by

no test coverage detected