Controller refactors: Clean up controld_execd_state.c and add Doxygen - #4159
Controller refactors: Clean up controld_execd_state.c and add Doxygen#4159nrwahl2 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>
f64c53d to
82e7290
Compare
| } else { | ||
| /* Ignored for remote connections. | ||
| * | ||
| * @TODO Do we even need to set this in this function? |
There was a problem hiding this comment.
I address this in a later commit (not in this PR). Short answer: no.
|
|
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>
We allocate and free it, so it should not be const. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
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. 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>
31e360e to
4f2e241
Compare
|
At this point I'm getting mixed results on This is meant to be non-invasive, so I wonder if it's something pre-existing, or a problem with cts-lab, or a problem with my test bed. I ran two batches of all four tests using this PR, and all ran fine. On the third batch, I reproduced it on main too. So I'm not particularly worried about this PR. I'll build Pacemaker-3.0.1 though, and see if I can reproduce it there. |
I've done probably 30-40 individual test iterations on 3.0.1 and I haven't seen the issue. So this might be something recently introduced. And since it's pretty hard to reproduce, that displeases me greatly. |
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.