From 9170a9e5991568a32b80c367a8f43437f5212ebf Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 09:58:12 -0500 Subject: [PATCH 1/8] Build: common.mk: drop libltdl from default includes We long ago moved the relevant directory to libltdl/libltdl, so it's obviously not needed. --- mk/common.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/mk/common.mk b/mk/common.mk index 4c92a0f0dc0..40fb9cbc0f4 100644 --- a/mk/common.mk +++ b/mk/common.mk @@ -37,6 +37,4 @@ am__v_BOOK_1 = MAINTAINERCLEANFILES = Makefile.in AM_CPPFLAGS = -I$(top_builddir)/include \ - -I$(top_srcdir)/include \ - -I$(top_builddir)/libltdl \ - -I$(top_srcdir)/libltdl + -I$(top_srcdir)/include From da3bc2da1b5ed3b6fc3bb162d9b8081fd7b7fdd4 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 11:15:45 -0500 Subject: [PATCH 2/8] Low: agents: use configured run directory in attribute agent ... instead of hardcoding /var/run --- agents/ocf/attribute.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/agents/ocf/attribute.in b/agents/ocf/attribute.in index ade3a1c26ac..1264370d1c7 100755 --- a/agents/ocf/attribute.in +++ b/agents/ocf/attribute.in @@ -2,7 +2,7 @@ # # ocf:pacemaker:attribute resource agent # -# Copyright 2016-2023 the Pacemaker project contributors +# Copyright 2016-2024 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -20,7 +20,7 @@ Expects to have a fully populated OCF RA-compliant environment set." : ${__OCF_ACTION:="$1"} # Ensure certain variables are set and not empty -: ${HA_VARRUN:="/var/run"} +: ${HA_VARRUN:="@runstatedir@"} : ${OCF_RESKEY_CRM_meta_globally_unique:="false"} : ${OCF_RESOURCE_INSTANCE:="undef"} From e9b6c8654f376823275fe5773e25c0c830bd5cfc Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 11:16:35 -0500 Subject: [PATCH 3/8] Doc: agents: use RESOURCENAME in attribute agent metadata ... as a placeholder instead of "undef", so the help looks like OCF_RESKEY_name = string [opa-RESOURCENAME] instead of OCF_RESKEY_name = string [opa-undef] --- agents/ocf/attribute.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agents/ocf/attribute.in b/agents/ocf/attribute.in index 1264370d1c7..d7668f1f3e6 100755 --- a/agents/ocf/attribute.in +++ b/agents/ocf/attribute.in @@ -22,7 +22,7 @@ Expects to have a fully populated OCF RA-compliant environment set." # Ensure certain variables are set and not empty : ${HA_VARRUN:="@runstatedir@"} : ${OCF_RESKEY_CRM_meta_globally_unique:="false"} -: ${OCF_RESOURCE_INSTANCE:="undef"} +: ${OCF_RESOURCE_INSTANCE:="RESOURCENAME"} DEFAULT_STATE_FILE="${HA_VARRUN%%/}/opa-${OCF_RESOURCE_INSTANCE}.state" if [ "${OCF_RESKEY_CRM_meta_globally_unique}" = "false" ]; then From ea64336db173e4d38c1ee95738a1fd2f0d851f28 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 11:24:30 -0500 Subject: [PATCH 4/8] Low: agents: always allow attribute agent to show metadata ... even if the OCF functions are unavailable --- agents/ocf/attribute.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/agents/ocf/attribute.in b/agents/ocf/attribute.in index d7668f1f3e6..ced807e3d3f 100755 --- a/agents/ocf/attribute.in +++ b/agents/ocf/attribute.in @@ -14,9 +14,10 @@ USAGE="Usage: $0 {start|stop|monitor|migrate_to|migrate_from|validate-all|meta-d Expects to have a fully populated OCF RA-compliant environment set." -# Load OCF helper functions +# If the OCF helper funtions aren't available, we can still show metadata. : ${OCF_FUNCTIONS:="${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs"} -. "${OCF_FUNCTIONS}" +[ -r "${OCF_FUNCTIONS}" ] && . "${OCF_FUNCTIONS}" + : ${__OCF_ACTION:="$1"} # Ensure certain variables are set and not empty From 05cc9aaa55f147b5765fdd5421e02a996a00fb26 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 11:37:14 -0500 Subject: [PATCH 5/8] Refactor: pacemaked: use NULL for pointer comparison ... instead of 0 --- daemons/pacemakerd/pcmkd_subdaemons.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/daemons/pacemakerd/pcmkd_subdaemons.c b/daemons/pacemakerd/pcmkd_subdaemons.c index b87a9b4ecb2..a06c348a2d9 100644 --- a/daemons/pacemakerd/pcmkd_subdaemons.c +++ b/daemons/pacemakerd/pcmkd_subdaemons.c @@ -18,6 +18,7 @@ #include #include #include +#include #include #include #include @@ -452,7 +453,7 @@ start_child(pcmk_child_t * child) use_valgrind = FALSE; } - if ((child->uid != 0) && (crm_user_lookup(child->uid, &uid, &gid) < 0)) { + if ((child->uid != NULL) && (crm_user_lookup(child->uid, &uid, &gid) < 0)) { crm_err("Invalid user (%s) for subdaemon %s: not found", child->uid, child->name); return EACCES; From 8786f438caa40e951a522dbc30686a82ccaa94b1 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 11:38:32 -0500 Subject: [PATCH 6/8] Doc: Pacemaker Explained: correct typo in standard name --- doc/sphinx/Pacemaker_Explained/resources.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/sphinx/Pacemaker_Explained/resources.rst b/doc/sphinx/Pacemaker_Explained/resources.rst index 54e9d99e175..a2781604725 100644 --- a/doc/sphinx/Pacemaker_Explained/resources.rst +++ b/doc/sphinx/Pacemaker_Explained/resources.rst @@ -40,7 +40,7 @@ more detail below: * lsb * systemd * service -* stonithd +* stonith * nagios *(deprecated since 2.1.6)* * upstart *(deprecated since 2.1.0)* From e496779ee1a960085133fa63e5bff4164409eb91 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 11:40:00 -0500 Subject: [PATCH 7/8] Low: libcrmcommon: any negative interval is an error We don't allow negative durations in configuration options. pcmk_parse_interval_spec() previously checked only for -1, which crm_get_msec() sets on error, but the user could have explicitly (and wrongly) set a negative number. --- lib/common/strings.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/common/strings.c b/lib/common/strings.c index c4be799a43e..38d8f156adf 100644 --- a/lib/common/strings.c +++ b/lib/common/strings.c @@ -482,7 +482,7 @@ pcmk_parse_interval_spec(const char *input, guint *result_ms) msec = crm_get_msec(input); } - if (msec == PCMK__PARSE_INT_DEFAULT) { + if (msec < 0) { crm_warn("Using 0 instead of invalid interval specification '%s'", input); msec = 0; From 6506a0bff33e36e538e234c7fe0c3cde47bd9838 Mon Sep 17 00:00:00 2001 From: Ken Gaillot Date: Wed, 16 Oct 2024 11:45:26 -0500 Subject: [PATCH 8/8] Fix: tools: restore crmadmin default timeout to 30 seconds Regression introduced in 2.1.5 via a6ec43e That commit switched to using synchronous (blocking) IPC when timeout was set to 0 (the default, which previously meant use 30s). That was a change in behavior that was a bad idea if someone is calling it in a script. This still allows the user to explicitly specify --timeout=0 to get the blocking behavior. --- tools/crmadmin.8.inc | 3 +++ tools/crmadmin.c | 25 ++++++++++++++----------- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/tools/crmadmin.8.inc b/tools/crmadmin.8.inc index ab5efbe0a92..b5e2797ecb7 100644 --- a/tools/crmadmin.8.inc +++ b/tools/crmadmin.8.inc @@ -3,3 +3,6 @@ crmadmin [options] [node] /the Pacemaker controller/ .SH OPTIONS + +/query information/ +.SH NOTES diff --git a/tools/crmadmin.c b/tools/crmadmin.c index 082904fb14d..275d51bad2c 100644 --- a/tools/crmadmin.c +++ b/tools/crmadmin.c @@ -38,6 +38,7 @@ struct { char *ipc_name; gboolean bash_export; } options = { + .timeout = 30000, // Default to 30 seconds .optarg = NULL, .ipc_name = NULL, .bash_export = FALSE @@ -80,9 +81,10 @@ static GOptionEntry command_options[] = { static GOptionEntry additional_options[] = { { "timeout", 't', 0, G_OPTION_ARG_CALLBACK, command_cb, - "Time to wait before declaring the operation" - "\n failed", - "TIMESPEC" + "Time to wait before declaring the operation" + "\n " + "failed (default 30s; use 0 to disable timeout)", + "DURATION" }, { "bash-export", 'B', 0, G_OPTION_ARG_NONE, &options.bash_export, "Display nodes as shell commands of the form 'export uname=uuid'" @@ -131,17 +133,18 @@ static pcmk__supported_format_t formats[] = { { NULL, NULL, NULL } }; +#define DESC \ + "Notes:\n\n" \ + "DURATION in any command line option can be specified as an integer\n" \ + "number of seconds, an integer plus units (ms, msec, us, usec, s, sec,\n" \ + "m, min, h, or hr), or an ISO 8601 period specification.\n\n" \ + "Report bugs to " PCMK__BUG_URL + + static GOptionContext * build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { GOptionContext *context = NULL; - const char *description = "Notes:\n\n" - "Time Specification:\n\n" - "The TIMESPEC in any command line option can be specified in many different\n" - "formats. It can be just an integer number of seconds, a number plus units\n" - "(ms/msec/us/usec/s/sec/m/min/h/hr), or an ISO 8601 period specification.\n\n" - "Report bugs to " PCMK__BUG_URL; - GOptionEntry extra_prog_entries[] = { { "quiet", 'q', 0, G_OPTION_ARG_NONE, &(args->quiet), "Display only the essential query information", @@ -151,7 +154,7 @@ build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) { }; context = pcmk__build_arg_context(args, "text (default), xml", group, NULL); - g_option_context_set_description(context, description); + g_option_context_set_description(context, DESC); /* Add the -q option, which cannot be part of the globally supported options * because some tools use that flag for something else.