From 05424a803b817068f0a06b0ac6709aa8a8a3a717 Mon Sep 17 00:00:00 2001 From: Nathan Cutler Date: Fri, 26 Jun 2015 13:13:33 +0200 Subject: [PATCH] logrotate.conf: fixes for systemd Before this patch, the command 'logrotate -f /etc/logrotate.d/ceph' was generating an error "Failed to reload ceph.target: Job type reload is not applicable for unit ceph.target". Before we issue systemctl reload, check that there is at least one active ceph-* service. (The hyphen is significant.) Since we use grep, make the grep package a dependency. http://tracker.ceph.com/issues/12173 Fixes: #12173 Signed-off-by: Tim Serong Signed-off-by: Lars Marowsky-Bree Signed-off-by: Nathan Cutler --- ceph.spec.in | 1 + debian/control | 1 + src/logrotate.conf | 4 ++++ systemd/ceph-mds@.service | 1 + systemd/ceph-mon@.service | 1 + systemd/ceph-osd@.service.in | 1 + 6 files changed, 9 insertions(+) diff --git a/ceph.spec.in b/ceph.spec.in index 638b0b9b340..246119c267a 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -44,6 +44,7 @@ Requires: python Requires: python-argparse Requires: python-requests Requires: python-flask +Requires: grep Requires: xfsprogs Requires: parted Requires: util-linux diff --git a/debian/control b/debian/control index 099f4b708aa..6801a4541a8 100644 --- a/debian/control +++ b/debian/control @@ -64,6 +64,7 @@ Depends: binutils, ceph-common (>= 9.0.0-943), cryptsetup-bin | cryptsetup, gdisk, + grep, parted, python, python-argparse, diff --git a/src/logrotate.conf b/src/logrotate.conf index 9ae27baee45..a2eb896daac 100644 --- a/src/logrotate.conf +++ b/src/logrotate.conf @@ -8,6 +8,10 @@ service ceph reload >/dev/null elif which invoke-rc.d > /dev/null 2>&1 && [ -x `which invoke-rc.d` ]; then invoke-rc.d ceph reload >/dev/null + elif which systemctl > /dev/null 2>&1 && [ -x `which systemctl` ]; then + if systemctl is-active 'ceph-*' | grep -i active > /dev/null 2>&1 ; then + systemctl reload 'ceph-*' >/dev/null || : + fi fi # Possibly reload twice, but depending on ceph.conf the reload above may be a no-op if which initctl > /dev/null 2>&1 && [ -x `which initctl` ]; then diff --git a/systemd/ceph-mds@.service b/systemd/ceph-mds@.service index 22a787d60b4..aec46fd4eee 100644 --- a/systemd/ceph-mds@.service +++ b/systemd/ceph-mds@.service @@ -8,6 +8,7 @@ PartOf=ceph.target EnvironmentFile=-/etc/sysconfig/ceph Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-mds -f --cluster ${CLUSTER} --id %i +ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=ceph.target diff --git a/systemd/ceph-mon@.service b/systemd/ceph-mon@.service index c3d260989d7..421897dc0d0 100644 --- a/systemd/ceph-mon@.service +++ b/systemd/ceph-mon@.service @@ -15,6 +15,7 @@ PartOf=ceph.target EnvironmentFile=-/etc/sysconfig/ceph Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-mon -f --cluster ${CLUSTER} --id %i +ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=ceph.target diff --git a/systemd/ceph-osd@.service.in b/systemd/ceph-osd@.service.in index fd300871dd7..72d21f432d1 100644 --- a/systemd/ceph-osd@.service.in +++ b/systemd/ceph-osd@.service.in @@ -10,6 +10,7 @@ Environment=CLUSTER=ceph ExecStart=/usr/bin/ceph-osd -f --cluster ${CLUSTER} --id %i ExecStartPre=@systemd_libexec_dir@/ceph-osd-prestart.sh --cluster ${CLUSTER} --id %i LimitNOFILE=131072 +ExecReload=/bin/kill -HUP $MAINPID [Install] WantedBy=ceph.target