diff options
author | Ralf Ertzinger <[email protected]> | 2014-01-19 15:36:49 +0100 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-02-05 12:25:30 -0800 |
commit | 881f45c6a8f44486f76c4713ecef0d533d6601e8 (patch) | |
tree | c16967ad7be5fc917b7052a23fbc8020bf07cafd /config | |
parent | c5cb66addcb947ae8843c40c6db134ccd821adb7 (diff) |
Add systemd unit files for ZFS startup
This adds systemd unit files replacing the functionality offered by
the SysV init script found in etc/init.d.
It has been developed and tested on Fedora 19, Fedora 20
and openSuSE 13.1.
Four unit files and one target are offered.
zfs-import-cache.service:
Import pools from /etc/zfs/zpool.cache. This unit will wait for
udev to settle.
zfs-import-scan.service:
Import pools by scanning /dev/disk/by-id for zvols. This unit will
only run if /etc/zfs/zpool.cache is not present. This unit will wait
for udev to settle
zfs-mount.service:
Mount ZFS native filesystems. It contains a dependency to be loaded
before local-fs.target.
zfs-share.service:
Share NFS/SMB filesystems. This unit contains a dependency that
will cause it to be restarted whenever the smb or nfs-server unit
is restarted, restoring the shares added.
zfs.target:
This target pulls in the other units in order to start ZFS. It's
the only unit that can be enabled/disabled, all other services
are static and pulled in by dependencies. It will honour zfs=off
and zfs=no options on the kernel command line.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2108
Diffstat (limited to 'config')
-rw-r--r-- | config/user-systemd.m4 | 29 | ||||
-rw-r--r-- | config/user-sysvinit.m4 | 11 | ||||
-rw-r--r-- | config/user.m4 | 2 |
3 files changed, 42 insertions, 0 deletions
diff --git a/config/user-systemd.m4 b/config/user-systemd.m4 new file mode 100644 index 000000000..5988945b4 --- /dev/null +++ b/config/user-systemd.m4 @@ -0,0 +1,29 @@ +AC_DEFUN([ZFS_AC_CONFIG_USER_SYSTEMD], [ + AC_ARG_ENABLE(systemd, + AC_HELP_STRING([--enable-systemd], + [install systemd unit/preset files [[default: yes]]]), + [],enable_systemd=yes) + + AC_ARG_WITH(systemdunitdir, + AC_HELP_STRING([--with-systemdunitdir=DIR], + [install systemd unit files in dir [[/usr/lib/systemd/system]]]), + systemdunitdir=$withval,systemdunitdir=/usr/lib/systemd/system) + + AC_ARG_WITH(systemdpresetdir, + AC_HELP_STRING([--with-systemdpresetdir=DIR], + [install systemd preset files in dir [[/usr/lib/systemd/system-preset]]]), + systemdpresetdir=$withval,systemdpresetdir=/usr/lib/systemd/system-preset) + + AS_IF([test "x$enable_systemd" = xyes], + [ + ZFS_INIT_SYSTEMD=systemd + ZFS_MODULE_LOAD=modules-load.d + modulesloaddir=/usr/lib/modules-load.d + ]) + + AC_SUBST(ZFS_INIT_SYSTEMD) + AC_SUBST(ZFS_MODULE_LOAD) + AC_SUBST(systemdunitdir) + AC_SUBST(systemdpresetdir) + AC_SUBST(modulesloaddir) +]) diff --git a/config/user-sysvinit.m4 b/config/user-sysvinit.m4 new file mode 100644 index 000000000..65dcc3819 --- /dev/null +++ b/config/user-sysvinit.m4 @@ -0,0 +1,11 @@ +AC_DEFUN([ZFS_AC_CONFIG_USER_SYSVINIT], [ + AC_ARG_ENABLE(sysvinit, + AC_HELP_STRING([--enable-sysvinit], + [install SysV init scripts [default: yes]]), + [],enable_sysvinit=yes) + + AS_IF([test "x$enable_sysvinit" = xyes], + [ZFS_INIT_SYSV=init.d]) + + AC_SUBST(ZFS_INIT_SYSV) +]) diff --git a/config/user.m4 b/config/user.m4 index 4f9963787..da1cdea33 100644 --- a/config/user.m4 +++ b/config/user.m4 @@ -3,6 +3,8 @@ dnl # Default ZFS user configuration dnl # AC_DEFUN([ZFS_AC_CONFIG_USER], [ ZFS_AC_CONFIG_USER_UDEV + ZFS_AC_CONFIG_USER_SYSTEMD + ZFS_AC_CONFIG_USER_SYSVINIT ZFS_AC_CONFIG_USER_DRACUT ZFS_AC_CONFIG_USER_ARCH ZFS_AC_CONFIG_USER_IOCTL |