Fix: libpe_status: Make cluster_status() idempotent
Previously, if cluster_status() were called twice without resetting the
scheduler between calls, most of the unpacked data would be duplicated
in the scheduler object's data structures. For example, the nodes in
scheduler->input would be stored twice in the scheduler's node list.
This changes the behavior of a public API function, but the previous
behavior resulted in incorrect status, so that seems acceptable.
This is not a perfect fix: scheduler->flags is publicly accessible, so a
caller could clear the pcmk__sched_have_status flag without resetting
the scheduler. That would not be wise to do, however, so we can ignore
that possibility for now and plan to deprecate cluster_status() later.
An alternative approach would be to explicitly free each scheduler data
structure before we unpack into it. Then cluster_status() could be
called multiple times with different inputs, getting the new status each
time. However, there is no internal use case for that, and it seems
prone to unforeseen corner cases.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>