HomeClusterLabs Projects

Fix: tools: stonith_admin --list-targets should show what fencer would use

Description

Fix: tools: stonith_admin --list-targets should show what fencer would use

This fixes both a regression in 2.0.2 and a pre-existing issue before that.

Before 2.0.2's 52f614aa, stonith_admin --list-targets would print each line of
output from the fence agent's list action, with any commas and semi-colons
removed. After that, it would only print lines that had three values separated
by spaces.

In practice, fence agents have some variety in list action output, which is not
yet standardized by the fence agent API. Only fence_xvm is known to use the
three space-separated values. Most agents output the target name and an alias
separated by a comma.

The earlier behavior would actually be awkward in the comma-separated case,
since the target name and alias would be run together with no separator.

Neither behaviors matched what was actually used by the fencer.

This commit refactors to use the new stonith__parse_targets() function, to show
the same list the fencer would use. It also fixes a few related issues:

  • Memory was not properly freed
  • No list wrapper would be printed if the list were empty
  • stonith_admin's XML output did not match its schema (the tool would output a <fence-target> element, while the schema had <target>). Now, we abandon the custom element and use the generic <item> schema instead. While technically this could be considered backward-incompatible, it's not really, because the schema didn't match to begin with. Also, the API XML schema is still considered experimental.
  • Not really a problem, but since we now have the generic <item> schema, stonith_admin uses this in place of its former dedicated <item> schema. The only difference is the former allows arbitrary strings while the latter required NCName, but the reuse is more useful than type validation.

Details

Provenance
kgaillotAuthored on Jun 10 2019, 5:13 PM
Parents
rP311d8629241d: Refactor: fencing: expose function for parsing targets from string
Branches
Unknown
Tags
Unknown

Event Timeline