HomeClusterLabs Projects

Refactor: scheduler: best practices for replica_for_container()

Description

Refactor: scheduler: best practices for replica_for_container()

Make replica_for_container() return the replica's child rather than the replica,
since that's all the callers need. This simplifies the callers and makes the
function callable from files without bundle variant includes.

Rename it accordingly to pcmk__get_rsc_in_container(), expose it as
library-private for future reuse, add a doxygen block, use const where
possible, and improve variable names and formatting. Short-circuit for NULL
arguments rather than iterate needlessly through the bundle replicas.

We can also drop a redundant argument. If the instance is a bundle container,
then its parent is the bundle, so we don't need to pass that separately.

Details

Provenance
kgaillotAuthored on Jul 7 2022, 11:54 AM
Parents
rP12b6610e0455: Refactor: scheduler: best practices for get_container_list()
Branches
Unknown
Tags
Unknown