Re: [HEADS-UP] systemd for F14 - the next steps

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 07/14/2010 03:24 AM, Lennart Poettering wrote:
> Heya,
>

<snip snip>

> b) if you maintain a package which includes a daemon/service from
> outside the default install, it would be awesome if you could ship
> native unit files too, even though I don't have any ready for
> you. Writing unit files is not difficult

I'm involved in maintaining the initscripts for iscsi-intiator-utils.
I'm not sure if iscsi-intiator-utils is part of the default install,
but lots of people have it installed as libvirt requires it.

iscsi-initiator-utils comes with 2 initscripts. 1 to start iscsid and
1 to login to iscsi nodes configured in the iscsi database
(/var/lib/iscsi):
http://cvs.fedoraproject.org/viewvc/devel/iscsi-initiator-utils/iscsid.init?view=markup
http://cvs.fedoraproject.org/viewvc/devel/iscsi-initiator-utils/iscsidevs.init?view=markup

iscsid is a semi-regular daemon, yet its initscript is special as it
only starts iscsid when needed. Socket based activation is out of the question as iscsid
is a userspace kernel support daemon. Which needs to be started ASAP,
so that it is ready to do error recovery when the kernel needs it.

However we do not want to always start it, only when iscsi targets are in use.
So the bash iscsid script has this "beauty" :

# FIXME this has a false positive for root on nfs
root_is_iscsi() {
     rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' /etc/mtab)
     [[ "$rootopts" =~ "_netdev" ]]
}

force_start() {
     echo -n $"Starting $prog: "
     modprobe -q iscsi_tcp
     modprobe -q ib_iser
     modprobe -q cxgb3i
     modprobe -q bnx2i
     modprobe -q be2iscsi
     daemon $prog
     retval=$?
     echo
     [ $retval -eq 0 ] && touch $lockfile
     return $retval
}

use_discoveryd() {
     grep -qrs "discovery.sendtargets.use_discoveryd = Yes" /var/lib/iscsi/send_targets
     if [ $? -eq 0 ] ; then
  	return 0
     fi

     grep -qrs "discovery.isns.use_discoveryd = Yes" /var/lib/iscsi/isns
     if [ $? -eq 0 ] ; then
  	return 0
     fi

     return 1
}

start() {
     [ -x $exec ] || exit 5
     [ -f $config ] || exit 6

     # only start if nodes are setup to startup automatically, root is iscsi,
     # or if iscsid is managing the sessions.
     grep -qrs "node.startup = automatic" /var/lib/iscsi/nodes
     if [ $? -eq 0 ] || root_is_iscsi || use_discoveryd ; then
         force_start
         return $?
     fi

     return 0
}

And the iscsi (note no d) script has similar (albeit simpler) magic
to decide if it should try to login to any nodes.

So the question is how to deal with stuff like this in systemd.
I'm thinking myself that maybe the solution here is to just keep
using systemv style initscripts here, but I'm not sure.

Thanks & Regards,

Hans
-- 
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/devel


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]
  Powered by Linux