From 3aee6971531de6eebeb5d67d5772fa4c55e4e172 Mon Sep 17 00:00:00 2001 From: Yaarit Hatuka Date: Wed, 25 Aug 2021 02:12:08 +0000 Subject: [PATCH] rpm, debian: move smartmontools and nvme-cli to ceph-base We wish to be able to scrape SMART and NVMe metrics from OSD and MON nodes. For this we require / recommend smartmontools and nvme-cli dependencies for both the ceph-osd and ceph-mon packages. However, the sudoers file (which is required for invoking `smartctl` by user 'ceph') was installed only in the ceph-osd package. Since different packages cannot own the same file, and because we want to be able to scrape from every daemon, we move the dependencies and the sudoers installation to ceph-base. For generalization, we rename: sudoers.d/ceph-osd-smartctl -> sudoers.d/ceph-smartctl Fixes: https://tracker.ceph.com/issues/50657 Signed-off-by: Yaarit Hatuka (cherry picked from commit 7ca39fa92b47427af2f1c6000c653bb4dffc47fe) Conflicts: ceph.spec.in Cherry-pick notes: - Conflict in ceph.spec.in because setuptools not required for OSD in pacific --- ceph.spec.in | 26 ++++++------------- debian/ceph-base.install | 1 + debian/ceph-osd.install | 1 - debian/control | 6 ++--- debian/rules | 2 +- .../{ceph-osd-smartctl => ceph-smartctl} | 2 +- 6 files changed, 13 insertions(+), 25 deletions(-) rename sudoers.d/{ceph-osd-smartctl => ceph-smartctl} (60%) diff --git a/ceph.spec.in b/ceph.spec.in index 9b1a8f19ced2..ebc2893cbd62 100644 --- a/ceph.spec.in +++ b/ceph.spec.in @@ -436,6 +436,12 @@ Requires: gperftools-libs >= 2.6.1 %endif %if 0%{?weak_deps} Recommends: chrony +Recommends: nvme-cli +%if 0%{?suse_version} +Requires: smartmontools +%else +Recommends: smartmontools +%endif %endif %description base Base is the package that includes all the files shared amongst ceph servers @@ -504,14 +510,6 @@ Group: System/Filesystems %endif Provides: ceph-test:/usr/bin/ceph-monstore-tool Requires: ceph-base = %{_epoch_prefix}%{version}-%{release} -%if 0%{?weak_deps} -Recommends: nvme-cli -%if 0%{?suse_version} -Requires: smartmontools -%else -Recommends: smartmontools -%endif -%endif %if 0%{with jaeger} Requires: libjaeger = %{_epoch_prefix}%{version}-%{release} %endif @@ -782,14 +780,6 @@ Requires: lvm2 Requires: sudo Requires: libstoragemgmt Requires: python%{python3_pkgversion}-ceph-common = %{_epoch_prefix}%{version}-%{release} -%if 0%{?weak_deps} -Recommends: nvme-cli -%if 0%{?suse_version} -Requires: smartmontools -%else -Recommends: smartmontools -%endif -%endif %description osd ceph-osd is the object storage daemon for the Ceph distributed file system. It is responsible for storing objects on a local file system @@ -1402,7 +1392,7 @@ ln -sf %{_sbindir}/mount.ceph %{buildroot}/sbin/mount.ceph install -m 0644 -D udev/50-rbd.rules %{buildroot}%{_udevrulesdir}/50-rbd.rules # sudoers.d -install -m 0440 -D sudoers.d/ceph-osd-smartctl %{buildroot}%{_sysconfdir}/sudoers.d/ceph-osd-smartctl +install -m 0440 -D sudoers.d/ceph-smartctl %{buildroot}%{_sysconfdir}/sudoers.d/ceph-smartctl %if 0%{?rhel} >= 8 pathfix.py -pni "%{__python3} %{py3_shbang_opts}" %{buildroot}%{_bindir}/* @@ -1503,6 +1493,7 @@ rm -rf %{buildroot} %attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/bootstrap-mgr %attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/bootstrap-rbd %attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/bootstrap-rbd-mirror +%{_sysconfdir}/sudoers.d/ceph-smartctl %post base /sbin/ldconfig @@ -2084,7 +2075,6 @@ fi %{_unitdir}/ceph-volume@.service %attr(750,ceph,ceph) %dir %{_localstatedir}/lib/ceph/osd %config(noreplace) %{_sysctldir}/90-ceph-osd.conf -%{_sysconfdir}/sudoers.d/ceph-osd-smartctl %post osd %if 0%{?suse_version} diff --git a/debian/ceph-base.install b/debian/ceph-base.install index 8ee22ebe5bf9..3c31951269f4 100644 --- a/debian/ceph-base.install +++ b/debian/ceph-base.install @@ -20,3 +20,4 @@ usr/share/man/man8/crushtool.8 usr/share/man/man8/monmaptool.8 usr/share/man/man8/osdmaptool.8 usr/share/man/man8/ceph-kvstore-tool.8 +etc/sudoers.d/ceph-smartctl diff --git a/debian/ceph-osd.install b/debian/ceph-osd.install index 3a72447a82c2..0db4460da8ab 100755 --- a/debian/ceph-osd.install +++ b/debian/ceph-osd.install @@ -23,4 +23,3 @@ usr/share/man/man8/ceph-volume-systemd.8 usr/share/man/man8/ceph-osd.8 usr/share/man/man8/ceph-bluestore-tool.8 etc/sysctl.d/30-ceph-osd.conf -etc/sudoers.d/ceph-osd-smartctl diff --git a/debian/control b/debian/control index e5cf55074f62..cb31919afa7c 100644 --- a/debian/control +++ b/debian/control @@ -144,6 +144,8 @@ Recommends: btrfs-tools, libradosstriper1 (= ${binary:Version}), librbd1 (= ${binary:Version}), ntp | time-daemon, + nvme-cli, + smartmontools, Replaces: ceph (<< 10), ceph-common (<< 0.78-500), ceph-test (<< 12.2.2-14), @@ -376,8 +378,6 @@ Depends: ceph-base (= ${binary:Version}), ${shlibs:Depends}, Replaces: ceph (<< 10), ceph-test (<< 12.2.2-14) Breaks: ceph (<< 10), ceph-test (<< 12.2.2-14) -Recommends: nvme-cli, - smartmontools, Description: monitor server for the ceph storage system Ceph is a massively scalable, open-source, distributed storage system that runs on commodity hardware and delivers object, @@ -411,8 +411,6 @@ Depends: ceph-base (= ${binary:Version}), ${shlibs:Depends}, Replaces: ceph (<< 10), ceph-test (<< 12.2.2-14) Breaks: ceph (<< 10), ceph-test (<< 12.2.2-14) -Recommends: nvme-cli, - smartmontools, Description: OSD server for the ceph storage system Ceph is a massively scalable, open-source, distributed storage system that runs on commodity hardware and delivers object, diff --git a/debian/rules b/debian/rules index c8c6f3e80f63..1c215a76e502 100755 --- a/debian/rules +++ b/debian/rules @@ -56,7 +56,7 @@ override_dh_auto_install: install -D -m 644 udev/50-rbd.rules $(DESTDIR)/lib/udev/rules.d/50-rbd.rules install -D -m 644 src/etc-rbdmap $(DESTDIR)/etc/ceph/rbdmap install -D -m 644 etc/sysctl/90-ceph-osd.conf $(DESTDIR)/etc/sysctl.d/30-ceph-osd.conf - install -D -m 440 sudoers.d/ceph-osd-smartctl $(DESTDIR)/etc/sudoers.d/ceph-osd-smartctl + install -D -m 440 sudoers.d/ceph-smartctl $(DESTDIR)/etc/sudoers.d/ceph-smartctl install -D -m 755 src/tools/rbd_nbd/rbd-nbd_quiesce $(DESTDIR)/usr/libexec/rbd-nbd/rbd-nbd_quiesce install -m 755 src/cephadm/cephadm $(DESTDIR)/usr/sbin/cephadm diff --git a/sudoers.d/ceph-osd-smartctl b/sudoers.d/ceph-smartctl similarity index 60% rename from sudoers.d/ceph-osd-smartctl rename to sudoers.d/ceph-smartctl index f53f6af9bc0b..2649cea2b324 100644 --- a/sudoers.d/ceph-osd-smartctl +++ b/sudoers.d/ceph-smartctl @@ -1,4 +1,4 @@ -## allow ceph-osd (which runs as user ceph) to collect device health metrics +## allow ceph daemons (which run as user ceph) to collect device health metrics ceph ALL=NOPASSWD: /usr/sbin/smartctl -x --json=o /dev/* ceph ALL=NOPASSWD: /usr/sbin/nvme * smart-log-add --json /dev/* -- 2.47.3