Robert LeBlanc <rob...@leblancnet.us> wrote:

> Systemd is supposed to still use the init.d scripts if they are
> present, however I've run into problems with it on my CentOS 7
> boxes. The biggest issue is that systemd does not like having multiple
> arguments to the scripts. There is a systemd directory in the Master
> branch that does work, but you have to register each osd individually
> with systemd (as a separate service), so it is not quite as nice as
> the initV scripts yet. I'm sure that it is being worked on as almost
> all distros are moving to systemd soon.
> 
> For now, I've just created entries for each OSD in /etc/fstab and then
> put 'for mount in `ls /var/lib/ceph/osd/`; do ceph-osd -i
> ${mount#ceph-}; done' in /etc/rc.local. It's a hack, but we are still
> just playing with Ceph for now.

We use udev-based activation with systemd, with the only drawback being that 
OSD services are identified by device name instead of ID. I've been meaning to 
do something about that some day...

[root@pakhet ~]# cat /etc/udev/rules.d/95-ceph-osd.rules
ACTION=="add", \
  SUBSYSTEM=="block", \
  ENV{DEVTYPE}=="partition", \
  ENV{ID_PART_ENTRY_TYPE}=="4fbd7e29-9d25-41b8-afd0-062c0ceff05d", \
  TAG+="systemd", \
  ENV{SYSTEMD_WANTS}="ceph-osd@$devnode.service"
[root@pakhet ~]# cat /etc/systemd/system/ceph-osd@.service
[Unit]
Description=Ceph OSD for %I

[Service]
Restart=always
Type=forking
ExecStart=/usr/sbin/ceph-disk activate %I
ExecStopPost=/usr/bin/umount %I

[Install]
WantedBy=ceph.target
[root@pakhet ~]# systemctl list-units -t service | grep "^ceph"
ceph-mon@pakhet.service              loaded active running Ceph mon.pakhet
ceph-osd@-dev-sdb1.service           loaded active running Ceph OSD for 
/dev/sdb1
ceph-osd@-dev-sdc1.service           loaded active running Ceph OSD for 
/dev/sdc1
ceph-osd@-dev-sdd1.service           loaded active running Ceph OSD for 
/dev/sdd1
ceph-osd@-dev-sde1.service           loaded active running Ceph OSD for 
/dev/sde1
ceph-osd@-dev-sdf1.service           loaded active running Ceph OSD for 
/dev/sdf1

Only ceph.target, which pulls in ceph-mon@<hostname> using WantedBy, is enabled 
in systemd.

-- 
 Carl-Johan Schenström
 Driftansvarig / System Administrator
 Språkbanken & Svensk nationell datatjänst /
 The Swedish Language Bank & Swedish National Data Service
 Göteborgs universitet / University of Gothenburg
 carl-johan.schenst...@gu.se / +46 709 116769
_______________________________________________
ceph-users mailing list
ceph-users@lists.ceph.com
http://lists.ceph.com/listinfo.cgi/ceph-users-ceph.com

Reply via email to