Skip to content

Refactor-and-deprecation preview dumping ground #3845

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

Draft
wants to merge 186 commits into
base: main
Choose a base branch
from

Conversation

nrwahl2
Copy link
Contributor

@nrwahl2 nrwahl2 commented Mar 13, 2025

This is a place to view the commits that are next in line from whatever PR I have currently active, for anyone curious.

@nrwahl2 nrwahl2 force-pushed the nrwahl2-xml_refactors branch 4 times, most recently from 02c3484 to b36e366 Compare March 17, 2025 22:38
@nrwahl2
Copy link
Contributor Author

nrwahl2 commented Mar 18, 2025

Alright, I'm finally back to where I was last spring :) It took a lot of cleanup to get things to fit into the current main. And I took different approaches and made some other improvements in places. As I write this, all but two of the public API functions from xml.h are deprecated on this branch, and we're starting on formatted output for crm_diff.

@nrwahl2 nrwahl2 force-pushed the nrwahl2-xml_refactors branch 11 times, most recently from d480e04 to cd819b7 Compare March 24, 2025 10:21
@nrwahl2 nrwahl2 changed the title WIP: XML refactors and deprecations through xml_track_changes() Refactor-and-deprecation preview dumping ground Mar 24, 2025
@nrwahl2 nrwahl2 force-pushed the nrwahl2-xml_refactors branch 5 times, most recently from b59102e to b6bf99c Compare March 25, 2025 11:30
nrwahl2 added 8 commits March 26, 2025 17:51
To replace xml_accept_changes(). For now we basically mimic the logic in
xml_accept_changes(), but perhaps we should be less aggressive or rename
the function to reflect that it's clearing so many things.

In particular, I'm not sure I like that this disables tracking, and I
don't think I like that ACLs are so tightly coupled to change tracking
(in many ways, not just here). Change tracking is required for ACLs but
not vice-versa. Perhaps operations and flags should be kept a bit
more... separate, though.

Still, it's probably wise to throw away any unpacked ACLs when
committing changes, as we're doing now and as we've been doing. ACLs
themselves may have been added, modified, or removed as part of the
changes. We want to get a current view of them before any further
changes.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And add doxygen. The doxygen is a bit hand-wavy for a few of them,
because I don't yet understand everything they're doing.

The wide spacing before the equal sign is to allow room to do a planned
rename of pcmk__xf_lazy later, without having to change the other lines
again.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
xml_calculate{,_significant}_changes() already takes care of this,
provided the node's document doesn't have the pcmk__xf_tracking flag set
yet. That is true here, since these are all new documents.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
In all of these cases, what we really care about is whether ACLs are
enabled for the user in the original CIB (*current_cib). The differences
come from the aliases (cib_ro and scratch) that we use for *current_cib,
and whether scratch is a copy of *current_cib (in which case the return
value of cib_acl_enabled() would be the same).

Also add a couple of TODO comments. This is a very convoluted and
confusing function and likely has some corner case bugs.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
If we simply assume that pcmk__xml_new_doc() returns non-NULL (as it
currently must because it asserts on allocation error), then it's simple
to make assert_comment() more self-contained.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
The only remaining uses were in cib_perform_op() and in the unit tests
for pcmk__xc_create().

For cib_perform_op(), this introduces some duplication. We could
functionize the duplicated code, but that entire function is a huge mess
anyway, so I'm simply leaving it for now until we can revisit it as a
whole. Note that pcmk__enable_acl() is equivalent to the three calls
that xml_track_changes() was making.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
nrwahl2 added 3 commits March 26, 2025 23:45
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_notice()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
@nrwahl2 nrwahl2 force-pushed the nrwahl2-xml_refactors branch from b6bf99c to c06f701 Compare March 27, 2025 07:29
nrwahl2 added 13 commits March 27, 2025 01:22
To replace crm_info()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
My understanding was that this was always Ken's intent, so I'm not sure
why it hasn't been consistently done. Everything still builds and
test-headers.sh still passes.

The only ones I excluded were the xml_X_internal.h and xpath_internal.h
files. xml_internal.h is meant to be a wrapper for all of those.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
And add new includes to files that broke as a result.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_debug()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace LOG_STDOUT.

We can't even deprecate LOG_STDOUT until the public macros that use it
are deprecated.

The goal here is to get internal constants for LOG_STDOUT, LOG_NEVER,
and ultimately LOG_TRACE. The prefix will be rather cumbersome for
PCMK__LOG_TRACE. However, I want to make it clear that these log levels
are custom extensions and are not broadly supported symbols.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace LOG_NEVER.

We can't even deprecate LOG_NEVER until the public macros that use it
are deprecated.

The goal here is to get internal constants for LOG_STDOUT, LOG_NEVER,
and ultimately LOG_TRACE. The prefix will be rather cumbersome for
PCMK__LOG_TRACE. However, I want to make it clear that these log levels
are custom extensions and are not broadly supported symbols.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Just came to mind

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace LOG_TRACE.

We can't even deprecate LOG_NEVER until the public macros that use it
are deprecated.

The goal here is to get internal constants for LOG_STDOUT, LOG_NEVER,
and LOG_TRACE. I want to make it clear that these log levels are custom
extensions and are not broadly supported symbols.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_trace()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
@nrwahl2 nrwahl2 force-pushed the nrwahl2-xml_refactors branch from 746daf6 to f026af7 Compare March 28, 2025 01:57
nrwahl2 added 12 commits March 27, 2025 19:02
To replace crm_log_xml_err()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_log_xml_warn()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_log_xml_notice()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_log_xml_info()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_log_xml_debug()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
To replace crm_log_xml_trace()

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Pacemaker should not be used for general-purpose logging.

Ref T622

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant