HomeClusterLabs Projects

Low: libcrmcommon: Mark parents dirty in pcmk__mark_xml_created()

Description

Low: libcrmcommon: Mark parents dirty in pcmk__mark_xml_created()

And rename to pcmk__xml_mark_created().

Previously, if the node already had the pcmkxf_created flag set, we
skipped calling pcmk
mark_xml_node_dirty() on it. This was a bug.

For example, pcmkxe_create() and pcmkxml_copy() call
pcmkxml_mark_created() on a newly created node. If the new node is
created as a child of some existing node, then the parents and the
document need to be marked dirty. However, they won't be, because
new_private_data() guarantees that the newly created node has the
pcmk
xf_created flag set.

Other minor behavioral changes:

  • Previously we stopped traversal *of a particular branch* if nodepriv == NULL or not tracking changes.
  • Now:
    • We stop traversal *of the entire tree* if not tracking changes, because the setting is the same for the entire document.
    • We continue traversal if nodepriv == NULL. pcmk__xml_tree_foreach() doesn't have a way to signal "stop traversal of this branch only", so this allows us to keep traversing the rest of the tree. This change shouldn't cause any significant increase in work: nodepriv == NULL for node types that don't have children and node types that we don't support or directly process.

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

Details

Provenance
nrwahl2Authored on Feb 12 2024, 2:46 PM
Parents
rPae4b38ab5dc9: Merge pull request #3417 from gao-yan/deprecate-classes-compat-2.0
Branches
Unknown
Tags
Unknown