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

Function activateCibXml

cib/io.c:503–534  ·  view source on GitHub ↗

* This method will free the old CIB pointer on success and the new one * on failure. */

Source from the content-addressed store, hash-verified

501 * on failure.
502 */
503int
504activateCibXml(xmlNode * new_cib, gboolean to_disk, const char *op)
505{
506 xmlNode *saved_cib = the_cib;
507
508 CRM_ASSERT(new_cib != saved_cib);
509 if (initializeCib(new_cib) == FALSE) {
510 free_xml(new_cib);
511 crm_err("Ignoring invalid or NULL CIB");
512
513 if (saved_cib != NULL) {
514 crm_warn("Reverting to last known CIB");
515 if (initializeCib(saved_cib) == FALSE) {
516 /* oh we are so dead */
517 crm_crit("Couldn't re-initialize the old CIB!");
518 exit(1);
519 }
520
521 } else {
522 crm_crit("Could not write out new CIB and no saved" " version to revert to");
523 }
524 return -ENODATA;
525 }
526
527 free_xml(saved_cib);
528 if (cib_writes_enabled && cib_status == pcmk_ok && to_disk) {
529 crm_debug("Triggering CIB write for %s op", op);
530 mainloop_set_trigger(cib_writer);
531 }
532
533 return pcmk_ok;
534}
535
536static void cib_diskwrite_complete(GPid pid, gint status, gpointer user_data)
537{

Callers 2

cib_process_commandFunction · 0.85
startCibFunction · 0.85

Calls 3

initializeCibFunction · 0.85
free_xmlFunction · 0.85
mainloop_set_triggerFunction · 0.85

Tested by

no test coverage detected