[systemd-devel] [RFC] iscsid / systemd / dracut integration effort

"Jóhann B. Guðmundsson" johannbg at gmail.com
Mon Dec 10 15:56:07 PST 2012


On 12/10/2012 10:08 PM, Chris Leech wrote:
> Sorry about the cross-posting, but I think that in order to get this right I'm
> going to need as much feedback as I can get.
>
> I think I've got this working pretty well now (at least for my iBFT configured
> iSCSI root test case), although the dracut module still needs work.  This is
> based on the iscsid socket activation patch from Tomasz Torcz and the unit
> files from Tomasz and Jóhann B. Guðmundsson.
>
> Attempting to start iscsid using systemd unit files (socket activated or not)
> was impacting my iscsi-root test setup.  Rather than try to preserve the old
> logic that used the _netdev mount flag to determine when iscsid could be safely
> shutdown, I've been working on following the guidelines for root storage
> daemons http://www.freedesktop.org/wiki/Software/systemd/RootStorageDaemons.
>
> 1) I patched iscsid to set argv[0][0] = '@' if a new --initrd flag is passed on
>     the command line.  It's simple, it works, we don't kill iscsid before the
>     root filesystem is unmounted.
>
> 2) When starting iscsid from the initrd, I then ran into issues of iscsid not
>     functioning properly after the switch_root.  It's not mentioned in the
>     RootStorageDaemons documentation, but if a process left running from the
>     initrd needs further filesystem access at runtime it will need to be able to
>     chroot itself before the switch_root.  I patched iscsid and iscsiadm with a
>     newroot command (using plymouth as an example), and used a dracut clenaup
>     hook to call "iscsiadm --newroot /sysroot".
>
> 3) Related to #2, launching iscsid as a Type=simple service from the initrd
>     (I'm testing this with Fedora 18 beta, where dracut uses systemd in the
>     initrd) results in STDOUT/STDERR access after the switch_root failing with
>     EPIPE.  It seems that the connection to the journal process is dead once the
>     initrd instantiated systemd-journald is replaced with the runtime process.
>
>     I can at least keep iscsid functioning if I run it as Type=forking, but I'm
>     not sure if I'm losing runtime logging or not.  I may be able to do
>     something with the StandardOutput and StandardError options in the service
>     file.

You should be using Type=forking here

>
> 4) None of this helps if the sessions are shutdown when we still need them.
>     Rather than the all-or-nothing _netdev mount option checks that have been
>     used in the past, I'm attempting to use the fact that iscsiadm will skip
>     over session that match a node with startup=onboot set when doing a
>     logoutall.  The iscsi_mark_root_nodes script is borrowed from the SUSE init
>     scripts in the open-iscsi repos written by Hannes Reinecke.  I've made minor
>     changes to export the list of sessions activated in the initramfs, and then
>     mark those as onboot when starting iscsi.service.
>
> Things that still need looking into.
>
> 1) Command line configured iSCSI parameters.  If iscsistart is to be fully
>     removed something needs to setup the node from the command line.  Or
>     iscsistart needs to be able to run alongside iscsid.
>
> 2) Proper ordering of the iscsi.service for non-root filesystems.
>
> Any and all feedback and/or help welcome.
>

Looking the unit file for iscsid I do believe I missed this ( basically 
the same as multipath unit ) since you know it's early boot special, 
root and all that ;)

[Unit]

# Before or After lvm2-activation-early.service
DefaultDependencies=no
Conflicts=shutdown.target

[Install]
WantedBy=sysinit.target

JBG


More information about the systemd-devel mailing list