Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
59 commits
Select commit Hold shift + click to select a range
6482197
Refactor: libcrmcommon: Include action_relation_internal.h at right spot
nrwahl2 Jan 5, 2026
59653a6
Refactor: based: Drop cib.pam file
nrwahl2 Dec 20, 2025
eb16c75
Refactor: based: New based_io_init() and make cib_writer static
nrwahl2 Dec 20, 2025
8cb3056
Refactor: based: Make write_cib_contents() static
nrwahl2 Dec 20, 2025
ffec81b
Refactor: based: Unindent code in write_cib_contents()
nrwahl2 Dec 20, 2025
863f5bb
Refactor: based: Use G_SOURCE_{CONTINUE,REMOVE} in write_cib_contents()
nrwahl2 Dec 20, 2025
7f3c827
Refactor: based: Drop exit_code variable in write_cib_contents()
nrwahl2 Dec 20, 2025
bd69ea6
Refactor: based: Don't copy the CIB in write_cib_contents()
nrwahl2 Dec 20, 2025
e71deb8
Refactor: based: Use pid_t in write_cib_contents()
nrwahl2 Dec 20, 2025
2c428b8
Refactor: based: Clarify blackbox state save-and-restore somewhat
nrwahl2 Dec 21, 2025
9d7ce3b
Refactor: based: Convert to standard return code in write_cib_contents()
nrwahl2 Dec 21, 2025
38f563b
Refactor: based: Rename write_cib_contents() to write_cib_async()
nrwahl2 Dec 21, 2025
0a90c2b
Refactor: libcrmcommon: Don't pass pid in mainloop child callback
nrwahl2 Dec 21, 2025
71b630a
Refactor: based: Best practices in cib_diskwrite_complete()
nrwahl2 Dec 21, 2025
0b216df
Refactor: based: Make cib_writes_enabled static to based_io.c
nrwahl2 Dec 21, 2025
1cbff21
Refactor: based: Don't compare against FALSE
nrwahl2 Dec 21, 2025
c3fa5b7
Refactor: based: Unindent retrieveCib()
nrwahl2 Dec 21, 2025
6244cb3
Refactor: based: Clarify variable names in readCibXmlFile()
nrwahl2 Dec 21, 2025
c955771
Refactor: based: Clarify argument names in retrieveCib()
nrwahl2 Dec 21, 2025
3b6ff1a
Refactor: based: Move more functionality into retrieveCib()
nrwahl2 Dec 21, 2025
a3dd843
Refactor: based: Drop startCib() argument
nrwahl2 Dec 21, 2025
c86f350
Refactor: based: Drop readCibXmlFile() cibfile argument
nrwahl2 Dec 21, 2025
b3a66ca
Refactor: based: Drop based_read_cib() discard_status argument
nrwahl2 Dec 21, 2025
d741bd4
Refactor: based: Drop retrieveCib() cibfile argument
nrwahl2 Dec 21, 2025
3f04585
Refactor: based: Drop based_read_cib() and retrieveCib() dir arguments
nrwahl2 Dec 21, 2025
fdbd2b9
Refactor: based: Make cib_archive_sort() behavior match comment
nrwahl2 Dec 22, 2025
1108e26
Refactor: based: Functionize finding and reading a backup CIB file
nrwahl2 Dec 21, 2025
f636cd7
Refactor: based: Rename retrieveCib() to read_current_cib()
nrwahl2 Dec 21, 2025
107e8f1
Refactor: based: Don't allocate sigfile string
nrwahl2 Dec 21, 2025
e48b649
Refactor: based: Rename root variable to cib_xml in based_read_cib()
nrwahl2 Dec 21, 2025
b87b110
Refactor: based: Convert to standard RC in read_{current,backup}_cib()
nrwahl2 Dec 21, 2025
87c2598
Refactor: based: Drop name/value variables from based_read_cib()
nrwahl2 Dec 21, 2025
34b86b6
Refactor: based: Functionize setting default version attributes
nrwahl2 Dec 21, 2025
874c343
Refactor: based: Functionize setting empty status element
nrwahl2 Dec 21, 2025
9d6c5dc
Refactor: based: Move disabling writes for valgrind to based_io_init()
nrwahl2 Dec 21, 2025
da102e8
Refactor: based: Best practices in cib_rename()
nrwahl2 Dec 21, 2025
c3b7561
Refactor: based: Archive CIB file and digest file in subdirectory
nrwahl2 Dec 22, 2025
039d1c1
Refactor: based: Simplify cib_archive_filter()
nrwahl2 Dec 22, 2025
9d2f5b2
Refactor: based: Simplify cib_archive_sort()
nrwahl2 Dec 22, 2025
1f549ed
Doc: based: Add Doxygen for based_read_cib()
nrwahl2 Dec 22, 2025
08b57b2
Refactor: based: Drop uninitializeCib()
nrwahl2 Dec 22, 2025
29cfde2
Refactor: based: activateCibXml() returns a standard return code
nrwahl2 Dec 22, 2025
0ce2428
Refactor: based: activateCibXml() CRM_CHECKs that new_cib != NULL
nrwahl2 Dec 22, 2025
98f8c2d
Refactor: based: Best practices in activateCibXml()
nrwahl2 Dec 22, 2025
9e5583a
Refactor: based: Drop unused includes from based_operation.c
nrwahl2 Dec 22, 2025
033142f
Refactor: based: New based_operation.h
nrwahl2 Dec 22, 2025
3980a99
Refactor: based: Avoid xmlNodePtr and clean up includes
nrwahl2 Dec 22, 2025
f7810a1
Refactor: based: New based_notify.h
nrwahl2 Dec 22, 2025
8b6e487
Refactor: libcib: Drop cib_diff_version_details()
nrwahl2 Dec 22, 2025
2c18599
Log: based: Drop redundant messages from based_diff_notify()
nrwahl2 Jan 4, 2026
24ad657
Refactor: libcrmcommon: New pcmk__mainloop_child_exit_fn_t typedef
nrwahl2 Jan 6, 2026
c475553
Refactor: based: Clean up includes in based_callbacks.c
nrwahl2 Jan 6, 2026
0a56e1e
Refactor: based: Clean up includes in based_io.c
nrwahl2 Jan 6, 2026
450cb05
Refactor: based: Clean up includes in based_messages.c
nrwahl2 Jan 6, 2026
f9afa95
Refactor: based: Clean up includes in based_notify.c
nrwahl2 Jan 6, 2026
88cc3b8
Refactor: based: Clean up includes in based_operation.c
nrwahl2 Jan 6, 2026
8b495ea
Refactor: based: Clean up includes in based_remote.c
nrwahl2 Jan 6, 2026
9fea5f5
Refactor: based: Clean up includes in based_transaction.c
nrwahl2 Jan 6, 2026
29a0801
Refactor: based: Clean up includes in pacemaker-based.c
nrwahl2 Jan 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions daemons/based/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,14 @@
include $(top_srcdir)/mk/common.mk
include $(top_srcdir)/mk/man.mk

