Rebase on upstream 2.1.0-rc2 release

- Default resource-stickiness to 1 in newly created clusters
- Rebase on upstream 2.1.0 release
- Resolves: rhbz1850145
- Resolves: rhbz1936023
This commit is contained in:
Ken Gaillot 2021-05-12 18:04:09 -05:00
parent 7311eddeb1
commit 05e4c4a54b
8 changed files with 1380 additions and 112 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
/ClusterLabs-pacemaker-*.tar.gz
/[Pp]acemaker-*.tar.gz
/pacemaker-?????????/
/nagios-agents-metadata-*.tar.gz

225
001-ping-agent.patch Normal file
View File

@ -0,0 +1,225 @@
From c6ee0973522268ed7b3241cf0ec2e06398444114 Mon Sep 17 00:00:00 2001
From: Grace Chin <gchin@redhat.com>
Date: Tue, 4 May 2021 12:02:17 -0400
Subject: [PATCH 1/4] Remove deprecated attrd_options
---
extra/resources/ping | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/extra/resources/ping b/extra/resources/ping
index 3cf8dfe..2e93f22 100755
--- a/extra/resources/ping
+++ b/extra/resources/ping
@@ -178,7 +178,7 @@ ping_stop() {
rm -f "${OCF_RESKEY_pidfile}"
- attrd_updater -D -n "$OCF_RESKEY_name" -d "$OCF_RESKEY_dampen" $attrd_options
+ attrd_updater -D -n "$OCF_RESKEY_name" -d "$OCF_RESKEY_dampen"
return $OCF_SUCCESS
}
@@ -302,9 +302,9 @@ ping_update() {
score=$(expr $active \* $OCF_RESKEY_multiplier)
if [ "$__OCF_ACTION" = "start" ] ; then
- attrd_updater -n "$OCF_RESKEY_name" -B "$score" -d "$OCF_RESKEY_dampen" $attrd_options
+ attrd_updater -n "$OCF_RESKEY_name" -B "$score" -d "$OCF_RESKEY_dampen"
else
- attrd_updater -n "$OCF_RESKEY_name" -v "$score" -d "$OCF_RESKEY_dampen" $attrd_options
+ attrd_updater -n "$OCF_RESKEY_name" -v "$score" -d "$OCF_RESKEY_dampen"
fi
rc=$?
case $rc in
@@ -396,11 +396,6 @@ case "${OCF_RESKEY_debug}" in
;;
esac
-attrd_options='-q'
-if [ "${OCF_RESKEY_debug}" = "true" ]; then
- attrd_options=''
-fi
-
case "$__OCF_ACTION" in
meta-data) meta_data
exit $OCF_SUCCESS
--
1.8.3.1
From 6d6c4691cf0970059689856c354daf9e098b4451 Mon Sep 17 00:00:00 2001
From: Grace Chin <gchin@redhat.com>
Date: Tue, 4 May 2021 14:50:37 -0400
Subject: [PATCH 2/4] Replace debug values, true and false, with 0 and 1
---
extra/resources/ping | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/extra/resources/ping b/extra/resources/ping
index 2e93f22..fee019b 100755
--- a/extra/resources/ping
+++ b/extra/resources/ping
@@ -24,7 +24,7 @@
: ${OCF_RESKEY_dampen:="5s"}
: ${OCF_RESKEY_attempts:="3"}
: ${OCF_RESKEY_multiplier:="1"}
-: ${OCF_RESKEY_debug:="false"}
+: ${OCF_RESKEY_debug:="0"}
: ${OCF_RESKEY_failure_score:="0"}
: ${OCF_RESKEY_use_fping:="1"}
: ${OCF_RESKEY_host_list:=""}
@@ -152,7 +152,7 @@ END
ping_conditional_log() {
level="$1"; shift
- if [ "${OCF_RESKEY_debug}" = "true" ]; then
+ if [ $OCF_RESKEY_debug -gt 0 ]; then
ocf_log "$level" "$*"
fi
}
@@ -388,8 +388,8 @@ fi
# Check the debug option
case "${OCF_RESKEY_debug}" in
- true|True|TRUE|1) OCF_RESKEY_debug=true;;
- false|False|FALSE|0) OCF_RESKEY_debug=false;;
+ true|True|TRUE|1) OCF_RESKEY_debug=0;;
+ false|False|FALSE|0) OCF_RESKEY_debug=1;;
*)
ocf_log warn "Value for 'debug' is incorrect. Please specify 'true' or 'false' not: ${OCF_RESKEY_debug}"
OCF_RESKEY_debug=false
--
1.8.3.1
From a886a31056b6aca764c6911f5432af2c5ebf51df Mon Sep 17 00:00:00 2001
From: Grace Chin <gchin@redhat.com>
Date: Tue, 11 May 2021 11:04:50 -0400
Subject: [PATCH 3/4] Add verbose debug mode which logs ping and fping output
when set
---
extra/resources/ping | 19 ++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/extra/resources/ping b/extra/resources/ping
index fee019b..cc796af 100755
--- a/extra/resources/ping
+++ b/extra/resources/ping
@@ -249,10 +249,13 @@ fping_check() {
case $rc in
0)
+ if [ $OCF_RESKEY_debug -gt 1 ]; then
+ ping_conditional_log info "$output"
+ fi
;;
1)
for h in $(echo "$output" | grep "is unreachable" | awk '{print $1}'); do
- ping_conditional_log warn "$h is inactive"
+ ping_conditional_log warn "$h is inactive: $output"
done
;;
*)
@@ -282,7 +285,12 @@ ping_check() {
p_out=$($p_exe $p_args $OCF_RESKEY_options $host 2>&1); rc=$?
case $rc in
- 0) active=$(expr $active + 1);;
+ 0)
+ active=$(expr $active + 1)
+ if [ $OCF_RESKEY_debug -gt 1 ]; then
+ ping_conditional_log info "$p_out"
+ fi
+ ;;
1) ping_conditional_log warn "$host is inactive: $p_out";;
*) ocf_log err "Unexpected result for '$p_exe $p_args $OCF_RESKEY_options $host' $rc: $p_out";;
esac
@@ -388,10 +396,11 @@ fi
# Check the debug option
case "${OCF_RESKEY_debug}" in
- true|True|TRUE|1) OCF_RESKEY_debug=0;;
- false|False|FALSE|0) OCF_RESKEY_debug=1;;
+ true|True|TRUE|1) OCF_RESKEY_debug=1;;
+ false|False|FALSE|0) OCF_RESKEY_debug=0;;
+ verbose|Verbose|VERBOSE|2) OCF_RESKEY_debug=2;;
*)
- ocf_log warn "Value for 'debug' is incorrect. Please specify 'true' or 'false' not: ${OCF_RESKEY_debug}"
+ ocf_log warn "Value for 'debug' is incorrect. Please specify 'true', 'false', or 'verbose', not: ${OCF_RESKEY_debug}"
OCF_RESKEY_debug=false
;;
esac
--
1.8.3.1
From 460043f133ced80e923b1290af70502a72deb7f8 Mon Sep 17 00:00:00 2001
From: Grace Chin <gchin@redhat.com>
Date: Tue, 11 May 2021 11:07:05 -0400
Subject: [PATCH 4/4] Improve variable names
---
extra/resources/ping | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/extra/resources/ping b/extra/resources/ping
index cc796af..9763b60 100755
--- a/extra/resources/ping
+++ b/extra/resources/ping
@@ -244,22 +244,22 @@ fping_check() {
timeout=$(expr $OCF_RESKEY_timeout \* 1000 / $OCF_RESKEY_attempts)
cmd="$p_exe -r $OCF_RESKEY_attempts -t $timeout -B 1.0 $OCF_RESKEY_options $OCF_RESKEY_host_list"
- output=$($cmd 2>&1); rc=$?
- active=$(echo "$output" | grep "is alive" | wc -l)
+ fping_output=$($cmd 2>&1); rc=$?
+ active=$(echo "$fping_output" | grep "is alive" | wc -l)
case $rc in
0)
if [ $OCF_RESKEY_debug -gt 1 ]; then
- ping_conditional_log info "$output"
+ ping_conditional_log info "$fping_output"
fi
;;
1)
- for h in $(echo "$output" | grep "is unreachable" | awk '{print $1}'); do
- ping_conditional_log warn "$h is inactive: $output"
+ for h in $(echo "$fping_output" | grep "is unreachable" | awk '{print $1}'); do
+ ping_conditional_log warn "$h is inactive: $fping_output"
done
;;
*)
- ocf_log err "Unexpected result for '$cmd' $rc: $(echo "$output" | tr '\n' ';')"
+ ocf_log err "Unexpected result for '$cmd' $rc: $(echo "$fping_output" | tr '\n' ';')"
;;
esac
@@ -282,17 +282,17 @@ ping_check() {
*:*) p_exe=ping6
esac
- p_out=$($p_exe $p_args $OCF_RESKEY_options $host 2>&1); rc=$?
+ ping_output=$($p_exe $p_args $OCF_RESKEY_options $host 2>&1); rc=$?
case $rc in
0)
active=$(expr $active + 1)
if [ $OCF_RESKEY_debug -gt 1 ]; then
- ping_conditional_log info "$p_out"
+ ping_conditional_log info "$ping_output"
fi
;;
- 1) ping_conditional_log warn "$host is inactive: $p_out";;
- *) ocf_log err "Unexpected result for '$p_exe $p_args $OCF_RESKEY_options $host' $rc: $p_out";;
+ 1) ping_conditional_log warn "$host is inactive: $ping_output";;
+ *) ocf_log err "Unexpected result for '$p_exe $p_args $OCF_RESKEY_options $host' $rc: $ping_output";;
esac
done
return $active
--
1.8.3.1

