diff --git a/002-corosync.patch b/002-corosync.patch new file mode 100644 index 0000000..3f048ce --- /dev/null +++ b/002-corosync.patch @@ -0,0 +1,75 @@ +From b1fd6ccea9083826c1c2fb40418651704989a904 Mon Sep 17 00:00:00 2001 +From: Reid Wahl +Date: Wed, 13 Aug 2025 17:33:16 -0700 +Subject: [PATCH] Fix: cts: Start corosync using systemd if available + +As of corosync upstream commit ae859515, in systemd builds, +StateDirectory is set in the systemd corosync.service file. The corosync +state directory defaults to this value if not set in the corosync config +file. Corosync falls back to using /var/lib/corosync only if the systemd +StateDirectory is not set. + +The same commit removes /var/lib/corosync from RPM builds with systemd. + +As a result, if corosync was built with systemd, then starting corosync +outside of systemd fails unless /var/lib/corosync has been created +manually or through some other means. Starting corosync directly from +the command line fails with the following error, because the +STATE_DIRECTORY environment variable was not set by systemd: + +Cannot chdir to state directory /var/lib/corosync. No such file or +directory + +This causes Pacemaker's cts-fencing script to fail. + +This seems like a bug in corosync, as it now assumes that corosync will +always be started by systemd if available. Here, we work around it in +cts by doing exactly that. + +Signed-off-by: Reid Wahl +--- + python/pacemaker/_cts/corosync.py | 11 ++++++++++- + 1 file changed, 10 insertions(+), 1 deletion(-) + +diff --git a/python/pacemaker/_cts/corosync.py b/python/pacemaker/_cts/corosync.py +index 0a55dd7c96..beb574d2b8 100644 +--- a/python/pacemaker/_cts/corosync.py ++++ b/python/pacemaker/_cts/corosync.py +@@ -11,6 +11,7 @@ import tempfile + import time + + from pacemaker.buildoptions import BuildOptions ++from pacemaker._cts.environment import EnvFactory + from pacemaker._cts.process import killall, stdout_from_command + + +@@ -112,6 +113,9 @@ class Corosync: + self.logdir = logdir + self.cluster_name = cluster_name + ++ # The Corosync class doesn't use self._env._nodes, but the ++ # "--nodes" argument is required to be present and nonempty ++ self._env = EnvFactory().getInstance(args=["--nodes", "localhost"]) + self._existing_cfg_file = None + + def _ready(self, logfile, timeout=10): +@@ -149,10 +153,15 @@ class Corosync: + self.cluster_name, localname()) + logfile = corosync_log_file(BuildOptions.COROSYNC_CONFIG_FILE) + ++ if self._env["have_systemd"]: ++ cmd = ["systemctl", "start", "corosync.service"] ++ else: ++ cmd = ["corosync"] ++ + if self.verbose: + print("Starting corosync") + +- with subprocess.Popen("corosync", stdout=subprocess.PIPE, stderr=subprocess.PIPE) as test: ++ with subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as test: + test.wait() + + # Wait for corosync to be ready before returning +-- +2.50.1 + diff --git a/pacemaker.spec b/pacemaker.spec index ef4d2c8..efa30bc 100644 --- a/pacemaker.spec +++ b/pacemaker.spec @@ -1,5 +1,5 @@ # -# Copyright 2008-2024 the Pacemaker project contributors +# Copyright 2008-2025 the Pacemaker project contributors # # The version control history for this file may have further details. # @@ -41,7 +41,7 @@ ## can be incremented to build packages reliably considered "newer" ## than previously built packages with the same pcmkversion) %global pcmkversion 3.0.1 -%global specversion 2 +%global specversion 3 ## Upstream commit (full commit ID, abbreviated commit ID, or tag) to build %global commit 9a5e54bae85847c4bb6ed7c7fb06103ebebbc64a @@ -200,6 +200,7 @@ Source0: https://codeload.github.com/%{github_owner}/%{name}/tar.gz/%{arch Source1: pacemaker.sysusers # upstream commits Patch001: 001-econnrefused.patch +Patch002: 002-corosync.patch Requires: resource-agents Requires: %{pkgname_pcmk_libs}%{?_isa} = %{version}-%{release} @@ -791,6 +792,10 @@ exit 0 %{_datadir}/pkgconfig/pacemaker-schemas.pc %changelog +* Wed Aug 13 2025 Reid Wahl - 3.0.1-3 +- CTS launches Corosync using systemd if available. +- Resolves: RHEL-110075 + * Mon Aug 11 2025 Chris Lumens - 3.0.1-2 - Do not retry on ECONNREFUSED in command line tools. - Resolves: RHEL-106594