Fix: tools: Avoid crash in crm_simulate --profile
crm_simulate --profile crashes because of a bug in
pcmk__schedule_actions(), described below.
pcmk__schedule_actions() has a use-after-free bug if its cib argument is
the same as the current scheduler->input (or if it's an ancestor or
descendant). This is another step toward dropping that argument, and it
fixes the crash in crm_simulate --profile.
Behavior is preserved. The only caller of pcmkprofile_dir() is
crm_simulate. The scheduler object has no state except for output flags
when pcmkprofile_dir() is called. In particular,
pcmksched_have_status is not set. So we achieve equivalent behavior by
explicitly calling pcmk_reset_scheduler(), setting scheduler->input,
setting scheduler flags, and calling cluster_status() -- instead of
relying on pcmkschedule_actions() to do all this via unpack_cib().
This is a regression that was introduced by c24e7325 (or a neighboring
commit) and has not made it into any release.
Signed-off-by: Reid Wahl <nrwahl@protonmail.com>