Fix regression in pcp-zeroconf overridding pmlogger interval

Also cleanup spec files relating to systemd farm unit setup,
so they don't produce warnings during rpm removal.

Resolves: rhbz#2048024
Related: rhbz#1991764
This commit is contained in:
Nathan Scott 2022-02-02 11:22:24 +11:00
parent c028b7b916
commit a47dbdb632
2 changed files with 97 additions and 33 deletions

View File

@ -1,6 +1,6 @@
Name: pcp
Version: 5.3.5
Release: 5%{?dist}
Release: 8%{?dist}
Summary: System-level performance monitoring and performance management
License: GPLv2+ and LGPLv2+ and CC-BY
URL: https://pcp.io
@ -17,6 +17,7 @@ Patch5: redhat-bugzilla-2024982.patch
Patch6: redhat-bugzilla-2024980.patch
Patch7: redhat-bugzilla-1973833.patch
Patch8: redhat-bugzilla-2006430.patch
Patch9: redhat-bugzilla-1991764.patch
%if 0%{?fedora} >= 26 || 0%{?rhel} > 7
%global __python2 python2
@ -2294,6 +2295,7 @@ updated policy package.
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
%build
# the buildsubdir macro gets defined in %setup and is apparently only available in the next step (i.e. the %build step)
@ -2696,10 +2698,8 @@ exit 0
chown -R pcpqa:pcpqa %{_testsdir} 2>/dev/null
%if 0%{?rhel}
%if !%{disable_systemd}
systemctl restart pmcd >/dev/null 2>&1
systemctl restart pmlogger >/dev/null 2>&1
systemctl enable pmcd >/dev/null 2>&1
systemctl enable pmlogger >/dev/null 2>&1
systemctl restart pmcd pmlogger >/dev/null 2>&1
systemctl enable pmcd pmlogger >/dev/null 2>&1
%else
/sbin/chkconfig --add pmcd >/dev/null 2>&1
/sbin/chkconfig --add pmlogger >/dev/null 2>&1
@ -2962,8 +2962,7 @@ exit 0
%preun zeroconf
if [ "$1" -eq 0 ]
then
%systemd_preun pmlogger_daily_report.timer
%systemd_preun pmlogger_daily_report.service
%systemd_preun pmlogger_daily_report.timer pmlogger_daily_report.service
fi
%endif
@ -2972,27 +2971,9 @@ if [ "$1" -eq 0 ]
then
# stop daemons before erasing the package
%if !%{disable_systemd}
%systemd_preun pmlogger.service
%systemd_preun pmlogger_check.timer
%systemd_preun pmlogger_daily.timer
%systemd_preun pmlogger_farm.service
%systemd_preun pmlogger_farm_check.service
%systemd_preun pmlogger_farm_check.timer
%systemd_preun pmie.service
%systemd_preun pmie_check.timer
%systemd_preun pmie_daily.timer
%systemd_preun pmie_farm.service
%systemd_preun pmie_farm_check.service
%systemd_preun pmie_farm_check.timer
%systemd_preun pmproxy.service
%systemd_preun pmfind.service
%systemd_preun pmcd.service
%systemd_preun pmlogger_check.timer pmlogger_daily.timer pmlogger_farm_check.timer pmlogger_farm_check.service pmlogger_farm.service pmlogger.service pmie_check.timer pmie_daily.timer pmie_farm_check.timer pmie_farm_check.service pmie_farm.service pmie.service pmproxy.service pmfind.service pmcd.service
systemctl stop pmlogger.service >/dev/null 2>&1
systemctl stop pmie.service >/dev/null 2>&1
systemctl stop pmproxy.service >/dev/null 2>&1
systemctl stop pmfind.service >/dev/null 2>&1
systemctl stop pmcd.service >/dev/null 2>&1
systemctl stop pmlogger.service pmie.service pmproxy.service pmfind.service pmcd.service >/dev/null 2>&1
%else
/sbin/service pmlogger stop >/dev/null 2>&1
/sbin/service pmie stop >/dev/null 2>&1
@ -3025,12 +3006,8 @@ done
pmieconf -c enable dmthin
%if 0%{?rhel}
%if !%{disable_systemd}
systemctl restart pmcd >/dev/null 2>&1
systemctl restart pmlogger >/dev/null 2>&1
systemctl restart pmie >/dev/null 2>&1
systemctl enable pmcd >/dev/null 2>&1
systemctl enable pmlogger >/dev/null 2>&1
systemctl enable pmie >/dev/null 2>&1
systemctl restart pmcd pmlogger pmie >/dev/null 2>&1
systemctl enable pmcd pmlogger pmie >/dev/null 2>&1
%else
/sbin/chkconfig --add pmcd >/dev/null 2>&1
/sbin/chkconfig --add pmlogger >/dev/null 2>&1
@ -3376,6 +3353,10 @@ PCP_LOG_DIR=%{_logsdir}
%files zeroconf -f pcp-zeroconf-files.rpm
%changelog
* Wed Feb 02 2022 Nathan Scott <nathans@redhat.com> - 5.3.5-8
- Fix pcp-zeroconf logger interval override regression (BZ 1991764)
- Remove warnings from spec setup of PCP systemd units (BZ 2048024)
* Fri Jan 21 2022 Nathan Scott <nathans@redhat.com> - 5.3.5-5
- Further improve pmlogger and pmie farm services (BZ 2030138)
- Resolve a further KVM selinux issue with KVM (BZ 2006430)

