Skip to content

Commit

Permalink
systemd: add ceph-create-keys@ service
Browse files Browse the repository at this point in the history
Signed-off-by: Sage Weil <[email protected]>
  • Loading branch information
liewegas committed Aug 1, 2015
1 parent e283222 commit 6842a20
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
16 changes: 11 additions & 5 deletions ceph.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -548,17 +548,18 @@ install -D src/rbdmap $RPM_BUILD_ROOT%{_sysconfdir}/ceph/rbdmap
install -m 0644 -D systemd/ceph-rgw.tmpfiles.d $RPM_BUILD_ROOT%{_tmpfilesdir}/%{name}-rgw.conf
install -m 0644 -D systemd/[email protected] $RPM_BUILD_ROOT%{_unitdir}/[email protected]
install -m 0644 -D systemd/[email protected] $RPM_BUILD_ROOT%{_unitdir}/[email protected]
install -m 0644 -D systemd/[email protected] $RPM_BUILD_ROOT%{_unitdir}/[email protected]
install -m 0644 -D systemd/[email protected] $RPM_BUILD_ROOT%{_unitdir}/[email protected]
install -m 0644 -D systemd/[email protected] $RPM_BUILD_ROOT%{_unitdir}/[email protected]
install -m 0644 -D systemd/ceph.target $RPM_BUILD_ROOT%{_unitdir}/ceph.target
%else
install -D src/init-ceph $RPM_BUILD_ROOT%{_initrddir}/ceph
install -D src/init-radosgw $RPM_BUILD_ROOT%{_initrddir}/ceph-radosgw
install -D src/init-rbdmap $RPM_BUILD_ROOT%{_initrddir}/rbdmap
ln -sf ../../etc/init.d/ceph %{buildroot}/%{_sbindir}/rcceph
ln -sf ../../etc/init.d/ceph-radosgw %{buildroot}/%{_sbindir}/rcceph-radosgw
%endif
mkdir -p $RPM_BUILD_ROOT%{_sbindir}
ln -sf ../../etc/init.d/ceph %{buildroot}/%{_sbindir}/rcceph
ln -sf ../../etc/init.d/ceph-radosgw %{buildroot}/%{_sbindir}/rcceph-radosgw
install -m 0644 -D src/logrotate.conf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/ceph
install -m 0644 -D src/rgw/logrotate.conf $RPM_BUILD_ROOT%{_sysconfdir}/logrotate.d/radosgw
chmod 0644 $RPM_BUILD_ROOT%{_docdir}/ceph/sample.ceph.conf
Expand Down Expand Up @@ -637,7 +638,7 @@ mkdir -p %{_localstatedir}/run/ceph/
# /etc/systemd/system. May as well stop them too for completeness
# (although strictly service_del_preun would do that anyway by dint
# of stopping ceph.target)
SERVICE_LIST=$(systemctl | grep -E '^ceph-mon@|^ceph-osd@|^ceph-mds@' | cut -d' ' -f1)
SERVICE_LIST=$(systemctl | grep -E '^ceph-mon@|^ceph-create-keys@|^ceph-osd@|^ceph-mds@' | cut -d' ' -f1)
if [ -n "$SERVICE_LIST" ]; then
for SERVICE in $SERVICE_LIST; do
/usr/bin/systemctl --no-reload disable $SERVICE > /dev/null 2>&1 || :
Expand Down Expand Up @@ -692,14 +693,16 @@ mkdir -p %{_localstatedir}/run/ceph/
%{_bindir}/cephfs-data-scan
%{_bindir}/ceph-debugpack
%{_bindir}/ceph-coverage
%{_initrddir}/ceph
%if 0%{?_with_systemd}
%{_tmpfilesdir}/%{name}.conf
%{_unitdir}/[email protected]
%{_unitdir}/[email protected]
%{_unitdir}/[email protected]
%{_unitdir}/[email protected]
%{_unitdir}/[email protected]
%{_unitdir}/ceph.target
%else
%{_initrddir}/ceph
%endif
%{_sbindir}/ceph-disk
%{_sbindir}/ceph-disk-activate
Expand Down Expand Up @@ -802,7 +805,9 @@ mkdir -p %{_localstatedir}/run/ceph/
%config %{_sysconfdir}/bash_completion.d/rados
%config %{_sysconfdir}/bash_completion.d/rbd
%config(noreplace) %{_sysconfdir}/ceph/rbdmap
%if 0%{?_with_systemd}
%{_initrddir}/rbdmap
%endif
%{python_sitelib}/ceph_argparse.py*
%{python_sitelib}/ceph_daemon.py*
%{_udevrulesdir}/50-rbd.rules
Expand Down Expand Up @@ -834,7 +839,6 @@ fi
#################################################################################
%files radosgw
%defattr(-,root,root,-)
%{_initrddir}/ceph-radosgw
%{_bindir}/radosgw
%{_bindir}/radosgw-admin
%{_mandir}/man8/radosgw.8*
Expand All @@ -846,6 +850,8 @@ fi
%dir %{_localstatedir}/lib/ceph/radosgw
%if 0%{?_with_systemd}
%{_tmpfilesdir}/%{name}-rgw.conf
%else
%{_initrddir}/ceph-radosgw
%endif

%post radosgw
Expand Down
1 change: 1 addition & 0 deletions systemd/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ unitfiles = \
ceph.target \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected]

Expand Down
10 changes: 10 additions & 0 deletions systemd/[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[Unit]
Description=Ceph cluster key creator task

# the last key created is the mds bootstrap key -- look for that.
ConditionPathExists=!/var/lib/ceph/bootstrap-mds/ceph.keyring

[Service]
EnvironmentFile=-/etc/sysconfig/ceph
Environment=CLUSTER=ceph
ExecStart=/usr/sbin/ceph-create-keys --cluster ${CLUSTER} --id %i
7 changes: 3 additions & 4 deletions systemd/[email protected]
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
[Unit]
Description=Ceph cluster monitor daemon
After=network-online.target
Wants=network-online.target

# According to:
# http://www.freedesktop.org/wiki/Software/systemd/NetworkTarget
# these can be removed once ceph-mon will dynamically change network
# configuration.
After=network-online.target local-fs.target
Wants=network-online.target local-fs.target
After=network-online.target local-fs.target ceph-create-keys@%i.service
Wants=network-online.target local-fs.target ceph-create-keys@%i.service

PartOf=ceph.target

[Service]
Expand Down

0 comments on commit 6842a20

Please sign in to comment.