Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
bb20b4c
Refactor: daemons: Rearrange the big cleanup block at the end of attrd.
clumens Jul 15, 2026
12d7c5d
Refactor: daemons: Add an atexit handler for certain cleanup in attrd.
clumens Jul 15, 2026
87ed6eb
Refactor: daemons: Move cleanup out of attrd_shutdown.
clumens Jul 22, 2026
f2f4120
Refactor: daemons: Move attrd cleanup into its own function.
clumens Jul 22, 2026
adb91c1
Refactor: daemons: Split up attrd_shutdown and attrd_quit_main_loop.
clumens Jul 22, 2026
d4f526f
Refactor: daemons: Make attrd_shutdown static.
clumens Jul 22, 2026
dbf7107
Refactor: libcrmcommon,daemons: Introduce the pcmk__daemon_t object.
clumens Jul 22, 2026
a5c5073
Refactor: daemons: Move shutting_down into pcmk__daemon_t.
clumens Jul 22, 2026
72d1fad
Refactor: daemons: Add the standalone mode flag to pcmk__daemon_t.
clumens Jul 22, 2026
1145469
Refactor: daemons: Move the exit status into pcmk__daemon_t.
clumens Jul 22, 2026
845a338
Refactor: libcrmcommon,daemons: Make pcmk__daemon_quit more useful.
clumens Jul 22, 2026
b010a05
Refactor: daemons,libcrmcommon: Add pcmk__daemon_ipc_running.
clumens Jul 22, 2026
1c6a408
Refactor: libcrmcommon,daemons: Don't exit in pcmk__serve_attrd_ipc.
clumens Jul 21, 2026
252a174
Refactor: daemons: Add an atexit handler for certain cleanup in execd.
clumens Jul 17, 2026
87a5201
Refactor: daemons: Unindent drain_check and lrmd_drain_alerts.
clumens Jul 17, 2026
ebcc671
Refactor: daemons: Unindent lrmd_shutdown.
clumens Jul 17, 2026
cdba0e9
Refactor: daemons: Rename exit_executor to execd_cleanup.
clumens Jul 23, 2026
e748c7a
Refactor: daemons: Add execd_quit_main_loop.
clumens Jul 23, 2026
a4130ee
Refactor: daemons: Use execd_quit_main_loop for most remote cases.
clumens Jul 23, 2026
eba8299
Refactor: daemons: Shut down properly from inside handle_shutdown_nack.
clumens Jul 23, 2026
b26fe14
Refactor: daemons: Move lrmd_shutdown into execd_quit_main_loop.
clumens Jul 23, 2026
1ae6b3a
Refactor: daemons: Add pcmk__daemon_t to execd for exit status.
clumens Jul 23, 2026
da0d010
Refactor: daemons: Use pcmk__daemon_t for shutting_down in execd.
clumens Jul 23, 2026
6db5173
Refactor: libcrmcommon: Add a quit function to pcmk__daemon_t.
clumens Jul 23, 2026
ff4dd07
Refactor: daemons: Finish converting execd to using pcmk__daemon_t.
clumens Jul 23, 2026
181a7bc
Refactor: libcrmcommon,daemons: Don't exit in pcmk__serve_execd_ipc.
clumens Jul 23, 2026
da27e4c
Refactor: libcrmcommon,daemons: Move start_time into the daemon object.
clumens Jul 20, 2026
f6cf94b
Refactor: daemons: Add an atexit handler for certain cleanup in fenced.
clumens Jul 20, 2026
860c5e2
Refactor: daemons: Improve the stonith_cleanup function.
clumens Jul 24, 2026
035871c
Refactor: daemons: Add pcmk__daemon_t to fenced for exit status.
clumens Jul 24, 2026
d377bb5
Refactor: daemons: Use pcmk__daemon_t for shutting_down in fenced.
clumens Jul 24, 2026
2c9e976
Refactor: daemons: Use pcmk__daemon_t for stand_alone in fenced.
clumens Jul 24, 2026
cf260eb
Refactor: daemons: Finish converting fenced to using pcmk__daemon_t.
clumens Jul 24, 2026
4422d47
Refactor: daemons: Get rid of the options struct in fenced.
clumens Jul 24, 2026
3462579
Refactor: libcrmcommon,daemons: Add pcmk__generic_ipc_running.
clumens Jul 24, 2026
320e93e
Refactor: daemons: Consolidate cluster connection messages.
clumens Jul 20, 2026
96aee37
Refactor: libcrmcommon,daemons: Don't exit in pcmk__serve_fenced_ipc.
clumens Jul 24, 2026
cf7c0aa
Refactor: daemons: Add an atexit handler for certain cleanup in pacem…
clumens Jul 21, 2026
6b70c96
Refactor: daemons: Don't call crm_exit in create_pcmk_dirs.
clumens Jul 21, 2026
a5d4ff6
Refactor: daemons: Minor best practices around pacemakerd_read_config.
clumens Jul 21, 2026
98abe3a
Refactor: daemons: Don't call crm_exit if pcmkd_read_config fails.
clumens Jul 21, 2026
6db78b9
Refactor: daemons: Rename rc to cs_rc in pcmk_read_config.
clumens Jul 29, 2026
3ea4aea
Refactor: daemons: Call cmap_finalize on all paths in pcmkd_read_config.
clumens Jul 29, 2026
c643f8f
Refactor: daemons: Move pacemakerd cleanup into its own function.
clumens Jul 24, 2026
2a38d15
Refactor: daemons: Simplify a check in pacemakerd_event_cb.
clumens Jul 24, 2026
a91bdad
Refactor: daemons: Add a comment to start_child.
clumens Jul 28, 2026
34f114c
Refactor: daemons: Don't call crm_exit on some easy cases.
clumens Jul 28, 2026
76b959f
Refactor: daemons: Add pcmk__daemon_t to pacemakerd for exit status.
clumens Jul 24, 2026
870b1e4
Refactor: daemons: Finish converting pacemakerd to using pcmk__daemon_t.
clumens Jul 27, 2026
4d1224b
Refactor: libcrmcommon,daemons: Don't exit in pcmk__serve_pacemakerd_…
clumens Jul 27, 2026
4e87b84
Refactor: daemons: Add an atexit handler for certain cleanup in sched…
clumens Jul 27, 2026
83ebdb4
Refactor: daemons: Move schedulerd cleanup into its own function.
clumens Jul 27, 2026
7d1a553
Refactor: daemons: Standardize how schedulerd exits.
clumens Jul 27, 2026
596c6de
Refactor: daemons: Get rid of the options struct in scheduler.
clumens Jul 27, 2026
80865e8
Refactor: daemons: Add pcmk__daemon_t to schedulerd for exit status.
clumens Jul 27, 2026
d7a6dab
Refactor: daemons: Finish converting schedulerd to using pcmk__daemon_t.
clumens Jul 27, 2026
385eba4
Refactor: libcrmcommon,daemons: Don't exit in pcmk__serve_schedulerd_…
clumens Jul 27, 2026
28bca87
Refactor: libcrmcommon,daemons: Don't exit in pcmk__serve_based_ipc.
clumens Jul 27, 2026
7d2c106
Refactor: daemons: Don't allow a second schedulerd instance to start.
clumens Jul 27, 2026
e64e8dc
Refactor: daemons: Remove unnecessary forward function declarations.
clumens Jul 28, 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
24 changes: 13 additions & 11 deletions daemons/attrd/attrd_cib.c
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,14 @@ attrd_cib_destroy_cb(void *user_data)