View File

@ -0,0 +1,83 @@
commit 69c7d9bf5ac24bda51f8c876dc258bfe054b7cf8
Author: Sunil Mohan Adapa <sunil@medhas.org>
Date: Tue Feb 1 09:55:23 2022 -0800
pmlogger: zeroconf: Prioritize user configuration over zeroconf
In 2c17ba0cc16f58de511dff1e3122096d60c50bb0, zeroconf provided
defaults (/usr/share/pcp/zeroconf/pmlogger, which was actually
/etc/sysconf/pmlogger_zeroconf at the time of the change) were prioritized over
user configuration (/etc/sysconf/pmlogger). This lead to regression in clients
which edited the user configuration and expected the changes to be given
priority over zeroconf configuration. This was identified at least in
ansible-pcp[1].
Undo the changes in this commit so that the final priority is as follows:
User configuration (/etc/sysconfig/pmlogger)
(priority over)
Zeroconf defaults (/usr/share/pcp/zeroconf/pmlogger)
(priority over)
Code defaults (pmlogger.c)
Links:
1) https://github.com/performancecopilot/pcp/pull/1462#issuecomment-1022714960
Tests:
- Install pcp. Ensure pmlogger is running. Notice that there is no
PMLOGGER_INTERVAL set in the pmlogger daemon's environment.
- Install pcp-zeroconf. Restart pmlogger. Notice that PMLOGGER_INTERVAL
environment is set in the pmlogger daemon's environment. The value is 10.
- Edit /etc/sysconfig/pmlogger and set the value of PMLOGGER_INTERVAL to 15.
Restart pmlogger and notice that PMLOGGER_INTERVAL is set to 15 in pmlogger
daemon's environment.
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Tested-by: Sunil Mohan Adapa <sunil@medhas.org>
diff --git a/src/pmlogger/pmlogger.defaults b/src/pmlogger/pmlogger.defaults
index 1765760b5..1e96cd6ff 100644
--- a/src/pmlogger/pmlogger.defaults
+++ b/src/pmlogger/pmlogger.defaults
@@ -1,7 +1,7 @@
# Environment variables for the primary pmlogger daemon. See also
# the pmlogger control file and pmlogconf(1) for additional details.
-# Settings defined in this file will be overridden by any settings
-# in the pmlogger zeroconf file (if present).
+# Settings defined in this file will override any settings in the
+# pmlogger zeroconf file (if present).
# Behaviour regarding listening on external-facing interfaces;
# unset PMLOGGER_LOCAL to allow connections from remote hosts.
diff --git a/src/pmlogger/pmlogger.zeroconf b/src/pmlogger/pmlogger.zeroconf
index 9defc6e3d..fe86dedcc 100644
--- a/src/pmlogger/pmlogger.zeroconf
+++ b/src/pmlogger/pmlogger.zeroconf
@@ -1,6 +1,6 @@
#
-# PMLOGGER environment variables defined in this file take precedence over
-# the same variables defined in the standard pmlogger config file.
+# PMLOGGER environment variables defined in the standard pmlogger config file
+# take precedence over the same variables defined in this file.
#
# The PMLOGGER_INTERVAL setting affects the default primary pmlogger recording
# frequency. This only affects the *default* interval setting when specified
diff --git a/src/pmlogger/pmlogger_check.sh b/src/pmlogger/pmlogger_check.sh
index 6cc2a8ed7..64750cb5f 100755
--- a/src/pmlogger/pmlogger_check.sh
+++ b/src/pmlogger/pmlogger_check.sh
@@ -983,8 +983,8 @@ END { print m }'`
then
if [ "X$primary" = Xy ]
then
- # pcp-zeroconf environment variables (if present) take precedence
- envs=`grep -h ^PMLOGGER "$PMLOGGERENVS" "$PMLOGGERZEROCONFENVS" 2>/dev/null`
+ # User configuration takes precedence over pcp-zeroconf
+ envs=`grep -h ^PMLOGGER "$PMLOGGERZEROCONFENVS" "$PMLOGGERENVS" 2>/dev/null`
args="-P $args"
iam=" primary"
# clean up port-map, just in case