A recent patch submission by Christian Hesse to supply an "iscsi login 
service"
for systemd spurred me to share the systemd files currently being used by
SUSE, since these may help others (like Christian).

In the open-iscsi repository, there are only two systemd files:

iscsid.socket -- the socket-activiation service for iscsid
iscsid.service -- how to start/stop iscsid

Our iscsid.service file is slightly different from what is in the 
open-iscsi repository,
so here is a context diff:

-------------------->> cut here <<-------------------------------
[Unit]
Description=Open-iSCSI
Documentation=man:iscsid(8) man:iscsiuio(8) man:iscsiadm(8)
DefaultDependencies=no
After=network.target iscsiuio.service
Before=remote-fs-pre.target

[Service]
Type=simple
ExecStart=/sbin/iscsid -f
ExecStop=/sbin/iscsiadm -k 0 2

[Install]
WantedBy=multi-user.target
Also=iscsid.socket
-------------------->> cut here <<-------------------------------

Differences from current repository file:

- Service type changed to simple, as it's more reliable
- our daemon is in /sbin instead of /usr/sbin
- specifically mention the socket file
- several changes to support iSCSI volumes at boot time:
- no default dependencies (or it starts too late)
- don't need all of the "After*"s
- add a "Before*"

Perhaps some of these would be generally useful? And I expect
that the RedHat version is slightly different. Anyone interested in
posting it, so we might come up with a common solution, as much
as possible?

Note: we also enable, by default, the iscsid.socket service, so that
iscsid can be started any time after installation simply by trying
to access it.

Next, our distro has a service file for iscsi login/logout service. We
called it "iscsi.service", and here's the whole service file:

-------------------->> cut here <<-------------------------------
[Unit]
Description=Login and scanning of iSCSI devices
Documentation=man:iscsiadm(8) man:iscsid(8)
After=network.target network-online.target iscsid.service
ConditionPathExists=/etc/iscsi/initiatorname.iscsi

[Service]
Type=oneshot
ExecStart=-/sbin/iscsiadm -m node --loginall=automatic
ExecStop=/sbin/iscsiadm -m node --logoutall=automatic
SuccessExitStatus=21
RemainAfterExit=true

[Install]
WantedBy=remote-fs.target
-------------------->> cut here <<-------------------------------

You can see there are some differences from the patch proposed by Christian
recently:
- you do not need to say "after" iscsid.socket
- after network target, since we need it running and online
- no need to start if there is no initiator name
- make the "start" ignore errors, else the service thinks it is not running
  if there are no targets at startup time, even if they've been added
- ignore a return status of 21, which just means not all target logins
  worked
- remain after started, so the service thinks it is running even
  after the one shot

And, lastly, we also have two service files for iscsiuio. Here is 
iscsiuio.socket:
-------------------->> cut here <<-------------------------------
[Unit]
Description=Open-iSCSI iscsiuio Socket
Documentation=man:iscsiuio(8)

[Socket]
ListenStream=@ISCSID_UIP_ABSTRACT_NAMESPACE

[Install]
WantedBy=sockets.target
-------------------->> cut here <<-------------------------------

And iscsiuio.service:
-------------------->> cut here <<-------------------------------
[Unit]
Description=iSCSI UserSpace I/O driver
Documentation=man:iscsiuio(8)
DefaultDependencies=no
Conflicts=shutdown.target
Requires=iscsid.service
BindTo=iscsid.service
After=network.target
Before=remote-fs-pre.target iscsid.service

[Service]
Type=forking
PIDFile=/var/run/iscsiuio.pid
ExecStart=/sbin/iscsiuio

[Install]
WantedBy=multi-user.target
-------------------->> cut here <<-------------------------------

Note that the iscsiuio service has not gotten nearly as much testing and 
tweaking
as the iscsid and iscsi files have, so YMMV. But these are what we currently
have.

I will be glad to supply some or all of these changes as patches, if there 
is interest.
Of course there was a small change in the iscsiuio daemon, as well, to 
support socket
activation, which is another patch I'd be glad to supply if needed.


-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at http://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to