Controller refactors: Clean up controld_execd_state.c and add Doxygen - #4159
Open
nrwahl2 wants to merge 54 commits into
Open
Controller refactors: Clean up controld_execd_state.c and add Doxygen#4159nrwahl2 wants to merge 54 commits into
nrwahl2 wants to merge 54 commits into
Conversation
It's been ignored since GLib 2.76. We only require GLib >= 2.42 currently, but this option doesn't seem very useful anyway. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
* Add Doxygen. * Add call_key variable. * Drop hyphen from "Pre-emptively." * Set fields in the order in which they're defined for lrmd_event_data_t. * Use true instead of TRUE. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It doesn't seem to simplify things much. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
nrwahl2
force-pushed
the
nrwahl2-controller_first
branch
from
August 5, 2026 19:32
f64c53d to
82e7290
Compare
nrwahl2
commented
Aug 5, 2026
| } else { | ||
| /* Ignored for remote connections. | ||
| * | ||
| * @TODO Do we even need to set this in this function? |
Contributor
Author
There was a problem hiding this comment.
I address this in a later commit (not in this PR). Short answer: no.
Contributor
Author
|
|
nrwahl2
marked this pull request as draft
August 5, 2026 20:56
nrwahl2
marked this pull request as ready for review
August 5, 2026 21:03
nrwahl2
force-pushed
the
nrwahl2-controller_first
branch
from
August 5, 2026 21:03
82e7290 to
31e360e
Compare
It doesn't seem to simplify things much. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
...to controld_execd_state_disconnect(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This is the only thing it ever holds, so rename it to clarify intent. We can't rename lrmd_event_data_t:user_data in a straightforward way, because it's public API. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
This should have been done in e79c5b3. Nothing checks the return value. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Also rename it to controld_execd_cancel_op() and return bool instead of gboolean. An upcoming commit will call it within controld_execd_state.c. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
...and its helpers to controld_execd_state.c. This seems like the more appropriate place. For ease of review, no code changes in this commit; it only moves. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
* Add Doxygen. * Rename to cancel_recurring_op. * Drop "remove" variable. * Add a "call_key" variable. * Use const where possible. * Unindent recurring case. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
* Add Doxygen. * Use bool instead of gboolean. * Improve whitespace. * Drop unnecessary elses. * Compare op_type case-sensitively. * Use a new "last" variable for readability. * Use const where appropriate. (lrm_state->resource_history is passed as non-const to g_hash_table_lookup(), but it shouldn't get modified. Unfortunate GLib function signature.) Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
...instead of gboolean. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
* Use const where appropriate. * Make counter an unsigned int and rename to count. * Rename gIter and hIter to iter and iter2, respectively. * Rename key to call_key for consistency with some other functions. * Improve whitespace. * Compare explicitly against 0. * Use pcmk__plural_alt(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Both blocks require lrm_state->active_ops != NULL, and both of them do nothing if the size of lrm_state->active_ops is zero. We drop the nremaining variable because it's the original size minus the number of items removed. Also, the condition "(removed > 0) || (nremaining > 0)" is equivalent to the condition that the original size is nonzero. So we drop that check when we add the nonzero size check at the beginning of the block. Clarify the notice message. Use g_hash_table_foreach() with a new function count_non_recurring_op() to count the non-recurring operations. For me, this is more readable. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It shouldn't be necessary to assert non-NULL on these either. GLib does its own equivalents of pcmk__assert() and CRM_CHECK(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
clumens
reviewed
Aug 21, 2026
The sole caller always passes non-NULL for node_name. Insert the newly allocated state object into the table in the caller, as this seems clearer to me. Drop free_rsc_info() as a wrapper and use a cast instead. The reorderings are just to match the order in the struct definition. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Do this for GDestroyNotifys, GHFuncs, and GHRFuncs as well. Usually we don't NULL-check arguments of a static function with only one caller. However, for these, the arguments are the items in a GHashTable. We haven't NULL-checked them since they were inserted, so these assertions act as sanity checks of the tables' contents. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The deleted comment is redundant due to a similar comment in controld_remote_proxy_disconnect_node(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And rename it to controld_execd_state_get(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It NULL-checks the argument itself. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
...and controld_connect_remote_executor(). Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The sole caller passes 0. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Regarding the lrm_state argument being const: its conn field is passed as non-const to the get_metadata_params() method. However, that method completely ignores that argument. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
They're always NULL except for one caller. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
All callers pass 0. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
It's ignored. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The action vs. operation terminology in the updated Doxygen takes cues from T781. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The sole caller passed lrmd_opt_drop_recurring. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The sole caller passed 0. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
nrwahl2
force-pushed
the
nrwahl2-controller_first
branch
from
August 21, 2026 21:25
4f2e241 to
1857b1f
Compare
Contributor
Author
|
@clumens Should be good to go on my end. Anything to add or any more review to do? I posted and deleted a comment saying I was gonna go ahead and merge it. I realized I don't have anything to gain by doing so. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I've tried to avoid making big substantive changes here. This PR is about adding Doxygen, following best practices, and renaming functions to follow conventions (including moving away from "lrm" and toward "execd"). The idea is to make the logic easier to understand at a glance.
More to come. This covers all of
controld_execd_state.c.Incidentally, I understand why we wanted to break up
controld_execd.csince it was (and is) so large -- but which functions are placed incontrold_execd_state.coften seems pretty arbitrary. Maybe we can find a better way to organize all this code after we understand it better and untangle it somewhat.