Skip to content

Commit b5b080f

Browse files
committed
Refactor: libpe_status: Drop pcmk__is_set_recursive() any argument
We always pass true now. Signed-off-by: Reid Wahl <nrwahl@protonmail.com>
1 parent 991652d commit b5b080f

5 files changed

Lines changed: 11 additions & 28 deletions

File tree

include/crm/pengine/internal.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ pe_base_name_eq(const pcmk_resource_t *rsc, const char *id)
259259
int pe__target_rc_from_xml(const xmlNode *xml_op);
260260

261261
int pe__cmp_node_name(const void *a, const void *b);
262-
bool pcmk__is_set_recursive(const pcmk_resource_t *rsc, uint64_t flag,
263-
bool any);
262+
bool pcmk__is_set_recursive(const pcmk_resource_t *rsc, uint64_t flag);
264263

265264
pcmk__op_digest_t *pe__calculate_digests(pcmk_resource_t *rsc, const char *task,
266265
unsigned int *interval_ms,

lib/pacemaker/pcmk_sched_bundle.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -499,7 +499,7 @@ replica_apply_coloc_score(const pcmk__bundle_replica_t *replica,
499499
chosen = container->priv->fns->location(container, NULL,
500500
pcmk__rsc_node_assigned);
501501
if ((chosen == NULL)
502-
|| pcmk__is_set_recursive(container, pcmk__rsc_blocked, true)) {
502+
|| pcmk__is_set_recursive(container, pcmk__rsc_blocked)) {
503503
return true;
504504
}
505505

lib/pacemaker/pcmk_sched_clone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ pcmk__clone_apply_coloc_score(pcmk_resource_t *dependent,
343343
chosen = instance->priv->fns->location(instance, NULL,
344344
pcmk__rsc_node_assigned);
345345
if ((chosen != NULL)
346-
&& !pcmk__is_set_recursive(instance, pcmk__rsc_blocked, true)) {
346+
&& !pcmk__is_set_recursive(instance, pcmk__rsc_blocked)) {
347347
pcmk__rsc_trace(primary, "Allowing %s: %s %d",
348348
colocation->id, pcmk__node_name(chosen),
349349
chosen->assign->score);

lib/pacemaker/pcmk_sched_instances.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1114,7 +1114,7 @@ pcmk__instance_matches(const pcmk_resource_t *instance, const pcmk_node_t *node,
11141114
return false;
11151115
}
11161116

1117-
if (!pcmk__is_set_recursive(instance, pcmk__rsc_blocked, true)) {
1117+
if (!pcmk__is_set_recursive(instance, pcmk__rsc_blocked)) {
11181118
uint32_t target = pcmk__rsc_node_assigned;
11191119

11201120
if (current) {

lib/pengine/clone.c

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -544,38 +544,23 @@ rsc_managed_recursive(const pcmk_resource_t *rsc)
544544
}
545545

546546
bool
547-
pcmk__is_set_recursive(const pcmk_resource_t *rsc, uint64_t flag, bool any)
547+
pcmk__is_set_recursive(const pcmk_resource_t *rsc, uint64_t flag)
548548
{
549-
const bool all = !any;
550-
bool is_set = pcmk__is_set(rsc->flags, flag);
551-
552-
if (any && is_set) {
549+
if (pcmk__is_set(rsc->flags, flag)) {
553550
return true;
554551
}
555552

556-
if (all && !is_set) {
557-
return false;
558-
}
559-
560553
for (const GList *iter = rsc->priv->children; iter != NULL;
561554
iter = iter->next) {
562555

563-
is_set = pcmk__is_set_recursive(iter->data, flag, any);
556+
const pcmk_resource_t *child_rsc = iter->data;
564557

565-
if (any && is_set) {
558+
if (pcmk__is_set_recursive(child_rsc, flag)) {
566559
return true;
567560
}
568-
569-
if (all && !is_set) {
570-
return false;
571-
}
572561
}
573562

574-
/* If all is true, then flag was set for rsc and all of its descendants.
575-
* Otherwise, any is true, and flag was not set for rsc or any of its
576-
* descendants.
577-
*/
578-
return all;
563+
return false;
579564
}
580565

581566
PCMK__OUTPUT_ARGS("clone", "uint32_t", "pcmk_resource_t *", "GList *",
@@ -744,10 +729,9 @@ pe__clone_default(pcmk__output_t *out, va_list args)
744729
pcmk__insert_dup(stopped, child_rsc->id, "Stopped");
745730
}
746731

747-
} else if (pcmk__is_set_recursive(child_rsc, pcmk__rsc_removed, true)
732+
} else if (pcmk__is_set_recursive(child_rsc, pcmk__rsc_removed)
748733
|| !rsc_managed_recursive(child_rsc)
749-
|| pcmk__is_set_recursive(child_rsc, pcmk__rsc_failed,
750-
true)) {
734+
|| pcmk__is_set_recursive(child_rsc, pcmk__rsc_failed)) {
751735

752736
// Print individual instance when active removed/unmanaged/failed
753737
print_full = TRUE;

0 commit comments

Comments
 (0)