-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best practices for a few scheduler functions #3779
Conversation
…_time() Move from libpe_status to libcrmcommon, rename to pcmk__scheduler_epoch_time(), add a doxygen block, and improve log messages and formatting.
We currently have pe_reset_working_data(), cleanup_calculations(), and set_working_set_defaults() for partially freeing and restoring defaults in scheduler data. The distinction is confusing, and this is the first step to rationalizing it: the new function sets nonzero default values in scheduler data, without freeing or nulling/zeroing anything, so it can be used in both existing and replacement functions.
... from libpe_status to libcrmcommon. Also rename with a pcmk prefix, add doxygen blocks, and improve variable names. There are no unit tests because the relevant struct is source-file-scoped, and the APIs aren't complex enough to make it worth exposing.
... as a convenience wrapper around the resource free() method, suitable for use as a GList free function.
... in libpe_status with a new pcmk__free_node() in libcrmcommon that can be used as a GList iterator.
... in libpe_status with a new pcmk__free_action_relation() in libcrmcommon that can be used as a GList iterator
... in libpe_status with a new pcmk__free_location() in libcrmcommon that can be used as a GList iterator
... in libpe_status with a new pcmk__free_action() in libcrmcommon that can be used as a GList iterator
@nrwahl2 , here's my last best practices PR for review when you get a chance |
:'( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! A few harmless redundancies and a questionable CRM_CHECK()
, and that's all I'm noticing.
This is the equivalent of pe_reset_working_set(), except for freeing and zeroing members individually rather than zeroing the whole object.
It is fully equivalent to pcmk_reset_scheduler()
cleanup_calculations() is equivalent to pcmk_reset_scheduler() except for not freeing ordering, location, or colocation constraints. However it logged an assertion if location or ordering constraints were non-NULL, and it called set_working_set_defaults() which would NULL the constraint members without freeing them. Therefore we can simply replace calls with pcmk_reset_scheduler(). There's no reason to ever zero constraints without freeing them.
The function zeroed out the scheduler object without freeing members, which makes no sense, so simply replace calls with pcmk_reset_scheduler(), which does a free-and-zero.
... and use it internally instead of pe_new_working_set()
... and use it internally instead of pe_free_working_set()
... aside from deprecated API names
... as pcmk__update_recheck_time(). The only code changes are the name and checking for NULL arguments.
4e85b3e
to
57accaa
Compare
updated per review |
Failures are all on rawhide; spot-checked one and it's a timeout. |
retest this please |
No description provided.