HomeClusterLabs Projects

Refactor: libcrmcommon: XML formatted output for option metadata

Description

Refactor: libcrmcommon: XML formatted output for option metadata

This is the next step along the path to full formatted output support
for option metadata. It will make the diff considerably simpler when we
move to "proper" formatted output with message functions, etc.

Previously, pcmk__format_option_metadata() generated an XML
representation of an options list, dumped it to text, and returned the
resulting string.

Now, it accepts a pcmk__output_t object with fmt_name == "xml". It
builds up the XML representation within the output object as is standard
for formatted output.

This required a couple of other changes:

  • We drop NULL checks of create_xml_node() return values. It would be nice to check or assert on these. However, the XML output functions assume that create_xml_node() succeeds. So they would have already segfaulted by the time we checked any return values.
  • Existing daemon metadata functions have to create temporary pcmkoutput_t objects to pass to pcmkformat_option_metadata(). Soon, daemon metadata commands will be deprecated, so this hacky workaround will go away eventually. For now, we functionize it.

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

Details

Provenance
nrwahl2Authored on Jan 27 2024, 4:02 AM
Parents
rPdfc9763487aa: Refactor: scheduler: Make out object static
Branches
Unknown
Tags
Unknown