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