View File

@ -0,0 +1,451 @@
From 0d40ebf10b1794ece2c5c9768ea7222d3834d3b3 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 13 May 2021 11:42:18 -0400
Subject: [PATCH 1/4] Build: Use a different variable to find man page
includes.
With other programs outside of the tools directory being converted to
use glib for command line handling, their includes are not going to be
in tools/. So we need to use a different autoconf variable to find
them.
---
mk/common.mk | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mk/common.mk b/mk/common.mk
index b247670..aa59feb 100644
--- a/mk/common.mk
+++ b/mk/common.mk
@@ -1,5 +1,5 @@
#
-# Copyright 2014-2020 the Pacemaker project contributors
+# Copyright 2014-2021 the Pacemaker project contributors
#
# The version control history for this file may have further details.
#
@@ -68,11 +68,11 @@ HELP2MAN_ARGS = -N --section 8 --name "Part of the Pacemaker cluster resource ma
# and all wrappers to C code.
%.8: % $(MAN8DEPS)
$(AM_V_at)chmod a+x $(abs_builddir)/$<
- $(AM_V_MAN)if [ -f $(top_srcdir)/tools/$@.inc ]; then \
+ $(AM_V_MAN)if [ -f $(abs_srcdir)/$@.inc ]; then \
PATH=$(abs_builddir):$$PATH $(HELP2MAN) $(HELP2MAN_ARGS) \
-h --help-all \
--no-discard-stderr \
- -i $(top_srcdir)/tools/$@.inc $(abs_builddir)/$< \
+ -i $(abs_srcdir)/$@.inc $(abs_builddir)/$< \
| sed -f $(top_srcdir)/tools/fix-manpages > $@ ; \
else \
PATH=$(abs_builddir):$$PATH $(HELP2MAN) $(HELP2MAN_ARGS) \
--
1.8.3.1
From c7ab1d901bcbbf0137277e783e072777ca2f82d9 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 13 May 2021 11:44:16 -0400
Subject: [PATCH 2/4] Refactor: daemons: Remove the pid_file variable from
pacemakerd.
It's never used anywhere.
---
daemons/pacemakerd/pacemakerd.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c
index 8ec9708..03d688e 100644
--- a/daemons/pacemakerd/pacemakerd.c
+++ b/daemons/pacemakerd/pacemakerd.c
@@ -27,8 +27,7 @@
static crm_trigger_t *shutdown_trigger = NULL;
static crm_trigger_t *startup_trigger = NULL;
-static const char *pid_file = PCMK_RUN_DIR "/pacemaker.pid";
/* state we report when asked via pacemakerd-api status-ping */
static const char *pacemakerd_state = XML_PING_ATTR_PACEMAKERDSTATE_INIT;
static gboolean running_with_sbd = FALSE; /* local copy */
@@ -224,7 +222,6 @@ main(int argc, char **argv)
/* Legacy */
break;
case 'p':
- pid_file = optarg;
break;
case 's':
pcmk__set_env_option("node_start_state", "standby");
--
1.8.3.1
From 98990eed9f6a5dbde7c8a5aa0783e93d5479295b Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 13 May 2021 13:14:38 -0400
Subject: [PATCH 3/4] Refactor: daemons: Use glib for command line handling in
pacemakerd.
---
daemons/pacemakerd/Makefile.am | 2 +
daemons/pacemakerd/pacemakerd.8.inc | 5 +
daemons/pacemakerd/pacemakerd.c | 195 ++++++++++++++++++------------------
3 files changed, 102 insertions(+), 100 deletions(-)
create mode 100644 daemons/pacemakerd/pacemakerd.8.inc
diff --git a/daemons/pacemakerd/Makefile.am b/daemons/pacemakerd/Makefile.am
index cc657f5..84517a3 100644
--- a/daemons/pacemakerd/Makefile.am
+++ b/daemons/pacemakerd/Makefile.am
@@ -15,6 +15,8 @@ if BUILD_SYSTEMD
systemdsystemunit_DATA = pacemaker.service
endif
+EXTRA_DIST = pacemakerd.8.inc
+
## SOURCES
noinst_HEADERS = pacemakerd.h
diff --git a/daemons/pacemakerd/pacemakerd.8.inc b/daemons/pacemakerd/pacemakerd.8.inc
new file mode 100644
index 0000000..902af4e
--- /dev/null
+++ b/daemons/pacemakerd/pacemakerd.8.inc
@@ -0,0 +1,5 @@
+[synopsis]
+pacemakerd [options]
+
+/subsidiary Pacemaker daemons/
+.SH OPTIONS
diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c
index 03d688e..ce194bf 100644
--- a/daemons/pacemakerd/pacemakerd.c
+++ b/daemons/pacemakerd/pacemakerd.c
@@ -23,12 +23,54 @@
#include <crm/msg_xml.h>
#include <crm/common/ipc_internal.h>
#include <crm/common/mainloop.h>
+#include <crm/common/cmdline_internal.h>
#include <crm/cluster/internal.h>
#include <crm/cluster.h>
#include <dirent.h>
#include <ctype.h>
+#define SUMMARY "pacemakerd - primary Pacemaker daemon that launches and monitors all subsidiary Pacemaker daemons"
+
+struct {
+ gboolean features;
+ gboolean foreground;
+ gboolean shutdown;
+ gboolean standby;
+} options;
+
+static gboolean
+pid_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **err) {
+ return TRUE;
+}
+
+static gboolean
+standby_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **err) {
+ options.standby = TRUE;
+ pcmk__set_env_option("node_start_state", "standby");
+ return TRUE;
+}
+
+static GOptionEntry entries[] = {
+ { "features", 'F', 0, G_OPTION_ARG_NONE, &options.features,
+ "Display full version and list of features Pacemaker was built with",
+ NULL },
+ { "foreground", 'f', 0, G_OPTION_ARG_NONE, &options.foreground,
+ "(Ignored) Pacemaker always runs in the foreground",
+ NULL },
+ { "pid-file", 'p', 0, G_OPTION_ARG_CALLBACK, pid_cb,
+ "(Ignored) Daemon pid file location",
+ "FILE" },
+ { "shutdown", 'S', 0, G_OPTION_ARG_NONE, &options.shutdown,
+ "Instruct Pacemaker to shutdown on this machine",
+ NULL },
+ { "standby", 's', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, standby_cb,
+ "Start node in standby state",
+ NULL },
+
+ { NULL }
+};
+
static gboolean fatal_error = FALSE;
static GMainLoop *mainloop = NULL;
static bool global_keep_tracking = false;
@@ -642,49 +685,6 @@ pcmk_sigquit(int nsig)
.connection_destroyed = pcmk_ipc_destroy
};
-static pcmk__cli_option_t long_options[] = {
- // long option, argument type, storage, short option, description, flags
- {
- "help", no_argument, NULL, '?',
- "\tThis text", pcmk__option_default
- },
- {
- "version", no_argument, NULL, '$',
- "\tVersion information", pcmk__option_default
- },
- {
- "verbose", no_argument, NULL, 'V',
- "\tIncrease debug output", pcmk__option_default
- },
- {
- "shutdown", no_argument, NULL, 'S',
- "\tInstruct Pacemaker to shutdown on this machine", pcmk__option_default
- },
- {
- "features", no_argument, NULL, 'F',
- "\tDisplay full version and list of features Pacemaker was built with",
- pcmk__option_default
- },
- {
- "-spacer-", no_argument, NULL, '-',
- "\nAdditional Options:", pcmk__option_default
- },
- {
- "foreground", no_argument, NULL, 'f',
- "\t(Ignored) Pacemaker always runs in the foreground",
- pcmk__option_default
- },
- {
- "pid-file", required_argument, NULL, 'p',
- "\t(Ignored) Daemon pid file location", pcmk__option_default
- },
- {
- "standby", no_argument, NULL, 's',
- "\tStart node in standby state", pcmk__option_default
- },
- { 0, 0, 0, 0 }
-};
-
static void
mcp_chown(const char *path, uid_t uid, gid_t gid)
{
@@ -1168,83 +1211,66 @@ request_shutdown(crm_ipc_t *ipc)
return status;
}
+static GOptionContext *
+build_arg_context(pcmk__common_args_t *args) {
+ GOptionContext *context = NULL;
+
+ context = pcmk__build_arg_context(args, NULL, NULL, NULL);
+ pcmk__add_main_args(context, entries);
+ return context;
+}
+
int
main(int argc, char **argv)
{
- int flag;
- int argerr = 0;
+ crm_exit_t exit_code = CRM_EX_OK;
+
+ GError *error = NULL;
+
+ pcmk__common_args_t *args = pcmk__new_common_args(SUMMARY);
+ gchar **processed_args = pcmk__cmdline_preproc(argv, "p");
+ GOptionContext *context = build_arg_context(args);
- int option_index = 0;
bool old_instance_connected = false;
- gboolean shutdown = FALSE;
crm_ipc_t *old_instance = NULL;
qb_ipcs_service_t *ipcs = NULL;
crm_log_preinit(NULL, argc, argv);
- pcmk__set_cli_options(NULL, "[options]", long_options,
- "primary Pacemaker daemon that launches and "
- "monitors all subsidiary Pacemaker daemons");
mainloop_add_signal(SIGHUP, pcmk_ignore);
mainloop_add_signal(SIGQUIT, pcmk_sigquit);
- while (1) {
- flag = pcmk__next_cli_option(argc, argv, &option_index, NULL);
- if (flag == -1)
- break;
-
- switch (flag) {
- case 'V':
- crm_bump_log_level(argc, argv);
- break;
- case 'f':
- /* Legacy */
- break;
- case 'p':
- break;
- case 's':
- pcmk__set_env_option("node_start_state", "standby");
- break;
- case '$':
- case '?':
- pcmk__cli_help(flag, CRM_EX_OK);
- break;
- case 'S':
- shutdown = TRUE;
- break;
- case 'F':
- printf("Pacemaker %s (Build: %s)\n Supporting v%s: %s\n", PACEMAKER_VERSION, BUILD_VERSION,
- CRM_FEATURE_SET, CRM_FEATURES);
- crm_exit(CRM_EX_OK);
- default:
- printf("Argument code 0%o (%c) is not (?yet?) supported\n", flag, flag);
- ++argerr;
- break;
- }
+ if (!g_option_context_parse_strv(context, &processed_args, &error)) {
+ exit_code = CRM_EX_USAGE;
+ goto done;
}
- if (optind < argc) {
- printf("non-option ARGV-elements: ");
- while (optind < argc)
- printf("%s ", argv[optind++]);
- printf("\n");
- }
- if (argerr) {
- pcmk__cli_help('?', CRM_EX_USAGE);
+ if (options.features) {
+ printf("Pacemaker %s (Build: %s)\n Supporting v%s: %s\n", PACEMAKER_VERSION, BUILD_VERSION,
+ CRM_FEATURE_SET, CRM_FEATURES);
+ exit_code = CRM_EX_OK;
+ goto done;
}
+ if (args->version) {
+ g_strfreev(processed_args);
+ pcmk__free_arg_context(context);
+ /* FIXME: When pacemakerd is converted to use formatted output, this can go. */
+ pcmk__cli_help('v', CRM_EX_USAGE);
+ }
setenv("LC_ALL", "C", 1);
pcmk__set_env_option("mcp", "true");
+ pcmk__cli_init_logging("pacemakerd", args->verbosity);
crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
crm_debug("Checking for existing Pacemaker instance");
old_instance = crm_ipc_new(CRM_SYSTEM_MCP, 0);
old_instance_connected = crm_ipc_connect(old_instance);
- if (shutdown) {
+ if (options.shutdown) {
if (old_instance_connected) {
crm_exit(request_shutdown(old_instance));
} else {
@@ -1253,22 +1279,25 @@ main(int argc, char **argv)
"Pacemaker instance: %s", strerror(errno));
crm_ipc_close(old_instance);
crm_ipc_destroy(old_instance);
- crm_exit(CRM_EX_DISCONNECT);
+ exit_code = CRM_EX_DISCONNECT;
+ goto done;
}
} else if (old_instance_connected) {
crm_ipc_close(old_instance);
crm_ipc_destroy(old_instance);
crm_err("Aborting start-up because active Pacemaker instance found");
- crm_exit(CRM_EX_FATAL);
+ exit_code = CRM_EX_FATAL;
+ goto done;
}
crm_ipc_close(old_instance);
crm_ipc_destroy(old_instance);
#ifdef SUPPORT_COROSYNC
if (mcp_read_config() == FALSE) {
- crm_exit(CRM_EX_UNAVAILABLE);
+ exit_code = CRM_EX_UNAVAILABLE;
+ goto done;
}
#endif
@@ -1292,7 +1321,8 @@ main(int argc, char **argv)
#ifdef SUPPORT_COROSYNC
/* Allows us to block shutdown */
if (!cluster_connect_cfg()) {
- crm_exit(CRM_EX_PROTOCOL);
+ exit_code = CRM_EX_PROTOCOL;
+ goto done;
}
#endif
@@ -1307,9 +1337,11 @@ main(int argc, char **argv)
case pcmk_rc_ok:
break;
case pcmk_rc_ipc_unauthorized:
- crm_exit(CRM_EX_CANTCREAT);
+ exit_code = CRM_EX_CANTCREAT;
+ goto done;
default:
- crm_exit(CRM_EX_FATAL);
+ exit_code = CRM_EX_FATAL;
+ goto done;
};
mainloop_add_signal(SIGTERM, pcmk_shutdown);
@@ -1342,5 +1374,11 @@ main(int argc, char **argv)
#ifdef SUPPORT_COROSYNC
cluster_disconnect_cfg();
#endif
- crm_exit(CRM_EX_OK);
+
+done:
+ g_strfreev(processed_args);
+ pcmk__free_arg_context(context);
+
+ pcmk__output_and_clear_error(error, NULL);
+ crm_exit(exit_code);
}
--
1.8.3.1
From 8f7924fbb2a012bedcad59335b7bebc5020b26e3 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 13 May 2021 13:27:13 -0400
Subject: [PATCH 4/4] Low: pacemaker.service: Don't start pacemakerd with -f.
This option is completely ignored by pacemakerd.
---
daemons/pacemakerd/pacemaker.service.in | 2 +-
doc/sphinx/Clusters_from_Scratch/verification.rst | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/daemons/pacemakerd/pacemaker.service.in b/daemons/pacemakerd/pacemaker.service.in
index b128ddc..0363a22 100644
--- a/daemons/pacemakerd/pacemaker.service.in
+++ b/daemons/pacemakerd/pacemaker.service.in
@@ -44,7 +44,7 @@ EnvironmentFile=-@CONFIGDIR@/pacemaker
EnvironmentFile=-@CONFIGDIR@/sbd
SuccessExitStatus=100
-ExecStart=@sbindir@/pacemakerd -f
+ExecStart=@sbindir@/pacemakerd
# Systemd v227 and above can limit the number of processes spawned by a
# service. That is a bad idea for an HA cluster resource manager, so disable it
diff --git a/doc/sphinx/Clusters_from_Scratch/verification.rst b/doc/sphinx/Clusters_from_Scratch/verification.rst
index 9d647f8..b7fa20e 100644
--- a/doc/sphinx/Clusters_from_Scratch/verification.rst
+++ b/doc/sphinx/Clusters_from_Scratch/verification.rst
@@ -103,7 +103,7 @@ the necessary processes are running:
2 ? S 0:00 [kthreadd]
...lots of processes...
17121 ? SLsl 0:01 /usr/sbin/corosync -f
- 17133 ? Ss 0:00 /usr/sbin/pacemakerd -f
+ 17133 ? Ss 0:00 /usr/sbin/pacemakerd
17134 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-based
17135 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-fenced
17136 ? Ss 0:00 \_ /usr/libexec/pacemaker/pacemaker-execd
--
1.8.3.1

282
003-pacemakerd-output.patch Normal file
View File

@ -0,0 +1,282 @@
From 7c35387a9896cb968cf4087b5cbed94af44e1ea5 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Fri, 14 May 2021 12:03:46 -0400
Subject: [PATCH 1/4] Feature: daemons: Convert pacemakerd to formatted output.
The main purpose of this is to finish getting pacemakerd moved off the
existing command line handling code (pcmk__cli_help in particular) so
that code can eventually be deprecated or removed. pacemakerd itself
does fairly little printing.
---
daemons/pacemakerd/pacemakerd.c | 58 ++++++++++++++++++++++++++++++-----------
1 file changed, 43 insertions(+), 15 deletions(-)
diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c
index ce194bf..bd59729 100644
--- a/daemons/pacemakerd/pacemakerd.c
+++ b/daemons/pacemakerd/pacemakerd.c
@@ -25,6 +25,7 @@
#include <crm/common/ipc_internal.h>
#include <crm/common/mainloop.h>
#include <crm/common/cmdline_internal.h>
+#include <crm/common/output_internal.h>
#include <crm/cluster/internal.h>
#include <crm/cluster.h>
@@ -37,6 +38,14 @@ struct {
gboolean standby;
} options;
+static pcmk__output_t *out = NULL;
+
+static pcmk__supported_format_t formats[] = {
+ PCMK__SUPPORTED_FORMAT_NONE,
+ PCMK__SUPPORTED_FORMAT_TEXT,
+ { NULL, NULL, NULL }
+};
+
static gboolean
pid_cb(const gchar *option_name, const gchar *optarg, gpointer data, GError **err) {
return TRUE;
@@ -1167,10 +1176,10 @@ pacemakerd_event_cb(pcmk_ipc_api_t *pacemakerd_api,
}
static GOptionContext *
-build_arg_context(pcmk__common_args_t *args) {
+build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) {
GOptionContext *context = NULL;
- context = pcmk__build_arg_context(args, NULL, NULL, NULL);
+ context = pcmk__build_arg_context(args, "text", group, NULL);
pcmk__add_main_args(context, entries);
return context;
}
@@ -1182,9 +1191,11 @@ main(int argc, char **argv)
GError *error = NULL;
+ int rc = pcmk_rc_ok;
+ GOptionGroup *output_group = NULL;
pcmk__common_args_t *args = pcmk__new_common_args(SUMMARY);
gchar **processed_args = pcmk__cmdline_preproc(argv, "p");
- GOptionContext *context = build_arg_context(args);
+ GOptionContext *context = build_arg_context(args, &output_group);
bool old_instance_connected = false;
@@ -1195,23 +1205,30 @@ main(int argc, char **argv)
mainloop_add_signal(SIGHUP, pcmk_ignore);
mainloop_add_signal(SIGQUIT, pcmk_sigquit);
+ pcmk__register_formats(output_group, formats);
if (!g_option_context_parse_strv(context, &processed_args, &error)) {
exit_code = CRM_EX_USAGE;
goto done;
}
+ rc = pcmk__output_new(&out, args->output_ty, args->output_dest, argv);
+ if (rc != pcmk_rc_ok) {
+ exit_code = CRM_EX_ERROR;
+ g_set_error(&error, PCMK__EXITC_ERROR, exit_code, "Error creating output format %s: %s",
+ args->output_ty, pcmk_rc_str(rc));
+ goto done;
+ }
+
if (options.features) {
- printf("Pacemaker %s (Build: %s)\n Supporting v%s: %s\n", PACEMAKER_VERSION, BUILD_VERSION,
- CRM_FEATURE_SET, CRM_FEATURES);
+ out->info(out, "Pacemaker %s (Build: %s)\n Supporting v%s: %s", PACEMAKER_VERSION,
+ BUILD_VERSION, CRM_FEATURE_SET, CRM_FEATURES);
exit_code = CRM_EX_OK;
goto done;
}
if (args->version) {
- g_strfreev(processed_args);
- pcmk__free_arg_context(context);
- /* FIXME: When pacemakerd is converted to use formatted output, this can go. */
- pcmk__cli_help('v', CRM_EX_USAGE);
+ out->version(out, false);
+ goto done;
}
setenv("LC_ALL", "C", 1);
@@ -1248,6 +1265,13 @@ main(int argc, char **argv)
crm_ipc_close(old_instance);
crm_ipc_destroy(old_instance);
+ /* Don't allow any accidental output after this point. */
+ if (out != NULL) {
+ out->finish(out, exit_code, true, NULL);
+ pcmk__output_free(out);
+ out = NULL;
+ }
+
#ifdef SUPPORT_COROSYNC
if (mcp_read_config() == FALSE) {
exit_code = CRM_EX_UNAVAILABLE;
@@ -1333,6 +1357,11 @@ done:
g_strfreev(processed_args);
pcmk__free_arg_context(context);
- pcmk__output_and_clear_error(error, NULL);
+ pcmk__output_and_clear_error(error, out);
+
+ if (out != NULL) {
+ out->finish(out, exit_code, true, NULL);
+ pcmk__output_free(out);
+ }
crm_exit(exit_code);
}
--
1.8.3.1
From 35e6da64381fcb092d81ce16835cc28670b077cb Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 17 May 2021 10:04:04 -0400
Subject: [PATCH 2/4] Features: daemons: Output the pacemakerd feature list in
XML.
---
daemons/pacemakerd/pacemakerd.c | 45 ++++++++++++++++++++++++++++++++++++++---
1 file changed, 42 insertions(+), 3 deletions(-)
diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c
index bd59729..93cf743 100644
--- a/daemons/pacemakerd/pacemakerd.c
+++ b/daemons/pacemakerd/pacemakerd.c
@@ -43,6 +43,42 @@ static pcmk__output_t *out = NULL;
static pcmk__supported_format_t formats[] = {
PCMK__SUPPORTED_FORMAT_NONE,
PCMK__SUPPORTED_FORMAT_TEXT,
+ PCMK__SUPPORTED_FORMAT_XML,
+ { NULL, NULL, NULL }
+};
+
+static int
+pacemakerd_features(pcmk__output_t *out, va_list args) {
+ out->info(out, "Pacemaker %s (Build: %s)\n Supporting v%s: %s", PACEMAKER_VERSION,
+ BUILD_VERSION, CRM_FEATURE_SET, CRM_FEATURES);
+ return pcmk_rc_ok;
+}
+
+static int
+pacemakerd_features_xml(pcmk__output_t *out, va_list args) {
+ gchar **feature_list = g_strsplit(CRM_FEATURES, " ", 0);
+
+ pcmk__output_xml_create_parent(out, "pacemakerd",
+ "version", PACEMAKER_VERSION,
+ "build", BUILD_VERSION,
+ "feature_set", CRM_FEATURE_SET,
+ NULL);
+ out->begin_list(out, NULL, NULL, "features");
+
+ for (char **s = feature_list; *s != NULL; s++) {
+ pcmk__output_create_xml_text_node(out, "feature", *s);
+ }
+
+ out->end_list(out);
+
+ g_strfreev(feature_list);
+ return pcmk_rc_ok;
+}
+
+static pcmk__message_entry_t fmt_functions[] = {
+ { "features", "default", pacemakerd_features },
+ { "features", "xml", pacemakerd_features_xml },
+
{ NULL, NULL, NULL }
};
@@ -200,7 +236,7 @@ static GOptionContext *
build_arg_context(pcmk__common_args_t *args, GOptionGroup **group) {
GOptionContext *context = NULL;
- context = pcmk__build_arg_context(args, "text", group, NULL);
+ context = pcmk__build_arg_context(args, "text (default), xml", group, NULL);
pcmk__add_main_args(context, entries);
return context;
}
@@ -241,9 +277,12 @@ main(int argc, char **argv)
goto done;
}
+ pcmk__force_args(context, &error, "%s --xml-simple-list", g_get_prgname());
+
+ pcmk__register_messages(out, fmt_functions);
+
if (options.features) {
- out->info(out, "Pacemaker %s (Build: %s)\n Supporting v%s: %s", PACEMAKER_VERSION,
- BUILD_VERSION, CRM_FEATURE_SET, CRM_FEATURES);
+ out->message(out, "features");
exit_code = CRM_EX_OK;
goto done;
}
--
1.8.3.1
From 5b7f5eb35b025b59805cf3c7c3dcb6a3cf4b71b3 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 17 May 2021 11:09:53 -0400
Subject: [PATCH 3/4] Low: daemons: Conditionally enable logging in pacemakerd.
If we're doing an interactive command-line call, use
pcmk__cli_init_logging. At the moment, all command line calls except
for --shutdown do their work before logging would even come up, so we
really only need to do this for --shutdown.
If we're doing a daemon call, use crm_log_init.
---
daemons/pacemakerd/pacemakerd.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/daemons/pacemakerd/pacemakerd.c b/daemons/pacemakerd/pacemakerd.c
index 93cf743..c20bde7 100644
--- a/daemons/pacemakerd/pacemakerd.c
+++ b/daemons/pacemakerd/pacemakerd.c
@@ -296,8 +296,11 @@ main(int argc, char **argv)
pcmk__set_env_option("mcp", "true");
- pcmk__cli_init_logging("pacemakerd", args->verbosity);
- crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
+ if (options.shutdown) {
+ pcmk__cli_init_logging("pacemakerd", args->verbosity);
+ } else {
+ crm_log_init(NULL, LOG_INFO, TRUE, FALSE, argc, argv, FALSE);
+ }
crm_debug("Checking for existing Pacemaker instance");
old_instance = crm_ipc_new(CRM_SYSTEM_MCP, 0);
--
1.8.3.1
From 2393362bb7489e86d937ed46a1c5cfb93d9bf3ab Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 17 May 2021 11:58:06 -0400
Subject: [PATCH 4/4] Fix: include: Bump CRM_FEATURE_SET for new pacemakerd
args.
---
include/crm/crm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/crm/crm.h b/include/crm/crm.h
index fdfc825..92a98fa 100644
--- a/include/crm/crm.h
+++ b/include/crm/crm.h
@@ -66,7 +66,7 @@ extern "C" {
* >=3.0.13: Fail counts include operation name and interval
* >=3.2.0: DC supports PCMK_LRM_OP_INVALID and PCMK_LRM_OP_NOT_CONNECTED
*/
-# define CRM_FEATURE_SET "3.10.0"
+# define CRM_FEATURE_SET "3.10.1"
/* Pacemaker's CPG protocols use fixed-width binary fields for the sender and
* recipient of a CPG message. This imposes an arbitrary limit on cluster node
--
1.8.3.1

199
004-check-level.patch Normal file
View File

@ -0,0 +1,199 @@
From 3905e7eac11298fc20efd567a773666f948edf61 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Mon, 3 May 2021 11:19:04 -0400
Subject: [PATCH 1/2] Feature: tools: Add OCF_CHECK_LEVEL to crm_resource
environment.
If --validate= or --force-check= are given with a level, pass that along
as OCF_CHECK_LEVEL. This argument is optional, and if no value is given
then the environment variable will not be set and whatever's the default
on the resource agent will be used.
See: rhbz#1955792.
---
tools/crm_resource.c | 29 +++++++++++++++++++++--------
tools/crm_resource.h | 4 ++--
tools/crm_resource_runtime.c | 13 ++++++++++---
3 files changed, 33 insertions(+), 13 deletions(-)
diff --git a/tools/crm_resource.c b/tools/crm_resource.c
index 45db2b2..6ca96f8 100644
--- a/tools/crm_resource.c
+++ b/tools/crm_resource.c
@@ -100,6 +100,7 @@ struct {
int timeout_ms; // Parsed from --timeout value
char *agent_spec; // Standard and/or provider and/or agent
gchar *xml_file; // Value of (deprecated) --xml-file
+ int check_level; // Optional value of --validate or --force-check
// Resource configuration specified via command-line arguments
gboolean cmdline_config; // Resource configuration was via arguments
@@ -113,6 +114,7 @@ struct {
GHashTable *override_params; // Resource parameter values that override config
} options = {
.attr_set_type = XML_TAG_ATTR_SETS,
+ .check_level = -1,
.cib_options = cib_sync_call,
.require_cib = TRUE,
.require_dataset = TRUE,
@@ -402,14 +404,15 @@ static GOptionEntry query_entries[] = {
};
static GOptionEntry command_entries[] = {
- { "validate", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+ { "validate", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
validate_or_force_cb,
"Validate resource configuration by calling agent's validate-all\n"
INDENT "action. The configuration may be specified either by giving an\n"
INDENT "existing resource name with -r, or by specifying --class,\n"
INDENT "--agent, and --provider arguments, along with any number of\n"
- INDENT "--option arguments.",
- NULL },
+ INDENT "--option arguments. An optional LEVEL argument can be given\n"
+ INDENT "to control the level of checking performed.",
+ "LEVEL" },
{ "cleanup", 'C', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, cleanup_refresh_cb,
"If resource has any past failures, clear its history and fail\n"
INDENT "count. Optionally filtered by --resource, --node, --operation\n"
@@ -546,11 +549,12 @@ static GOptionEntry advanced_entries[] = {
INDENT "the cluster believes the resource is a clone instance already\n"
INDENT "running on the local node.",
NULL },
- { "force-check", 0, G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK,
+ { "force-check", 0, G_OPTION_FLAG_OPTIONAL_ARG, G_OPTION_ARG_CALLBACK,
validate_or_force_cb,
"(Advanced) Bypass the cluster and check the state of a resource on\n"
- INDENT "the local node",
- NULL },
+ INDENT "the local node. An optional LEVEL argument can be given\n"
+ INDENT "to control the level of checking performed.",
+ "LEVEL" },
{ NULL }
};
@@ -910,6 +914,15 @@ validate_or_force_cb(const gchar *option_name, const gchar *optarg,
if (options.override_params == NULL) {
options.override_params = pcmk__strkey_table(free, free);
}
+
+ if (optarg != NULL) {
+ if (pcmk__scan_min_int(optarg, &options.check_level, 0) != pcmk_rc_ok) {
+ g_set_error(error, G_OPTION_ERROR, CRM_EX_INVALID_PARAM,
+ "Invalid check level setting: %s", optarg);
+ return FALSE;
+ }
+ }
+
return TRUE;
}
@@ -1826,12 +1839,12 @@ main(int argc, char **argv)
options.v_class, options.v_provider, options.v_agent,
"validate-all", options.cmdline_params,
options.override_params, options.timeout_ms,
- args->verbosity, options.force);
+ args->verbosity, options.force, options.check_level);
} else {
exit_code = cli_resource_execute(rsc, options.rsc_id,
options.operation, options.override_params,
options.timeout_ms, cib_conn, data_set,
- args->verbosity, options.force);
+ args->verbosity, options.force, options.check_level);
}
break;
diff --git a/tools/crm_resource.h b/tools/crm_resource.h
index 3560377..5ab10d6 100644
--- a/tools/crm_resource.h
+++ b/tools/crm_resource.h
@@ -88,11 +88,11 @@ crm_exit_t cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc
const char *rsc_type, const char *rsc_action,
GHashTable *params, GHashTable *override_hash,
int timeout_ms, int resource_verbose,
- gboolean force);
+ gboolean force, int check_level);
crm_exit_t cli_resource_execute(pe_resource_t *rsc, const char *requested_name,
const char *rsc_action, GHashTable *override_hash,
int timeout_ms, cib_t *cib, pe_working_set_t *data_set,
- int resource_verbose, gboolean force);
+ int resource_verbose, gboolean force, int check_level);
int cli_resource_update_attribute(pe_resource_t *rsc, const char *requested_name,
const char *attr_set, const char *attr_set_type,
diff --git a/tools/crm_resource_runtime.c b/tools/crm_resource_runtime.c
index fe0ec98..bde83b6 100644
--- a/tools/crm_resource_runtime.c
+++ b/tools/crm_resource_runtime.c
@@ -1679,7 +1679,8 @@ cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name,
const char *rsc_class, const char *rsc_prov,
const char *rsc_type, const char *action,
GHashTable *params, GHashTable *override_hash,
- int timeout_ms, int resource_verbose, gboolean force)
+ int timeout_ms, int resource_verbose, gboolean force,
+ int check_level)
{
GHashTable *params_copy = NULL;
crm_exit_t exit_code = CRM_EX_OK;
@@ -1703,6 +1704,12 @@ cli_resource_execute_from_params(pcmk__output_t *out, const char *rsc_name,
/* add crm_feature_set env needed by some resource agents */
g_hash_table_insert(params, strdup(XML_ATTR_CRM_VERSION), strdup(CRM_FEATURE_SET));
+ if (check_level >= 0) {
+ char *level = crm_strdup_printf("%d", check_level);
+ setenv("OCF_CHECK_LEVEL", level, 1);
+ free(level);
+ }
+
/* resources_action_create frees the params hash table it's passed, but we
* may need to reuse it in a second call to resources_action_create. Thus
* we'll make a copy here so that gets freed and the original remains for
@@ -1790,7 +1797,7 @@ crm_exit_t
cli_resource_execute(pe_resource_t *rsc, const char *requested_name,
const char *rsc_action, GHashTable *override_hash,
int timeout_ms, cib_t * cib, pe_working_set_t *data_set,
- int resource_verbose, gboolean force)
+ int resource_verbose, gboolean force, int check_level)
{
pcmk__output_t *out = data_set->priv;
crm_exit_t exit_code = CRM_EX_OK;
@@ -1856,7 +1863,7 @@ cli_resource_execute(pe_resource_t *rsc, const char *requested_name,
exit_code = cli_resource_execute_from_params(out, rid, rclass, rprov, rtype, action,
params, override_hash, timeout_ms,
- resource_verbose, force);
+ resource_verbose, force, check_level);
return exit_code;
}
--
1.8.3.1
From d13ba4bd6defe0dd81fdf8ab39ae5b889513c0c0 Mon Sep 17 00:00:00 2001
From: Chris Lumens <clumens@redhat.com>
Date: Thu, 20 May 2021 10:59:23 -0400
Subject: [PATCH 2/2] Fix: include: Bump feature set to 3.10.2.
This is for the OCF_CHECK_LEVEL environment variable.
See: rhbz#1955792.
---
include/crm/crm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/crm/crm.h b/include/crm/crm.h
index 92a98fa..ee52c36 100644
--- a/include/crm/crm.h
+++ b/include/crm/crm.h
@@ -66,7 +66,7 @@ extern "C" {
* >=3.0.13: Fail counts include operation name and interval
* >=3.2.0: DC supports PCMK_LRM_OP_INVALID and PCMK_LRM_OP_NOT_CONNECTED
*/
-# define CRM_FEATURE_SET "3.10.1"
+# define CRM_FEATURE_SET "3.10.2"
/* Pacemaker's CPG protocols use fixed-width binary fields for the sender and
* recipient of a CPG message. This imposes an arbitrary limit on cluster node
--
1.8.3.1

View File

@ -5,6 +5,7 @@ decision_context: bodhi_update_push_testing
subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
--- !Policy
product_versions:
- fedora-*
@ -13,3 +14,9 @@ subject_type: koji_build
rules:
- !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional}
-- !Policy
product_versions:
- rhel-*
decision_context: osci_compose_gate
rules:
- !PassingTestCaseRule {test_case_name: osci.brew-build.tier0.functional}

View File

@ -1,12 +1,12 @@
# Globals and defines to control package behavior (configure these as desired)
# User-configurable globals and defines to control package behavior
# (these should not test {with X} values, which are declared later)
## User and group to use for nonprivileged services
%global uname hacluster
%global gname haclient
%global hacluster_id 189
## Where to install Pacemaker documentation
%if 0%{?rhel}
%if 0%{?rhel} > 7
%global pcmk_docdir %{_docdir}/%{name}-doc
%else
%global pcmk_docdir %{_docdir}/%{name}
@ -15,26 +15,42 @@
## GitHub entity that distributes source (for ease of using a fork)
%global github_owner ClusterLabs
## Where bug reports should be submitted
## Leave bug_url undefined to use ClusterLabs default, others define it here
%if 0%{?rhel}
%global bug_url https://bugzilla.redhat.com/
%else
%if 0%{?fedora}
%global bug_url https://bugz.fedoraproject.org/%{name}
%endif
%endif
## Upstream pacemaker version, and its package version (specversion
## can be incremented to build packages reliably considered "newer"
## than previously built packages with the same pcmkversion)
%global pcmkversion 2.0.5
%global specversion 10
%global pcmkversion 2.1.0
%global specversion 1
## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build
%global commit 4edf50cc97b29f0bb6a62bd449027327fbe9c882
## Upstream commit (or git tag, such as "Pacemaker-" plus the
## {pcmkversion} macro for an official release) to use for this package
%global commit Pacemaker-2.0.5
## Since git v2.11, the extent of abbreviation is autoscaled by default
## (used to be constant of 7), so we need to convey it for non-tags, too.
%global commit_abbrev 9
# Define conditionals so that "rpmbuild --with <feature>" and
# "rpmbuild --without <feature>" can enable and disable specific features
## NOTE: skip --with stonithd
## Add option to enable support for stonith/external fencing agents
%bcond_with stonithd
## Add option to enable support for storing sensitive information outside CIB
## Add option for whether to support storing sensitive information outside CIB
%if (0%{?fedora} && 0%{?fedora} <= 33) || (0%{?rhel} && 0%{?rhel} <= 8)
%bcond_with cibsecrets
%else
%bcond_without cibsecrets
%endif
## Add option to create binaries suitable for use with profiling tools
%bcond_with profiling
@ -42,12 +58,25 @@
## Add option to create binaries with coverage analysis
%bcond_with coverage
## Add option to skip/enable generating documentation
## Add option to skip (or enable, on RHEL) generating documentation
## (the build tools aren't available everywhere)
%if 0%{?rhel}
%bcond_with doc
%bcond_with doc
%else
%bcond_without doc
%bcond_without doc
%endif
## Add option to default to start-up synchronization with SBD.
##
## If enabled, SBD *MUST* be built to default similarly, otherwise data
## corruption could occur. Building both Pacemaker and SBD to default
## to synchronization improves safety, without requiring higher-level tools
## to be aware of the setting or requiring users to modify configurations
## after upgrading to versions that support synchronization.
%if 0%{?rhel}
%bcond_without sbd_sync
%else
%bcond_with sbd_sync
%endif
## Add option to prefix package version with "0."
@ -59,9 +88,12 @@
## Add option to turn off hardening of libraries and daemon executables
%bcond_without hardening
## Add option to disable links for legacy daemon names
## Add option to enable (or disable, on RHEL 8) links for legacy daemon names
%if 0%{?rhel} && 0%{?rhel} <= 8
%bcond_without legacy_links
%else
%bcond_with legacy_links
%endif
## Nagios source control identifiers
%global nagios_name nagios-agents-metadata
@ -80,28 +112,63 @@
## Portion of export/dist tarball name after "pacemaker-", and release version
%if 0%{tag_release}
%define archive_version %{commit}
%define archive_version %(c=%{commit}; echo ${c:10})
%define archive_github_url %{commit}#/%{name}-%{archive_version}.tar.gz
%define pcmk_release %(c=%{commit}; case $c in *-rc[[:digit:]]*%{rparen}
echo 0.%{specversion}.${c: -3} ;;
*%{rparen} echo %{specversion} ;; esac)
%else
%define archive_version %(c=%{commit}; echo ${c:0:%{commit_abbrev}})
%define archive_github_url %{archive_version}#/%{name}-%{archive_version}.tar.gz
%if %{with pre_release}
%define pcmk_release 0.%{specversion}.%{archive_version}.git
%else
%define pcmk_release %{specversion}.%{archive_version}.git
%endif
%endif
### Always use a simple release number
%define pcmk_release %{specversion}
## Heuristic used to infer bleeding-edge deployments that are
## less likely to have working versions of the documentation tools
%define bleeding %(test ! -e /etc/yum.repos.d/fedora-rawhide.repo; echo $?)
%if 0%{?fedora} > 20 || 0%{?rhel} > 7
## Base GnuTLS cipher priorities (presumably only the initial, required keyword)
## overridable with "rpmbuild --define 'pcmk_gnutls_priorities PRIORITY-SPEC'"
%define gnutls_priorities %{?pcmk_gnutls_priorities}%{!?pcmk_gnutls_priorities:@SYSTEM}
%endif
%if !%{defined _rundir}
%if 0%{?fedora} >= 15 || 0%{?rhel} >= 7 || 0%{?suse_version} >= 1200
%define _rundir /run
%else
%define _rundir /var/run
%endif
%endif
%if 0%{?fedora} > 22 || 0%{?rhel} > 7
%global supports_recommends 1
%endif
## Different distros name certain packages differently
## (note: corosync libraries also differ, but all provide corosync-devel)
%global pkgname_libtool_devel libtool-ltdl-devel
%global pkgname_libtool_devel_arch libtool-ltdl-devel%{?_isa}
%global pkgname_bzip2_devel bzip2-devel
%global pkgname_docbook_xsl docbook-style-xsl
%global pkgname_gnutls_devel gnutls-devel
%global pkgname_shadow_utils shadow-utils
%global pkgname_procps procps-ng
%global pkgname_glue_libs cluster-glue-libs
%global pkgname_pcmk_libs %{name}-libs
%global hacluster_id 189
## Distro-specific configuration choices
### Use 2.0-style output when other distro packages don't support current output
%if 0%{?fedora} || ( 0%{?rhel} && 0%{?rhel} <= 8 )
%global compat20 --enable-compat-2.0
%endif
### Default concurrent-fencing to true when distro prefers that
%if 0%{?rhel} >= 7
%global concurrent_fencing --with-concurrent-fencing-default=true
%endif
### Default resource-stickiness to 1 when distro prefers that
%if 0%{?fedora} >= 35 || 0%{?rhel} >= 9
%global resource_stickiness --with-resource-stickiness-default=1
%endif
# Python-related definitions
@ -118,13 +185,24 @@
sed -e 's!/usr/lib[^[:space:]]*/brp-python-bytecompile[[:space:]].*$!!g'; })
%endif
## Values that differ by Python major version
## Prefer Python 3 definitions explicitly, in case 2 is also available
%if %{defined __python3}
%global python_name python3
%global python_path %{?__python3}%{!?__python3:/usr/bin/python%{?python3_pkgversion}%{!?python3_pkgversion:3}}
%global python_path %{__python3}
%define python_site %{?python3_sitelib}%{!?python3_sitelib:%(
%{python_path} -c 'from distutils.sysconfig import get_python_lib as gpl; print(gpl(1))' 2>/dev/null)}
%global python_min 3.2
# python_min still required?
%else
%if %{defined python_version}
%global python_name python%(echo %{python_version} | cut -d'.' -f1)
%define python_path %{?__python}%{!?__python:/usr/bin/%{python_name}}
%else
%global python_name python
%global python_path %{?__python}%{!?__python:/usr/bin/python%{?python_pkgversion}}
%endif
%define python_site %{?python_sitelib}%{!?python_sitelib:%(
%{python_name} -c 'from distutils.sysconfig import get_python_lib as gpl; print(gpl(1))' 2>/dev/null)}
%endif
# Keep sane profiling data if requested
%if %{with profiling}
@ -138,66 +216,89 @@
Name: pacemaker
Summary: Scalable High-Availability cluster resource manager
Version: %{pcmkversion}
Release: %{pcmk_release}%{?dist}.2
Release: %{pcmk_release}%{?dist}
License: GPLv2+ and LGPLv2+
Url: https://www.clusterlabs.org
Url: https://www.clusterlabs.org/
# Hint: use "spectool -s 0 pacemaker.spec" (rpmdevtools) to check the final URL
# Example: https://codeload.github.com/ClusterLabs/pacemaker/tar.gz/e91769e
# will download pacemaker-e91769e.tar.gz
#
# The ending part starting with '#' is ignored by github but necessary for
# rpmbuild to know what the tar archive name is. (The downloaded file will be
# named correctly only for commit IDs, not tagged releases.)
#
# You can use "spectool -s 0 pacemaker.spec" (rpmdevtools) to show final URL.
Source0: https://codeload.github.com/%{github_owner}/%{name}/tar.gz/%{archive_github_url}
Source1: https://codeload.github.com/%{github_owner}/%{nagios_name}/tar.gz/%{nagios_archive_github_url}
# ---
# upstream commits
Patch1: 001-ping-agent.patch
Patch2: 002-pacemakerd-options.patch
Patch3: 003-pacemakerd-output.patch
Patch4: 004-check-level.patch
Requires: resource-agents
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
Requires: %{name}-cluster-libs%{?_isa} = %{version}-%{release}
Requires: %{name}-cli = %{version}-%{release}
%{?systemd_requires}
# Pacemaker requires a minimum Python functionality
Requires: %{python_name} >= %{python_min}
BuildRequires: make
BuildRequires: %{python_name}-devel >= %{python_min}
%if %{defined centos}
ExclusiveArch: aarch64 i686 ppc64le s390x x86_64 %{arm}
%else
%if 0%{?rhel}
ExclusiveArch: aarch64 i686 ppc64le s390x x86_64
%endif
%endif
Requires: %{python_path}
BuildRequires: %{python_name}-devel
# Pacemaker requires a minimum libqb functionality
Requires: libqb >= 0.13.0
BuildRequires: libqb-devel >= 0.13.0
Requires: libqb >= 0.17.0
BuildRequires: libqb-devel >= 0.17.0
# Basics required for the build (even if usually satisfied through other BRs)
# Required basic build tools
BuildRequires: coreutils findutils grep sed
BuildRequires: autoconf automake gcc make pkgconfig
BuildRequires: libtool %{?pkgname_libtool_devel}
# Required for core functionality
BuildRequires: automake autoconf gcc libtool pkgconfig libtool-ltdl-devel
BuildRequires: pkgconfig(glib-2.0) >= 2.16
BuildRequires: pkgconfig(glib-2.0) >= 2.42
BuildRequires: libxml2-devel libxslt-devel libuuid-devel
BuildRequires: bzip2-devel
BuildRequires: %{pkgname_bzip2_devel}
# Enables optional functionality
BuildRequires: ncurses-devel docbook-style-xsl
BuildRequires: help2man gnutls-devel pam-devel pkgconfig(dbus-1)
BuildRequires: ncurses-devel %{pkgname_docbook_xsl}
BuildRequires: help2man %{pkgname_gnutls_devel} pam-devel pkgconfig(dbus-1)
BuildRequires: pkgconfig(systemd)
# RH patches are created by git, so we need git to apply them
BuildRequires: git
Requires: corosync >= 2.0.0
BuildRequires: corosync-devel >= 2.0.0
#XXX
#BuildRequires: pkgconfig(libcpg)
#BuildRequires: pkgconfig(libcfg)
## (note no avoiding effect when building through non-customized mock)
%if !%{bleeding}
%if %{with stonithd}
BuildRequires: %{pkgname_glue_libs}-devel
%endif
%if %{with doc}
BuildRequires: asciidoc inkscape publican
%endif
BuildRequires: asciidoc inkscape %{python_name}-sphinx
%endif
# git-style patch application
#BuildRequires: git
# RH patches are created by git, so we need git to apply them
BuildRequires: git
Provides: pcmk-cluster-manager = %{version}-%{release}
Provides: pcmk-cluster-manager%{?_isa} = %{version}-%{release}
# Pacemaker uses the crypto/md5 module from gnulib
# Bundled bits
## Pacemaker uses the crypto/md5-buffer module from gnulib
%if 0%{?fedora} || 0%{?rhel}
Provides: bundled(gnulib)
%endif
%description
Pacemaker is an advanced, scalable High-Availability cluster resource
@ -211,18 +312,20 @@ when related resources fail and can be configured to periodically check
resource health.
Available rpmbuild rebuild options:
--with(out) : cibsecrets coverage doc hardening pre_release profiling
--with(out) : cibsecrets coverage doc hardening pre_release profiling stonithd
%package cli
License: GPLv2+ and LGPLv2+
Summary: Command line tools for controlling Pacemaker clusters
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
%if 0%{?supports_recommends}
Recommends: pcmk-cluster-manager = %{version}-%{release}
# For crm_report
Recommends: tar
Recommends: bzip2
%endif
Requires: perl-TimeDate
Requires: procps-ng
Requires: %{pkgname_procps}
Requires: psmisc
Requires(post):coreutils
@ -234,25 +337,27 @@ The %{name}-cli package contains command line tools that can be used
to query and control the cluster from machines that may, or may not,
be part of the cluster.
%package libs
%package -n %{pkgname_pcmk_libs}
License: GPLv2+ and LGPLv2+
Summary: Core Pacemaker libraries
Requires(pre): shadow-utils
Requires(pre): %{pkgname_shadow_utils}
Requires: %{name}-schemas = %{version}-%{release}
# sbd 1.4.0+ supports the libpe_status API for pe_working_set_t
Conflicts: sbd < 1.4.0
# sbd 1.4.2+ supports startup/shutdown handshake via pacemakerd-api
# and handshake defaults to enabled in this spec
Conflicts: sbd < 1.4.2
%description libs
%description -n %{pkgname_pcmk_libs}
Pacemaker is an advanced, scalable High-Availability cluster resource
manager.
The %{name}-libs package contains shared libraries needed for cluster
The %{pkgname_pcmk_libs} package contains shared libraries needed for cluster
nodes and those just running the CLI tools.
%package cluster-libs
License: GPLv2+ and LGPLv2+
Summary: Cluster Libraries used by Pacemaker
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
%description cluster-libs
Pacemaker is an advanced, scalable High-Availability cluster resource
@ -263,8 +368,8 @@ libraries needed for nodes that will form part of the cluster nodes.
%package remote
License: GPLv2+ and LGPLv2+
Summary: Pacemaker remote daemon for non-cluster nodes
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Summary: Pacemaker remote executor daemon for non-cluster nodes
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
Requires: %{name}-cli = %{version}-%{release}
Requires: resource-agents
# -remote can be fully independent of systemd
@ -280,35 +385,40 @@ The %{name}-remote package contains the Pacemaker Remote daemon
which is capable of extending pacemaker functionality to remote
nodes not running the full corosync/cluster stack.
%package libs-devel
%package -n %{pkgname_pcmk_libs}-devel
License: GPLv2+ and LGPLv2+
Summary: Pacemaker development package
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release}
Requires: %{name}-cluster-libs%{?_isa} = %{version}-%{release}
Requires: libtool-ltdl-devel%{?_isa} libuuid-devel%{?_isa}
Requires: %{?pkgname_libtool_devel_arch} libuuid-devel%{?_isa}
Requires: libxml2-devel%{?_isa} libxslt-devel%{?_isa}
Requires: bzip2-devel%{?_isa} glib2-devel%{?_isa}
Requires: %{pkgname_bzip2_devel}%{?_isa} glib2-devel%{?_isa}
Requires: libqb-devel%{?_isa}
Requires: corosync-devel%{?_isa} >= 2.0.0
Requires: corosync-devel >= 2.0.0
%description libs-devel
%description -n %{pkgname_pcmk_libs}-devel
Pacemaker is an advanced, scalable High-Availability cluster resource
manager.
The %{name}-libs-devel package contains headers and shared libraries
The %{pkgname_pcmk_libs}-devel package contains headers and shared libraries
for developing tools for Pacemaker.
%package cts
License: GPLv2+ and LGPLv2+
Summary: Test framework for cluster-related technologies like Pacemaker
Requires: %{python_path}
Requires: %{python_name} >= %{python_min}
Requires: %{name}-libs = %{version}-%{release}
Requires: procps-ng
Requires: %{pkgname_pcmk_libs} = %{version}-%{release}
Requires: %{name}-cli = %{version}-%{release}
Requires: %{pkgname_procps}
Requires: psmisc
BuildArch: noarch
# systemd Python bindings are a separate package in some distros
%if %{defined systemd_requires}
%if 0%{?fedora} > 22 || 0%{?rhel} > 7
Requires: %{python_name}-systemd
%endif
%endif
%description cts
Test framework for cluster-related technologies like Pacemaker
@ -317,8 +427,6 @@ Test framework for cluster-related technologies like Pacemaker
License: CC-BY-SA-4.0
Summary: Documentation for Pacemaker
BuildArch: noarch
Conflicts: %{name}-libs > %{version}-%{release}
Conflicts: %{name}-libs < %{version}-%{release}
%description doc
Documentation for Pacemaker.
@ -354,7 +462,7 @@ The metadata files required for Pacemaker to execute the nagios plugin
monitor resources.
%prep
%setup -q -a 1 -n %{name}-%{archive_version}
%autosetup -a 1 -n %{name}-%{archive_version} -S git_am -p 1
%build
@ -374,27 +482,26 @@ export LDFLAGS_HARDENED_LIB="%{?_hardening_ldflags}"
./autogen.sh
# Rawhide glibc doesn't like ftime at all
export CPPFLAGS="-UPCMK_TIME_EMERGENCY_CGT $CPPFLAGS"
%{configure} \
PYTHON=%{python_path} \
%{!?with_hardening: --disable-hardening} \
%{!?with_legacy_links: --disable-legacy-links} \
%{?with_legacy_links: --enable-legacy-links} \
%{?with_profiling: --with-profiling} \
%{?with_coverage: --with-coverage} \
%{?with_cibsecrets: --with-cibsecrets} \
%{!?with_doc: --with-brand=} \
%{?with_sbd_sync: --with-sbd-sync-default="true"} \
%{?gnutls_priorities: --with-gnutls-priorities="%{gnutls_priorities}"} \
--disable-static \
%{?bug_url: --with-bug-url=%{bug_url}} \
%{?concurrent_fencing} \
%{?resource_stickiness} \
%{?compat20} \
--with-initdir=%{_initrddir} \
--with-runstatedir=%{_rundir} \
--localstatedir=%{_var} \
--with-version=%{version}-%{release} \
--with-bug-url=https://bugz.fedoraproject.org/%{name} \
--with-nagios \
--with-nagios-metadata-dir=%{_datadir}/pacemaker/nagios/plugins-metadata/ \
--with-nagios-plugin-dir=%{_libdir}/nagios/plugins/
--with-nagios \
--with-nagios-metadata-dir=%{_datadir}/pacemaker/nagios/plugins-metadata/ \
--with-nagios-plugin-dir=%{_libdir}/nagios/plugins/ \
--with-version=%{version}-%{release}
make %{_smp_mflags} V=1
@ -415,10 +522,6 @@ make install \
DESTDIR=%{buildroot} V=1 docdir=%{pcmk_docdir} \
%{?_python_bytecompile_extra:%{?py_byte_compile:am__py_compile=true}}
mkdir -p ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig
install -m 644 daemons/pacemakerd/pacemaker.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/pacemaker
install -m 644 tools/crm_mon.sysconfig ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig/crm_mon
mkdir -p %{buildroot}%{_datadir}/pacemaker/nagios/plugins-metadata
for file in $(find %{nagios_name}-%{nagios_hash}/metadata -type f); do
install -m 644 $file %{buildroot}%{_datadir}/pacemaker/nagios/plugins-metadata
@ -427,9 +530,6 @@ done
mkdir -p ${RPM_BUILD_ROOT}%{_localstatedir}/lib/rpm-state/%{name}
# These are not actually scripts
find %{buildroot} -name '*.xml' -type f -print0 | xargs -0 chmod a-x
# Don't package static libs
find %{buildroot} -name '*.a' -type f -print0 | xargs -0 rm -f
find %{buildroot} -name '*.la' -type f -print0 | xargs -0 rm -f
@ -449,7 +549,7 @@ rm -f %{buildroot}/%{_initrddir}/pacemaker
rm -f %{buildroot}/%{_initrddir}/pacemaker_remote
# Byte-compile Python sources where suitable and the distro procedures known
%if %{defined py_byte_compile} && %{defined python_path}
%if %{defined py_byte_compile}
%{py_byte_compile %{python_path} %{buildroot}%{_datadir}/pacemaker/tests}
%if !%{defined _python_bytecompile_extra}
%{py_byte_compile %{python_path} %{buildroot}%{python_site}/cts}
@ -526,15 +626,14 @@ fi
%postun cli
%systemd_postun_with_restart crm_mon.service
%pre libs
# XXX keep an eye on https://fedoraproject.org/wiki/Changes/SystemdSysusers
# reopened recently:
# https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/AETGESYR4IEQJMA6SKL7OERSDZFWFNEU/
%pre -n %{pkgname_pcmk_libs}
# @TODO Use sysusers.d:
# https://fedoraproject.org/wiki/Changes/Adopting_sysusers.d_format
getent group %{gname} >/dev/null || groupadd -r %{gname} -g %{hacluster_id}
getent passwd %{uname} >/dev/null || useradd -r -g %{gname} -u %{hacluster_id} -s /sbin/nologin -c "cluster user" %{uname}
exit 0
%ldconfig_scriptlets libs
%ldconfig_scriptlets -n %{pkgname_pcmk_libs}
%ldconfig_scriptlets cluster-libs
%files
@ -549,9 +648,7 @@ exit 0
%exclude %{_libexecdir}/pacemaker/cts-log-watcher
%exclude %{_libexecdir}/pacemaker/cts-support
%exclude %{_sbindir}/pacemaker-remoted
%if %{with legacy_links}
%exclude %{_sbindir}/pacemaker_remoted
%endif
%{_libexecdir}/pacemaker/*
%{_sbindir}/crm_attribute
@ -643,7 +740,7 @@ exit 0
%dir %attr (770, %{uname}, %{gname}) %{_var}/log/pacemaker
%dir %attr (770, %{uname}, %{gname}) %{_var}/log/pacemaker/bundles
%files libs
%files -n %{pkgname_pcmk_libs}
%{_libdir}/libcib.so.*
%{_libdir}/liblrmd.so.*
%{_libdir}/libcrmservice.so.*
@ -694,7 +791,7 @@ exit 0
%doc COPYING
%doc ChangeLog
%files libs-devel
%files -n %{pkgname_pcmk_libs}-devel
%{_includedir}/pacemaker
%{_libdir}/*.so
%if %{with coverage}
@ -720,6 +817,12 @@ exit 0
%license %{nagios_name}-%{nagios_hash}/COPYING
%changelog
* Wed May 12 2021 Ken Gaillot <kgaillot@redhat.com> - 2.1.0-1
- Default resource-stickiness to 1 in newly created clusters
- Rebase on upstream 2.1.0 release
- Resolves: rhbz1850145
- Resolves: rhbz1936023
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 2.0.5-10.2
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937

View File

@ -1,2 +1,2 @@
SHA512 (nagios-agents-metadata-105ab8a7b2c16b9a29cf1c1596b80136eeef332b.tar.gz) = 11ddeb48a4929e7642b6dfa9c7962aa1d7a1af1c569830f55ed6cd6773abac13377317327bc1db8411c8077884f83f81cc54d746c834b63a99fa6dc219b5caad
SHA512 (pacemaker-Pacemaker-2.0.5.tar.gz) = 5fd3614f0284297babb66ea2dc567583315052fcf77f49107c52161e8e8c164ae3169d98528fdc1316d8eabaacc98ed24e9c6e6c90b3286f2f012a4ee874bbba
SHA512 (pacemaker-4edf50cc9.tar.gz) = 622ace9de427b5f994312d8661f309eb94e0fd6f8d712cee3c16b6fcf9c826d4af4d55d4d1588d14d5b5b1a5bbcad3eebf04b044bacdff74d4e08f0d7733e097