EXTRA_DIST = cib.pam

halibdir = $(CRM_DAEMON_DIR)

halib_PROGRAMS = pacemaker-based

noinst_HEADERS = based_transaction.h
noinst_HEADERS = based_io.h
noinst_HEADERS += based_notify.h
noinst_HEADERS += based_operation.h
noinst_HEADERS += based_transaction.h
noinst_HEADERS += pacemaker-based.h

pacemaker_based_CFLAGS = $(CFLAGS_HARDENED_EXE)
Expand Down
65 changes: 37 additions & 28 deletions daemons/based/based_callbacks.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2004-2025 the Pacemaker project contributors
* Copyright 2004-2026 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
Expand All @@ -9,29 +9,39 @@

#include <crm_internal.h>

#include <sys/param.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

#include <errno.h> // EACCES, ECONNREFUSED
#include <inttypes.h> // PRIu64
#include <stdbool.h>
#include <stdlib.h>
#include <stdint.h> // uint32_t, uint64_t, UINT64_C()
#include <errno.h>
#include <fcntl.h>
#include <inttypes.h> // PRIu64

#include <glib.h>
#include <libxml/tree.h>
#include <libxml/xpath.h> // xmlXPathObject, etc.

#include <crm/crm.h>
#include <crm/cib.h>
#include <crm/cluster/internal.h>

