]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
systemd: add ceph-create-keys@ service
authorSage Weil <sage@redhat.com>
Wed, 29 Jul 2015 19:10:36 +0000 (15:10 -0400)
committerSage Weil <sage@redhat.com>
Sat, 1 Aug 2015 13:58:33 +0000 (09:58 -0400)
Signed-off-by: Sage Weil <sage@redhat.com>
ceph.spec.in
systemd/Makefile.am
systemd/ceph-create-keys@.service [new file with mode: 0644]
systemd/ceph-mon@.service

index 5090ebc66960f3b4487d073b56912642e9d0698e..9fb780a8971ee9227fbcaa7b9c5653a711327f6c 100644 (file)
@@ -548,6 +548,7 @@ 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/ceph-osd@.service $RPM_BUILD_ROOT%{_unitdir}/ceph-osd@.service
   install -m 0644 -D systemd/ceph-mon@.service $RPM_BUILD_ROOT%{_unitdir}/ceph-mon@.service
+  install -m 0644 -D systemd/ceph-create-keys@.service $RPM_BUILD_ROOT%{_unitdir}/ceph-create-keys@.service
   install -m 0644 -D systemd/ceph-mds@.service $RPM_BUILD_ROOT%{_unitdir}/ceph-mds@.service
   install -m 0644 -D systemd/ceph-radosgw@.service $RPM_BUILD_ROOT%{_unitdir}/ceph-radosgw@.service
   install -m 0644 -D systemd/ceph.target $RPM_BUILD_ROOT%{_unitdir}/ceph.target
@@ -555,10 +556,10 @@ install -D src/rbdmap $RPM_BUILD_ROOT%{_sysconfdir}/ceph/rbdmap
   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
@@ -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 || :
@@ -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}/ceph-mds@.service
 %{_unitdir}/ceph-mon@.service
+%{_unitdir}/ceph-create-keys@.service
 %{_unitdir}/ceph-osd@.service
 %{_unitdir}/ceph-radosgw@.service
 %{_unitdir}/ceph.target
+%else
+%{_initrddir}/ceph
 %endif
 %{_sbindir}/ceph-disk
 %{_sbindir}/ceph-disk-activate
@@ -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
@@ -834,7 +839,6 @@ fi
 #################################################################################
 %files radosgw
 %defattr(-,root,root,-)
-%{_initrddir}/ceph-radosgw
 %{_bindir}/radosgw
 %{_bindir}/radosgw-admin
 %{_mandir}/man8/radosgw.8*
@@ -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
index 8c7c12811ffd948a20076cff9423c26c337f2234..efe7245c9ce56cce76b464c8d17b074148547eb6 100644 (file)
@@ -2,6 +2,7 @@ unitfiles = \
        ceph.target \
        ceph-mds@.service \
        ceph-mon@.service \
+       ceph-create-keys@.service \
        ceph-osd@.service \
        ceph-radosgw@.service
 
diff --git a/systemd/ceph-create-keys@.service b/systemd/ceph-create-keys@.service
new file mode 100644 (file)
index 0000000..781e6b8
--- /dev/null
@@ -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
index 421897dc0d0dac7438f87e71db12ac65f1c070aa..2e884507e8e9bea512ebc7603490bae529944036 100644 (file)
@@ -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]