Tomas Golembiovsky has uploaded a new change for review.
Change subject: vdsm: Rely on system for logrotation
......................................................................
vdsm: Rely on system for logrotation
When logrotate is installed it is normaly run periodicaly by cron. There
is no real reason to invoke logrotate manualy.
Also if we rely on system to run logrotate we can remove the dependency
on it from RPMs. It is enough to install the configuration file into the
the directory with logrotate configuration.
The patch also renames script vdsm-logrotate to vdsm-remove-logs because
it doesn't run logrotate anymore. It only removes old log files.
Change-Id: Ica888244bd7c65121f55983e5716a6eae5662879
Signed-off-by: Tomáš Golembiovský <tgolembi(a)redhat.com>
---
M static/Makefile.am
R static/etc/logrotate.d/vdsm
M vdsm.spec.in
M vdsm/Makefile.am
R vdsm/vdsm-remove-logs
5 files changed, 12 insertions(+), 21 deletions(-)
git pull ssh://gerrit.ovirt.org:29418/vdsm refs/changes/82/63682/1
diff --git a/static/Makefile.am b/static/Makefile.am
index 040d6ec..22c8736 100644
--- a/static/Makefile.am
+++ b/static/Makefile.am
@@ -37,10 +37,10 @@
./etc/vdsm/mom.d/05-iotune.policy \
$(NULL)
-vdsmconfrotatedir = $(vdsmconfdir)/logrotate
+vdsmconfrotatedir = $(sysconfdir)/logrotate.d
vdsmconfrotate_DATA = \
- ./etc/vdsm/logrotate/vdsm \
+ ./etc/logrotate.d/vdsm \
$(NULL)
sudoersdir = $(sysconfdir)/sudoers.d
diff --git a/static/etc/vdsm/logrotate/vdsm b/static/etc/logrotate.d/vdsm
similarity index 100%
rename from static/etc/vdsm/logrotate/vdsm
rename to static/etc/logrotate.d/vdsm
diff --git a/vdsm.spec.in b/vdsm.spec.in
index 26c36d3..dafeb9c 100644
--- a/vdsm.spec.in
+++ b/vdsm.spec.in
@@ -131,7 +131,6 @@
Requires: ethtool
Requires: which
Requires: sudo >= 1.7.3
-Requires: logrotate
Requires: xz
Requires: ntp
Requires: iproute >= 3.10.0
@@ -948,7 +947,7 @@
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/svdsm.logger.conf
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/mom.conf
%config(noreplace) %{_sysconfdir}/%{vdsm_name}/mom.d/*.policy
-%config(noreplace) %{_sysconfdir}/%{vdsm_name}/logrotate/vdsm
+%config(noreplace) %{_sysconfdir}/logrotate.d/vdsm
%config(noreplace) %{_sysconfdir}/rwtab.d/vdsm
%config(noreplace) %{_sysconfdir}/sysctl.d/vdsm.conf
%config(noreplace) %{_sysconfdir}/modules-load.d/vdsm.conf
@@ -956,7 +955,7 @@
%{_sysconfdir}/dhcp/dhclient.d/sourceRoute.sh
%{_sysconfdir}/modprobe.d/vdsm-bonding-modprobe.conf
%{_sysconfdir}/sudoers.d/50_vdsm
-%{_sysconfdir}/cron.hourly/vdsm-logrotate
+%{_sysconfdir}/cron.hourly/vdsm-remove-logs
%{_sysconfdir}/libvirt/hooks/qemu
%{_libexecdir}/%{vdsm_name}/curl-img-wrap
%{_libexecdir}/%{vdsm_name}/fc-scan
diff --git a/vdsm/Makefile.am b/vdsm/Makefile.am
index 8b535b6..0b5e807 100644
--- a/vdsm/Makefile.am
+++ b/vdsm/Makefile.am
@@ -76,7 +76,7 @@
vdsm-gencerts.sh.in \
vdsm-libvirt-access.pkla \
vdsm-libvirt-access.rules \
- vdsm-logrotate \
+ vdsm-remove-logs \
vdsm-store-net-config.in \
vdsmd.8.in \
$(NULL)
@@ -94,7 +94,7 @@
install-data-bonding-defaults \
install-data-dhclient-hooks \
install-data-libvirtpass \
- install-data-logrotate \
+ install-data-logs \
install-data-vdsmconf
$(MKDIR_P) $(DESTDIR)$(vdsmrepo)
$(MKDIR_P) $(DESTDIR)$(vdsmrepo)/hsm-tasks
@@ -118,7 +118,7 @@
uninstall-data-bonding-defaults \
uninstall-data-dhclient-hooks \
uninstall-data-libvirtpass \
- uninstall-data-logrotate \
+ uninstall-data-logs \
uninstall-data-vdsmconf
install-data-libvirtpass:
@@ -139,14 +139,13 @@
$(RM) $(DESTDIR)$(vdsmdir)/bonding-defaults.json
$(RM) $(DESTDIR)$(vdsmdir)/bonding-name2numeric.json
-install-data-logrotate:
+install-data-logs:
$(MKDIR_P) $(DESTDIR)$(sysconfdir)/cron.hourly
- $(INSTALL_SCRIPT) $(srcdir)/vdsm-logrotate \
- $(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-logrotate
- $(MKDIR_P) $(DESTDIR)$(sysconfdir)/cron.d
+ $(INSTALL_SCRIPT) $(srcdir)/vdsm-remove-logs \
+ $(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-remove-logs
-uninstall-data-logrotate:
- $(RM) $(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-logrotate
+uninstall-data-logs:
+ $(RM) $(DESTDIR)$(sysconfdir)/cron.hourly/vdsm-remove-logs
install-data-vdsmconf:
$(MKDIR_P) $(DESTDIR)$(vdsmconfdir)/vdsm.conf.d
diff --git a/vdsm/vdsm-logrotate b/vdsm/vdsm-remove-logs
similarity index 77%
rename from vdsm/vdsm-logrotate
rename to vdsm/vdsm-remove-logs
index 11050b9..7760b6b 100755
--- a/vdsm/vdsm-logrotate
+++ b/vdsm/vdsm-remove-logs
@@ -1,12 +1,5 @@
#!/bin/sh
-/usr/sbin/logrotate /etc/vdsm/logrotate/vdsm
-
-EXITVALUE=$?
-if [ $EXITVALUE != 0 ]; then
- /usr/bin/logger -t logrotate "ALERT exited abnormally with [$EXITVALUE]"
-fi
-
if [ -d /var/log/core ] ; then
/usr/bin/find /var/log/core -type f -name '*xz' -mtime +7 -exec /bin/rm -f
'{}' \;
EXITVALUE=$?
--
To view, visit
https://gerrit.ovirt.org/63682
To unsubscribe, visit
https://gerrit.ovirt.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ica888244bd7c65121f55983e5716a6eae5662879
Gerrit-PatchSet: 1
Gerrit-Project: vdsm
Gerrit-Branch: master
Gerrit-Owner: Tomas Golembiovsky <tgolembi(a)redhat.com>