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

Function cib_process_diff

lib/cib/cib_ops.c:550–687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548}
549
550int
551cib_process_diff(const char *op, int options, const char *section, xmlNode * req, xmlNode * input,
552 xmlNode * existing_cib, xmlNode ** result_cib, xmlNode ** answer)
553{
554 unsigned int log_level = LOG_DEBUG;
555 const char *reason = NULL;
556 gboolean apply_diff = TRUE;
557 int result = pcmk_ok;
558
559 int this_updates = 0;
560 int this_epoch = 0;
561 int this_admin_epoch = 0;
562
563 int diff_add_updates = 0;
564 int diff_add_epoch = 0;
565 int diff_add_admin_epoch = 0;
566
567 int diff_del_updates = 0;
568 int diff_del_epoch = 0;
569 int diff_del_admin_epoch = 0;
570
571 const char *originator = NULL;
572
573 if (req != NULL) {
574 originator = crm_element_value(req, F_ORIG);
575 }
576 crm_trace("Processing \"%s\" event", op);
577
578 cib_diff_version_details(input,
579 &diff_add_admin_epoch, &diff_add_epoch, &diff_add_updates,
580 &diff_del_admin_epoch, &diff_del_epoch, &diff_del_updates);
581
582 crm_element_value_int(existing_cib, XML_ATTR_GENERATION, &this_epoch);
583 crm_element_value_int(existing_cib, XML_ATTR_NUMUPDATES, &this_updates);
584 crm_element_value_int(existing_cib, XML_ATTR_GENERATION_ADMIN, &this_admin_epoch);
585
586 if (this_epoch < 0) {
587 this_epoch = 0;
588 }
589 if (this_updates < 0) {
590 this_updates = 0;
591 }
592 if (this_admin_epoch < 0) {
593 this_admin_epoch = 0;
594 }
595
596 if (diff_del_admin_epoch == diff_add_admin_epoch
597 && diff_del_epoch == diff_add_epoch && diff_del_updates == diff_add_updates) {
598 if (options & cib_force_diff) {
599 apply_diff = FALSE;
600 log_level = LOG_ERR;
601 reason = "+ and - versions in the diff did not change in global update";
602 crm_log_xml_warn(input, "Bad global update");
603
604 } else if (diff_add_admin_epoch == -1 && diff_add_epoch == -1 && diff_add_updates == -1) {
605 diff_add_epoch = this_epoch;
606 diff_add_updates = this_updates + 1;
607 diff_add_admin_epoch = this_admin_epoch;

Callers 3

cib_server_process_diffFunction · 0.85
cibmon_diffFunction · 0.85
cib_apply_patch_eventFunction · 0.85

Calls 6

crm_element_valueFunction · 0.85
cib_diff_version_detailsFunction · 0.85
crm_element_value_intFunction · 0.85
log_cib_diffFunction · 0.85
free_xmlFunction · 0.85
apply_xml_diffFunction · 0.85

Tested by

no test coverage detected