pacemaker/SOURCES/009-validate.patch
2022-11-08 14:06:30 +00:00

95 lines
3.1 KiB
Diff

From d00a6abde7e6a41f8bc6085c875cb8072aff499b Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 30 Jun 2022 09:25:05 -0400
Subject: [PATCH 1/2] Fix: libstonithd: Add the "Agent not found..." message to
formatted output.
---
lib/fencing/st_client.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
index 137642af7..971bbe9a5 100644
--- a/lib/fencing/st_client.c
+++ b/lib/fencing/st_client.c
@@ -1763,9 +1763,14 @@ stonith_api_validate(stonith_t *st, int call_options, const char *rsc_id,
default:
rc = -EINVAL;
errno = EINVAL;
- crm_perror(LOG_ERR,
- "Agent %s not found or does not support validation",
- agent);
+
+ if (error_output) {
+ *error_output = crm_strdup_printf("Agent %s not found or does not support validation",
+ agent);
+ } else {
+ crm_err("Agent %s not found or does not support validation", agent);
+ }
+
break;
}
g_hash_table_destroy(params_table);
--
2.31.1
From f3a5fc961c30556b975011773e4cebf323bec38e Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 1 Jul 2022 10:38:45 -0400
Subject: [PATCH 2/2] Refactor: libstonithd: Split apart error conditions when
validating.
The "not found" and "can't validate" cases were previously jumbled
together. Now, return ENOENT if the agent is not found and EOPNOTSUPP
if it can't validate. The only caller appears to be handling both cases
correctly already, so no changes are needed there.
---
lib/fencing/st_client.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/lib/fencing/st_client.c b/lib/fencing/st_client.c
index 971bbe9a5..192334812 100644
--- a/lib/fencing/st_client.c
+++ b/lib/fencing/st_client.c
@@ -1760,19 +1760,32 @@ stonith_api_validate(stonith_t *st, int call_options, const char *rsc_id,
break;
#endif
+ case st_namespace_invalid:
+ errno = ENOENT;
+ rc = -errno;
+
+ if (error_output) {
+ *error_output = crm_strdup_printf("Agent %s not found", agent);
+ } else {
+ crm_err("Agent %s not found", agent);
+ }
+
+ break;
+
default:
- rc = -EINVAL;
- errno = EINVAL;
+ errno = EOPNOTSUPP;
+ rc = -errno;
if (error_output) {
- *error_output = crm_strdup_printf("Agent %s not found or does not support validation",
+ *error_output = crm_strdup_printf("Agent %s does not support validation",
agent);
} else {
- crm_err("Agent %s not found or does not support validation", agent);
+ crm_err("Agent %s does not support validation", agent);
}
break;
}
+
g_hash_table_destroy(params_table);
return rc;
}
--
2.31.1