HomeClusterLabs Projects

Refactor: libpacemaker: Default colocation->node_attribute to #uname

Description

Refactor: libpacemaker: Default colocation->node_attribute to #uname

It's been documented this way in Pacemaker Explained for a long time,
and the trace message in pcmk__new_colocation() also says we're using
CRM_ATTR_UNAME if the node_attr argument is NULL.

However, we haven't actually set a default value in
pcmknew_colocation() before now. Also, we've used CRM_ATTR_ID as the
default in pcmk
apply_coloc_to_scores() and
pcmk__apply_coloc_to_priority() for a long time. Surprisingly,
defaulting to CRM_ATTR_UNAME globally doesn't affect any regression
tests.

This allows us to avoid some checks by assuming
colocation->node_attribute is non-NULL.

This commit also removes a couple of redundant NULL checks of a
pcmk__colocation_t object in add_node_scores_matching_attr(), to reduce
clutter. It's a static function with only one caller that already
NULL-checks the colocation.

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

Details

Provenance
nrwahl2Authored on Jun 24 2023, 8:59 PM
Parents
rP53ced0dd7cf5: Refactor: libpacemaker: DRY up cmp_{dependent,promotable}_priority()
Branches
Unknown
Tags
Unknown