|
|
6db787 |
From 45813df3eb4c8ad8b1744fa5dd56af86ad0fb3dd Mon Sep 17 00:00:00 2001
|
|
|
6db787 |
From: Chris Lumens <clumens@redhat.com>
|
|
|
6db787 |
Date: Thu, 17 Jun 2021 16:07:55 -0400
|
|
|
6db787 |
Subject: [PATCH] Refactor: libs: pcmk__str_in_list should support pcmk__str_*
|
|
|
6db787 |
flags.
|
|
|
6db787 |
|
|
|
6db787 |
---
|
|
|
6db787 |
include/crm/common/strings_internal.h | 2 +-
|
|
|
6db787 |
lib/common/strings.c | 34 +++++++++++++++++++++++----
|
|
|
6db787 |
lib/fencing/st_output.c | 10 ++++----
|
|
|
6db787 |
lib/pengine/bundle.c | 8 +++----
|
|
|
6db787 |
lib/pengine/clone.c | 28 +++++++++++-----------
|
|
|
6db787 |
lib/pengine/group.c | 18 +++++++-------
|
|
|
6db787 |
lib/pengine/native.c | 4 ++--
|
|
|
6db787 |
lib/pengine/pe_output.c | 22 ++++++++---------
|
|
|
6db787 |
lib/pengine/utils.c | 6 ++---
|
|
|
6db787 |
9 files changed, 79 insertions(+), 53 deletions(-)
|
|
|
6db787 |
|
|
|
6db787 |
diff --git a/include/crm/common/strings_internal.h b/include/crm/common/strings_internal.h
|
|
|
6db787 |
index 94982cb4e..687079814 100644
|
|
|
6db787 |
--- a/include/crm/common/strings_internal.h
|
|
|
6db787 |
+++ b/include/crm/common/strings_internal.h
|
|
|
6db787 |
@@ -117,7 +117,7 @@ pcmk__intkey_table_remove(GHashTable *hash_table, int key)
|
|
|
6db787 |
return g_hash_table_remove(hash_table, GINT_TO_POINTER(key));
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
-gboolean pcmk__str_in_list(GList *lst, const gchar *s);
|
|
|
6db787 |
+gboolean pcmk__str_in_list(GList *lst, const gchar *s, uint32_t flags);
|
|
|
6db787 |
|
|
|
6db787 |
bool pcmk__strcase_any_of(const char *s, ...) G_GNUC_NULL_TERMINATED;
|
|
|
6db787 |
bool pcmk__str_any_of(const char *s, ...) G_GNUC_NULL_TERMINATED;
|
|
|
6db787 |
diff --git a/lib/common/strings.c b/lib/common/strings.c
|
|
|
6db787 |
index 3264db5b6..e1e98803b 100644
|
|
|
6db787 |
--- a/lib/common/strings.c
|
|
|
6db787 |
+++ b/lib/common/strings.c
|
|
|
6db787 |
@@ -872,14 +872,30 @@ pcmk__parse_ll_range(const char *srcstring, long long *start, long long *end)
|
|
|
6db787 |
* Search \p lst for \p s, taking case into account. As a special case,
|
|
|
6db787 |
* if "*" is the only element of \p lst, the search is successful.
|
|
|
6db787 |
*
|
|
|
6db787 |
- * \param[in] lst List to search
|
|
|
6db787 |
- * \param[in] s String to search for
|
|
|
6db787 |
+ * Behavior can be changed with various flags:
|
|
|
6db787 |
+ *
|
|
|
6db787 |
+ * - pcmk__str_casei - By default, comparisons are done taking case into
|
|
|
6db787 |
+ * account. This flag makes comparisons case-insensitive.
|
|
|
6db787 |
+ * - pcmk__str_null_matches - If the input string is NULL, return TRUE.
|
|
|
6db787 |
+ *
|
|
|
6db787 |
+ * \note The special "*" matching rule takes precedence over flags. In
|
|
|
6db787 |
+ * particular, "*" will match a NULL input string even without
|
|
|
6db787 |
+ * pcmk__str_null_matches being specified.
|
|
|
6db787 |
+ *
|
|
|
6db787 |
+ * \note No matter what input string or flags are provided, an empty
|
|
|
6db787 |
+ * list will always return FALSE.
|
|
|
6db787 |
+ *
|
|
|
6db787 |
+ * \param[in] lst List to search
|
|
|
6db787 |
+ * \param[in] s String to search for
|
|
|
6db787 |
+ * \param[in] flags A bitfield of pcmk__str_flags to modify operation
|
|
|
6db787 |
*
|
|
|
6db787 |
* \return \c TRUE if \p s is in \p lst, or \c FALSE otherwise
|
|
|
6db787 |
*/
|
|
|
6db787 |
gboolean
|
|
|
6db787 |
-pcmk__str_in_list(GList *lst, const gchar *s)
|
|
|
6db787 |
+pcmk__str_in_list(GList *lst, const gchar *s, uint32_t flags)
|
|
|
6db787 |
{
|
|
|
6db787 |
+ GCompareFunc fn;
|
|
|
6db787 |
+
|
|
|
6db787 |
if (lst == NULL) {
|
|
|
6db787 |
return FALSE;
|
|
|
6db787 |
}
|
|
|
6db787 |
@@ -888,7 +904,17 @@ pcmk__str_in_list(GList *lst, const gchar *s)
|
|
|
6db787 |
return TRUE;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- return g_list_find_custom(lst, s, (GCompareFunc) strcmp) != NULL;
|
|
|
6db787 |
+ if (s == NULL) {
|
|
|
6db787 |
+ return pcmk_is_set(flags, pcmk__str_null_matches);
|
|
|
6db787 |
+ }
|
|
|
6db787 |
+
|
|
|
6db787 |
+ if (pcmk_is_set(flags, pcmk__str_casei)) {
|
|
|
6db787 |
+ fn = (GCompareFunc) strcasecmp;
|
|
|
6db787 |
+ } else {
|
|
|
6db787 |
+ fn = (GCompareFunc) strcmp;
|
|
|
6db787 |
+ }
|
|
|
6db787 |
+
|
|
|
6db787 |
+ return g_list_find_custom(lst, s, fn) != NULL;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
static bool
|
|
|
6db787 |
diff --git a/lib/fencing/st_output.c b/lib/fencing/st_output.c
|
|
|
6db787 |
index 568ae46a8..e1ae8ac87 100644
|
|
|
6db787 |
--- a/lib/fencing/st_output.c
|
|
|
6db787 |
+++ b/lib/fencing/st_output.c
|
|
|
6db787 |
@@ -47,7 +47,7 @@ stonith__failed_history(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, hp->target)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, hp->target, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -72,7 +72,7 @@ stonith__history(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
int rc = pcmk_rc_no_output;
|
|
|
6db787 |
|
|
|
6db787 |
for (stonith_history_t *hp = history; hp; hp = hp->next) {
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, hp->target)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, hp->target, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -101,7 +101,7 @@ stonith__full_history(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
int rc = pcmk_rc_no_output;
|
|
|
6db787 |
|
|
|
6db787 |
for (stonith_history_t *hp = history; hp; hp = hp->next) {
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, hp->target)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, hp->target, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -129,7 +129,7 @@ full_history_xml(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
|
|
|
6db787 |
if (history_rc == 0) {
|
|
|
6db787 |
for (stonith_history_t *hp = history; hp; hp = hp->next) {
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, hp->target)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, hp->target, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -218,7 +218,7 @@ stonith__pending_actions(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
int rc = pcmk_rc_no_output;
|
|
|
6db787 |
|
|
|
6db787 |
for (stonith_history_t *hp = history; hp; hp = hp->next) {
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, hp->target)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, hp->target, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
diff --git a/lib/pengine/bundle.c b/lib/pengine/bundle.c
|
|
|
6db787 |
index 9237392e4..6ba786ae6 100644
|
|
|
6db787 |
--- a/lib/pengine/bundle.c
|
|
|
6db787 |
+++ b/lib/pengine/bundle.c
|
|
|
6db787 |
@@ -1492,7 +1492,7 @@ pe__bundle_xml(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc->id);
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none);
|
|
|
6db787 |
|
|
|
6db787 |
for (GList *gIter = bundle_data->replicas; gIter != NULL;
|
|
|
6db787 |
gIter = gIter->next) {
|
|
|
6db787 |
@@ -1614,7 +1614,7 @@ pe__bundle_html(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc->id);
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none);
|
|
|
6db787 |
|
|
|
6db787 |
for (GList *gIter = bundle_data->replicas; gIter != NULL;
|
|
|
6db787 |
gIter = gIter->next) {
|
|
|
6db787 |
@@ -1742,7 +1742,7 @@ pe__bundle_text(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc->id);
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none);
|
|
|
6db787 |
|
|
|
6db787 |
for (GList *gIter = bundle_data->replicas; gIter != NULL;
|
|
|
6db787 |
gIter = gIter->next) {
|
|
|
6db787 |
@@ -2044,7 +2044,7 @@ pe__bundle_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_paren
|
|
|
6db787 |
gboolean passes = FALSE;
|
|
|
6db787 |
pe__bundle_variant_data_t *bundle_data = NULL;
|
|
|
6db787 |
|
|
|
6db787 |
- if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc))) {
|
|
|
6db787 |
+ if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none)) {
|
|
|
6db787 |
passes = TRUE;
|
|
|
6db787 |
} else {
|
|
|
6db787 |
get_bundle_variant_data(bundle_data, rsc);
|
|
|
6db787 |
diff --git a/lib/pengine/clone.c b/lib/pengine/clone.c
|
|
|
6db787 |
index 5662338f3..5a6bfa61f 100644
|
|
|
6db787 |
--- a/lib/pengine/clone.c
|
|
|
6db787 |
+++ b/lib/pengine/clone.c
|
|
|
6db787 |
@@ -624,8 +624,8 @@ pe__clone_xml(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none));
|
|
|
6db787 |
|
|
|
6db787 |
for (; gIter != NULL; gIter = gIter->next) {
|
|
|
6db787 |
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
|
|
|
6db787 |
@@ -693,8 +693,8 @@ pe__clone_html(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none));
|
|
|
6db787 |
|
|
|
6db787 |
out->begin_list(out, NULL, NULL, "Clone Set: %s [%s]%s%s%s%s",
|
|
|
6db787 |
rsc->id, ID(clone_data->xml_obj_child),
|
|
|
6db787 |
@@ -801,7 +801,7 @@ pe__clone_html(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
for (gIter = promoted_list; gIter; gIter = gIter->next) {
|
|
|
6db787 |
pe_node_t *host = gIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, host->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, host->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -822,7 +822,7 @@ pe__clone_html(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
for (gIter = started_list; gIter; gIter = gIter->next) {
|
|
|
6db787 |
pe_node_t *host = gIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, host->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, host->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -884,7 +884,7 @@ pe__clone_html(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
pe_node_t *node = (pe_node_t *)nIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
if (pe_find_node(rsc->running_on, node->details->uname) == NULL &&
|
|
|
6db787 |
- pcmk__str_in_list(only_node, node->details->uname)) {
|
|
|
6db787 |
+ pcmk__str_in_list(only_node, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
pcmk__add_word(&stopped_list, &stopped_list_len,
|
|
|
6db787 |
node->details->uname);
|
|
|
6db787 |
}
|
|
|
6db787 |
@@ -933,8 +933,8 @@ pe__clone_text(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none));
|
|
|
6db787 |
|
|
|
6db787 |
out->begin_list(out, NULL, NULL, "Clone Set: %s [%s]%s%s%s%s",
|
|
|
6db787 |
rsc->id, ID(clone_data->xml_obj_child),
|
|
|
6db787 |
@@ -1041,7 +1041,7 @@ pe__clone_text(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
for (gIter = promoted_list; gIter; gIter = gIter->next) {
|
|
|
6db787 |
pe_node_t *host = gIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, host->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, host->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -1062,7 +1062,7 @@ pe__clone_text(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
for (gIter = started_list; gIter; gIter = gIter->next) {
|
|
|
6db787 |
pe_node_t *host = gIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, host->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, host->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -1120,7 +1120,7 @@ pe__clone_text(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
pe_node_t *node = (pe_node_t *)nIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
if (pe_find_node(rsc->running_on, node->details->uname) == NULL &&
|
|
|
6db787 |
- pcmk__str_in_list(only_node, node->details->uname)) {
|
|
|
6db787 |
+ pcmk__str_in_list(only_node, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
pcmk__add_word(&stopped_list, &stopped_list_len,
|
|
|
6db787 |
node->details->uname);
|
|
|
6db787 |
}
|
|
|
6db787 |
@@ -1220,11 +1220,11 @@ pe__clone_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent
|
|
|
6db787 |
gboolean passes = FALSE;
|
|
|
6db787 |
clone_variant_data_t *clone_data = NULL;
|
|
|
6db787 |
|
|
|
6db787 |
- if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc))) {
|
|
|
6db787 |
+ if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none)) {
|
|
|
6db787 |
passes = TRUE;
|
|
|
6db787 |
} else {
|
|
|
6db787 |
get_clone_variant_data(clone_data, rsc);
|
|
|
6db787 |
- passes = pcmk__str_in_list(only_rsc, ID(clone_data->xml_obj_child));
|
|
|
6db787 |
+ passes = pcmk__str_in_list(only_rsc, ID(clone_data->xml_obj_child), pcmk__str_none);
|
|
|
6db787 |
|
|
|
6db787 |
if (!passes) {
|
|
|
6db787 |
for (GList *gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
|
|
|
6db787 |
diff --git a/lib/pengine/group.c b/lib/pengine/group.c
|
|
|
6db787 |
index 23a72cff7..5f9aa83ce 100644
|
|
|
6db787 |
--- a/lib/pengine/group.c
|
|
|
6db787 |
+++ b/lib/pengine/group.c
|
|
|
6db787 |
@@ -201,8 +201,8 @@ pe__group_xml(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none));
|
|
|
6db787 |
|
|
|
6db787 |
for (; gIter != NULL; gIter = gIter->next) {
|
|
|
6db787 |
pe_resource_t *child_rsc = (pe_resource_t *) gIter->data;
|
|
|
6db787 |
@@ -248,8 +248,8 @@ pe__group_html(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none));
|
|
|
6db787 |
|
|
|
6db787 |
if (options & pe_print_brief) {
|
|
|
6db787 |
GList *rscs = pe__filter_rsc_list(rsc->children, only_rsc);
|
|
|
6db787 |
@@ -303,8 +303,8 @@ pe__group_text(pcmk__output_t *out, va_list args)
|
|
|
6db787 |
return rc;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id));
|
|
|
6db787 |
+ print_everything = pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none));
|
|
|
6db787 |
|
|
|
6db787 |
if (options & pe_print_brief) {
|
|
|
6db787 |
GList *rscs = pe__filter_rsc_list(rsc->children, only_rsc);
|
|
|
6db787 |
@@ -387,11 +387,11 @@ pe__group_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent
|
|
|
6db787 |
{
|
|
|
6db787 |
gboolean passes = FALSE;
|
|
|
6db787 |
|
|
|
6db787 |
- if (check_parent && pcmk__str_in_list(only_rsc, rsc_printable_id(uber_parent(rsc)))) {
|
|
|
6db787 |
+ if (check_parent && pcmk__str_in_list(only_rsc, rsc_printable_id(uber_parent(rsc)), pcmk__str_none)) {
|
|
|
6db787 |
passes = TRUE;
|
|
|
6db787 |
- } else if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc))) {
|
|
|
6db787 |
+ } else if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none)) {
|
|
|
6db787 |
passes = TRUE;
|
|
|
6db787 |
- } else if (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id)) {
|
|
|
6db787 |
+ } else if (strstr(rsc->id, ":") != NULL && pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none)) {
|
|
|
6db787 |
passes = TRUE;
|
|
|
6db787 |
} else {
|
|
|
6db787 |
for (GList *gIter = rsc->children; gIter != NULL; gIter = gIter->next) {
|
|
|
6db787 |
diff --git a/lib/pengine/native.c b/lib/pengine/native.c
|
|
|
6db787 |
index c2333d0d2..56054fc4a 100644
|
|
|
6db787 |
--- a/lib/pengine/native.c
|
|
|
6db787 |
+++ b/lib/pengine/native.c
|
|
|
6db787 |
@@ -1338,8 +1338,8 @@ pe__rscs_brief_output(pcmk__output_t *out, GList *rsc_list, unsigned int show_op
|
|
|
6db787 |
gboolean
|
|
|
6db787 |
pe__native_is_filtered(pe_resource_t *rsc, GList *only_rsc, gboolean check_parent)
|
|
|
6db787 |
{
|
|
|
6db787 |
- if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- pcmk__str_in_list(only_rsc, rsc->id)) {
|
|
|
6db787 |
+ if (pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ pcmk__str_in_list(only_rsc, rsc->id, pcmk__str_none)) {
|
|
|
6db787 |
return FALSE;
|
|
|
6db787 |
} else if (check_parent) {
|
|
|
6db787 |
pe_resource_t *up = uber_parent(rsc);
|
|
|
6db787 |
diff --git a/lib/pengine/pe_output.c b/lib/pengine/pe_output.c
|
|
|
6db787 |
index 727475735..a6dc4ade8 100644
|
|
|
6db787 |
--- a/lib/pengine/pe_output.c
|
|
|
6db787 |
+++ b/lib/pengine/pe_output.c
|
|
|
6db787 |
@@ -670,8 +670,8 @@ ban_list(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_rsc, rsc_printable_id(location->rsc_lh)) &&
|
|
|
6db787 |
- !pcmk__str_in_list(only_rsc, rsc_printable_id(uber_parent(location->rsc_lh)))) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_rsc, rsc_printable_id(location->rsc_lh), pcmk__str_none) &&
|
|
|
6db787 |
+ !pcmk__str_in_list(only_rsc, rsc_printable_id(uber_parent(location->rsc_lh)), pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -1254,7 +1254,7 @@ failed_action_list(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
xml_op = pcmk__xml_next(xml_op)) {
|
|
|
6db787 |
char *rsc = NULL;
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, crm_element_value(xml_op, XML_ATTR_UNAME))) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, crm_element_value(xml_op, XML_ATTR_UNAME), pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -1263,7 +1263,7 @@ failed_action_list(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_rsc, rsc)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_rsc, rsc, pcmk__str_none)) {
|
|
|
6db787 |
free(rsc);
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
@@ -1738,7 +1738,7 @@ node_attribute_list(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, node->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
g_list_free(attr_list);
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
@@ -1835,8 +1835,8 @@ node_history_list(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
* For other resource types, is_filtered is okay.
|
|
|
6db787 |
*/
|
|
|
6db787 |
if (uber_parent(rsc)->variant == pe_group) {
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_rsc, rsc_printable_id(rsc)) &&
|
|
|
6db787 |
- !pcmk__str_in_list(only_rsc, rsc_printable_id(uber_parent(rsc)))) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_rsc, rsc_printable_id(rsc), pcmk__str_none) &&
|
|
|
6db787 |
+ !pcmk__str_in_list(only_rsc, rsc_printable_id(uber_parent(rsc)), pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
} else {
|
|
|
6db787 |
@@ -1899,7 +1899,7 @@ node_list_html(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) {
|
|
|
6db787 |
pe_node_t *node = (pe_node_t *) gIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, node->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -1940,7 +1940,7 @@ pe__node_list_text(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
const char *node_mode = NULL;
|
|
|
6db787 |
char *node_name = pe__node_display_name(node, print_clone_detail);
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, node->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
free(node_name);
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
@@ -2059,7 +2059,7 @@ node_list_xml(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
for (GList *gIter = nodes; gIter != NULL; gIter = gIter->next) {
|
|
|
6db787 |
pe_node_t *node = (pe_node_t *) gIter->data;
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, node->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
@@ -2097,7 +2097,7 @@ node_summary(pcmk__output_t *out, va_list args) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
- if (!pcmk__str_in_list(only_node, node->details->uname)) {
|
|
|
6db787 |
+ if (!pcmk__str_in_list(only_node, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
continue;
|
|
|
6db787 |
}
|
|
|
6db787 |
|
|
|
6db787 |
diff --git a/lib/pengine/utils.c b/lib/pengine/utils.c
|
|
|
6db787 |
index 450d8348c..d1be9e4ca 100644
|
|
|
6db787 |
--- a/lib/pengine/utils.c
|
|
|
6db787 |
+++ b/lib/pengine/utils.c
|
|
|
6db787 |
@@ -2394,7 +2394,7 @@ pe__rsc_running_on_any_node_in_list(pe_resource_t *rsc, GList *node_list)
|
|
|
6db787 |
{
|
|
|
6db787 |
for (GList *ele = rsc->running_on; ele; ele = ele->next) {
|
|
|
6db787 |
pe_node_t *node = (pe_node_t *) ele->data;
|
|
|
6db787 |
- if (pcmk__str_in_list(node_list, node->details->uname)) {
|
|
|
6db787 |
+ if (pcmk__str_in_list(node_list, node->details->uname, pcmk__str_none)) {
|
|
|
6db787 |
return true;
|
|
|
6db787 |
}
|
|
|
6db787 |
}
|
|
|
6db787 |
@@ -2419,8 +2419,8 @@ pe__filter_rsc_list(GList *rscs, GList *filter)
|
|
|
6db787 |
/* I think the second condition is safe here for all callers of this
|
|
|
6db787 |
* function. If not, it needs to move into pe__node_text.
|
|
|
6db787 |
*/
|
|
|
6db787 |
- if (pcmk__str_in_list(filter, rsc_printable_id(rsc)) ||
|
|
|
6db787 |
- (rsc->parent && pcmk__str_in_list(filter, rsc_printable_id(rsc->parent)))) {
|
|
|
6db787 |
+ if (pcmk__str_in_list(filter, rsc_printable_id(rsc), pcmk__str_none) ||
|
|
|
6db787 |
+ (rsc->parent && pcmk__str_in_list(filter, rsc_printable_id(rsc->parent), pcmk__str_none))) {
|
|
|
6db787 |
retval = g_list_prepend(retval, rsc);
|
|
|
6db787 |
}
|
|
|
6db787 |
}
|
|
|
6db787 |
--
|
|
|
6db787 |
2.27.0
|
|
|
6db787 |
|