HomeClusterLabs Projects

Refactor: libcrmcommon: Don't create the XML root node until needed.

Description

Refactor: libcrmcommon: Don't create the XML root node until needed.

This is to make some time after the XML output object is created with
xml_init so that options can be set. These options will impact the root
node itself. Currently, there is no way to do this (hence the need for
the force args stuff).

Note that not every function here calls add_root_node. It only needs to
happen before anything would be added. For instance,
xml_subprocess_output calls pcmk__output_xml_create_parent before it
would add anything to the XML structure. Because of this, the former
function can skip the check because the latter will perform it.

However, this isn't completely safe - if we add more code before that
first call that would add to the structure, we'll need the check there
as well.

Details

Provenance
clumensAuthored on Feb 15 2024, 10:23 AM
Parents
rPa59a080065af: Refactor: libcrmcommon: Check legacy_xml in both locations.
Branches
Unknown
Tags
Unknown