#include <crm/common/xml.h>

#include <pacemaker-based.h>
#include <stddef.h> // NULL, size_t
#include <stdint.h> // u?int*_t, UINT64_C
#include <stdio.h> // snprintf
#include <stdlib.h> // free
#include <sys/types.h> // gid_t, uid_t
#include <syslog.h> // LOG_INFO, LOG_DEBUG
#include <time.h> // time_t
#include <unistd.h> // close

#include <glib.h> // gboolean, gpointer, g_*, etc.
#include <libxml/tree.h> // xmlNode
#include <libxml/xpath.h> // xmlXPath*
#include <qb/qbdefs.h> // QB_FALSE
#include <qb/qbipcs.h> // qb_ipcs_connection_t
#include <qb/qblog.h> // LOG_TRACE

#include <crm/cib.h> // cib_call_options values
#include <crm/cib/internal.h> // cib__*
#include <crm/cluster.h> // pcmk_cluster_disconnect
#include <crm/cluster/internal.h> // pcmk__cluster_send_message
#include <crm/common/cib.h> // pcmk_find_cib_element
#include <crm/common/internal.h> // pcmk__s, pcmk__str_eq
#include <crm/common/ipc.h> // crm_ipc_*, pcmk_ipc_*
#include <crm/common/logging.h> // CRM_LOG_ASSERT, CRM_CHECK
#include <crm/common/mainloop.h> // mainloop_*
#include <crm/common/results.h> // pcmk_rc_*
#include <crm/common/xml.h> // PCMK_XA_*, PCMK_XE_*
#include <crm/crm.h> // CRM_OP_*

#include "pacemaker-based.h"

#define EXIT_ESCALATION_MS 10000

Expand Down Expand Up @@ -1127,8 +1137,7 @@ cib_process_command(xmlNode *request, const cib__operation_t *operation,
pcmk__xe_get(result_cib, PCMK_XA_NUM_UPDATES),
(config_changed? " changed" : ""));

rc = activateCibXml(result_cib, config_changed, op);
rc = pcmk_legacy2rc(rc);
rc = based_activate_cib(result_cib, config_changed, op);
if (rc != pcmk_rc_ok) {
pcmk__err("Failed to activate new CIB: %s", pcmk_rc_str(rc));
}
Expand Down Expand Up @@ -1183,8 +1192,8 @@ cib_process_command(xmlNode *request, const cib__operation_t *operation,
cib_dryrun|cib_inhibit_notify|cib_transaction)) {
pcmk__trace("Sending notifications %d",
pcmk__is_set(call_options, cib_dryrun));
cib_diff_notify(op, pcmk_rc2legacy(rc), call_id, client_id, client_name,
originator, input, cib_diff);
based_diff_notify(op, pcmk_rc2legacy(rc), call_id, client_id,
client_name, originator, input, cib_diff);
}

pcmk__log_xml_patchset(LOG_TRACE, cib_diff);
Expand Down Expand Up @@ -1363,7 +1372,7 @@ terminate_cib(int exit_status)
remote_tls_fd = 0;
}

uninitializeCib();
g_clear_pointer(&the_cib, pcmk__xml_free);

// Exit immediately on error
if (exit_status > CRM_EX_OK) {
Expand Down
Loading