cib->cmds->signoff(cib);

if (attrd_shutting_down()) {
if (attrd.shutting_down) {
pcmk__info("Disconnected from the CIB manager");

} else {
// @TODO This should trigger a reconnect, not a shutdown
pcmk__crit("Lost connection to the CIB manager, shutting down");
attrd_exit_status = CRM_EX_DISCONNECT;
attrd_shutdown(0);
return;
}

// @TODO This should trigger a reconnect, not a shutdown
Comment thread
clumens marked this conversation as resolved.
pcmk__crit("Lost connection to the CIB manager, shutting down");
pcmk__daemon_quit(&attrd, CRM_EX_DISCONNECT);
}

static void
Expand All @@ -56,7 +55,7 @@ attrd_cib_updated_cb(const char *event, xmlNode *msg)
}

if (pcmk__cib_element_in_patchset(patchset, PCMK_XE_ALERTS)) {
if (attrd_shutting_down()) {
if (attrd.shutting_down) {
pcmk__debug("Ignoring alerts change in CIB during shutdown");
} else {
mainloop_set_trigger(attrd_config_read);
Expand All @@ -81,7 +80,7 @@ attrd_cib_updated_cb(const char *event, xmlNode *msg)
if (status_changed
|| pcmk__cib_element_in_patchset(patchset, PCMK_XE_NODES)) {

if (attrd_shutting_down()) {
if (attrd.shutting_down) {
pcmk__debug("Ignoring node change in CIB during shutdown");
return;
}
Expand Down Expand Up @@ -154,7 +153,10 @@ attrd_cib_connect(int max_retry)
void
attrd_cib_disconnect(void)
{
CRM_CHECK(the_cib != NULL, return);
if (the_cib == NULL) {
return;
}

the_cib->cmds->del_notify_callback(the_cib, PCMK__VALUE_CIB_DIFF_NOTIFY,
attrd_cib_updated_cb);
cib__clean_up_connection(&the_cib);
Expand Down Expand Up @@ -518,7 +520,7 @@ write_attribute(attribute_t *a, bool ignore_delay)
}

// Private attributes (or any in standalone mode) are not written to the CIB
if (attrd_stand_alone() || pcmk__is_set(a->flags, attrd_attr_is_private)) {
if (attrd.stand_alone || pcmk__is_set(a->flags, attrd_attr_is_private)) {
should_write = false;
}

Expand Down
18 changes: 10 additions & 8 deletions daemons/attrd/attrd_corosync.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ attrd_peer_message(pcmk__node_status_t *peer, xmlNode *xml)
return;
}

if (attrd_shutting_down()) {
if (attrd.shutting_down) {
/* If we're shutting down, we want to continue responding to election
* ops as long as we're a cluster member (because our vote may be
* needed). Ignore all other messages.
Expand Down Expand Up @@ -179,14 +179,13 @@ attrd_cpg_dispatch(cpg_handle_t handle, const struct cpg_name *group_name,
static void
attrd_cpg_destroy(void *unused)
{
if (attrd_shutting_down()) {
if (attrd.shutting_down) {
pcmk__info("Disconnected from Corosync process group");

} else {
pcmk__crit("Lost connection to Corosync process group, shutting down");
attrd_exit_status = CRM_EX_DISCONNECT;
attrd_shutdown(0);
return;
}

pcmk__crit("Lost connection to Corosync process group, shutting down");
pcmk__daemon_quit(&attrd, CRM_EX_DISCONNECT);
}
#endif // SUPPORT_COROSYNC

Expand Down Expand Up @@ -511,7 +510,10 @@ attrd_cluster_connect(void)
pcmk__cluster_set_status_callback(&attrd_peer_change_cb);

rc = pcmk_cluster_connect(attrd_cluster);
if (rc != pcmk_rc_ok) {

if (rc == pcmk_rc_ok) {
pcmk__info("Cluster connection active");
} else {
pcmk__err("Cluster connection failed");
}

Expand Down
4 changes: 2 additions & 2 deletions daemons/attrd/attrd_elections.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ attrd_start_election_if_needed(void)
{
if ((peer_writer == NULL)
&& (election_state(attrd_cluster) != election_in_progress)
&& !attrd_shutting_down()) {
&& !attrd.shutting_down) {

pcmk__info("Starting an election to determine the writer");
election_vote(attrd_cluster);
Expand All @@ -68,7 +68,7 @@ attrd_handle_election_op(const pcmk__node_status_t *peer, xmlNode *xml)
pcmk__xe_set(xml, PCMK__XA_SRC, peer->name);

// Don't become writer if we're shutting down
rc = election_count_vote(attrd_cluster, xml, !attrd_shutting_down());
rc = election_count_vote(attrd_cluster, xml, !attrd.shutting_down);

switch(rc) {
case election_start:
Expand Down
5 changes: 3 additions & 2 deletions daemons/attrd/attrd_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ static int32_t
attrd_ipc_accept(qb_ipcs_connection_t *c, uid_t uid, gid_t gid)
{
pcmk__trace("New client connection %p", c);
if (attrd_shutting_down()) {
if (attrd.shutting_down) {
pcmk__info("Ignoring new connection from pid %d during shutdown",
pcmk__client_pid(c));
return -ECONNREFUSED;
Expand Down Expand Up @@ -649,8 +649,9 @@ attrd_ipc_cleanup(void)
* \internal
* \brief Set up attrd IPC communication
*/
void
bool
attrd_ipc_init(void)
{
pcmk__serve_attrd_ipc(&ipcs, &ipc_callbacks);
return ipcs != NULL;
}
72 changes: 0 additions & 72 deletions daemons/attrd/attrd_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,83 +24,11 @@

cib_t *the_cib = NULL;

static bool shutting_down = false;
static GMainLoop *mloop = NULL;
Comment thread
clumens marked this conversation as resolved.

/* A hash table storing information on the protocol version of each peer attrd.
* The key is the peer's uname, and the value is the protocol version number.
*/
GHashTable *peer_protocol_vers = NULL;

/*!
* \internal
* \brief Check whether local attribute manager is shutting down
*
* \return \c true if local attribute manager has begun shutdown sequence,
* otherwise \c false
*/
bool
attrd_shutting_down(void)
{
return shutting_down;
}

/*!
* \internal
* \brief Exit (using mainloop or not, as appropriate)
*
* \param[in] nsig Ignored
*/
void
attrd_shutdown(int nsig)
{
// Tell various functions not to do anthing
shutting_down = true;

// Don't respond to signals while shutting down
mainloop_destroy_signal(SIGTERM);
mainloop_destroy_signal(SIGCHLD);
mainloop_destroy_signal(SIGPIPE);
mainloop_destroy_signal(SIGUSR1);
mainloop_destroy_signal(SIGUSR2);
mainloop_destroy_signal(SIGTRAP);

attrd_free_waitlist();
attrd_free_confirmations();

g_clear_pointer(&peer_protocol_vers, g_hash_table_destroy);
Comment thread
clumens marked this conversation as resolved.

if ((mloop == NULL) || !g_main_loop_is_running(mloop)) {
/* If there's no main loop active, just exit. This should be possible
* only if we get SIGTERM in brief windows at start-up and shutdown.
*/
crm_exit(CRM_EX_OK);
} else {
g_main_loop_quit(mloop);
g_main_loop_unref(mloop);
}
}

/*!
* \internal
* \brief Create a main loop for attrd
*/
void
attrd_init_mainloop(void)
{
mloop = g_main_loop_new(NULL, FALSE);
}

/*!
* \internal
* \brief Run attrd main loop
*/
void
attrd_run_mainloop(void)
{
g_main_loop_run(mloop);
}

/* strlen("value") */
#define plus_plus_len (5)

Expand Down
Loading