summaryrefslogtreecommitdiffstats
path: root/tools/stonith_admin.c
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:28 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-03 13:39:28 +0000
commit924f5ea83e48277e014ebf0d19a27187cb93e2f7 (patch)
tree75920a275bba045f6d108204562c218a9a26ea15 /tools/stonith_admin.c
parentAdding upstream version 2.1.7. (diff)
downloadpacemaker-upstream.tar.xz
pacemaker-upstream.zip
Adding upstream version 2.1.8~rc1.upstream/2.1.8_rc1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tools/stonith_admin.c')
-rw-r--r--tools/stonith_admin.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/tools/stonith_admin.c b/tools/stonith_admin.c
index 01f72d5..2268e0d 100644
--- a/tools/stonith_admin.c
+++ b/tools/stonith_admin.c
@@ -1,5 +1,5 @@
/*
- * Copyright 2009-2023 the Pacemaker project contributors
+ * Copyright 2009-2024 the Pacemaker project contributors
*
* The version control history for this file may have further details.
*
@@ -23,14 +23,13 @@
#include <string.h>
#include <crm/crm.h>
-#include <crm/msg_xml.h>
#include <crm/common/ipc.h>
#include <crm/cluster/internal.h>
#include <crm/common/cmdline_internal.h>
#include <crm/common/output_internal.h>
#include <crm/stonith-ng.h>
-#include <crm/fencing/internal.h>
+#include <crm/fencing/internal.h> // stonith__register_messages()
#include <crm/cib.h>
#include <crm/pengine/status.h>
@@ -53,7 +52,7 @@ struct {
stonith_key_value_t *params;
int fence_level;
int timeout ;
- int tolerance;
+ long long tolerance_ms;
int delay;
char *agent;
char *confirm_host;
@@ -265,7 +264,15 @@ add_stonith_device(const gchar *option_name, const gchar *optarg, gpointer data,
gboolean
add_tolerance(const gchar *option_name, const gchar *optarg, gpointer data, GError **error) {
- options.tolerance = crm_get_msec(optarg) / 1000;
+ // pcmk__request_fencing() expects an unsigned int
+ options.tolerance_ms = crm_get_msec(optarg);
+
+ if (options.tolerance_ms < 0) {
+ crm_warn("Ignoring invalid tolerance '%s'", optarg);
+ options.tolerance_ms = 0;
+ } else {
+ options.tolerance_ms = QB_MIN(options.tolerance_ms, UINT_MAX);
+ }
return TRUE;
}
@@ -339,8 +346,8 @@ request_fencing(stonith_t *st, const char *target, const char *command,
char *reason = NULL;
int rc = pcmk__request_fencing(st, target, command, name,
options.timeout * 1000,
- options.tolerance * 1000,
- options.delay, &reason);
+ options.tolerance_ms, options.delay,
+ &reason);
if (rc != pcmk_rc_ok) {
const char *rc_str = pcmk_rc_str(rc);
@@ -408,6 +415,8 @@ main(int argc, char **argv)
goto done;
}
+ pcmk__output_enable_list_element(out);
+
stonith__register_messages(out);
if (args->version) {