Browse Source

better implementation of ZFS devices support

2.3.1
obarun 2 years ago
parent
commit
e54933c764
  1. 1
      Makefile
  2. 6
      configure
  3. 17
      module/boot@/configure/configure
  4. 24
      module/boot@/service/system/devices/devices-zfs
  5. 24
      module/boot@/service/system/devices/devices-zfs-import-cache
  6. 22
      module/boot@/service/system/devices/devices-zfs-import-scan
  7. 5
      service/boot@

1
Makefile

@ -70,6 +70,7 @@ $(DESTDIR)$(service_directory)/%: service/%
-e "s,@DMRAID@,$(DMRAID)," \
-e "s,@BTRFS@,$(BTRFS)," \
-e "s,@ZFS@,$(ZFS)," \
-e "s,@ZPOOL@,$(ZPOOL)," \
-e "s,@CRYPTTAB@,$(CRYPTTAB)," \
-e "s,@IPTABLES@,$(IPTABLES)," \
-e "s,@IP6TABLES@,$(IP6TABLES)," \

6
configure vendored

@ -49,6 +49,7 @@ Fine tunning of boot configuration:
--DMRAID=BOOLEAN mount dmraid devices [!no]
--BTRFS=BOOLEAN mount btrfs devices [!no]
--ZFS=BOOLEAN mount zfs devices [!no]
--ZPOOL=VALUE zpool method to import zfs devices [!scan]
--CRYPTTAB=BOOLEAN use crypttab by default [!no]
--IPTABLES=BOOLEAN use iptables by default [!no]
--IP6TABLES=BOOLEAN use ip6tables by default [!no]
@ -163,6 +164,7 @@ LVM='!no'
DMRAID='!no'
BTRFS='!no'
ZFS='!no'
ZPOOL='!scan'
CRYPTTAB='!no'
IPTABLES='!no'
IP6TABLES='!no'
@ -219,6 +221,7 @@ for arg ; do
--DMRAID=*) DMRAID=${arg#*=} ;;
--BTRFS=*) BTRFS=${arg#*=} ;;
--ZFS=*) ZFS=${arg#*=} ;;
--ZPOOL=*) ZPOOL=${arg#*=} ;;
--CRYPTTAB=*) CRYPTTAB=${arg#*=} ;;
--IPTABLES=*) IPTABLES=${arg#*=} ;;
--IP6TABLES=*) IP6TABLES=${arg#*=} ;;
@ -289,7 +292,7 @@ done
for i in HOSTNAME HARDWARECLOCK TZ SETUPCONSOLE TTY \
KEYMAP FONT FONT_MAP FONT_UNIMAP UDEV SYSCTL FORCECHCK LOCAL CONTAINER \
TMPFILE MODULE_KERNEL MODULE_SYSTEM RANDOMSEED \
FSTAB SWAP LVM DMRAID BTRFS ZFS \
FSTAB SWAP LVM DMRAID BTRFS ZFS ZPOOL \
CRYPTTAB IPTABLES IP6TABLES \
CGROUPS MNT_PROC MNT_SYS MNT_DEV MNT_RUN MNT_TMP \
MNT_PTS MNT_SHM MNT_NETFS POPULATE_SYS POPULATE_DEV POPULATE_RUN POPULATE_TMP ; do
@ -362,6 +365,7 @@ $LVM
$DMRAID
$BTRFS
$ZFS
$ZPOOL
$CRYPTTAB
$IPTABLES
$IP6TABLES

17
module/boot@/configure/configure vendored

@ -134,6 +134,12 @@ comment_udev() {
done
}
comment_zfs() {
for sv in "devices-zfs-import-cache" "devices-zfs-import-scan"; do
sv_comment_real "${sv}"
done
}
if [ "${UDEV}" = "no" ]; then
comment_udev
fi
@ -144,6 +150,17 @@ if [ "${CONTAINER}" = "yes" ]; then
done
fi
if [ "${ZFS}" = "yes" ]; then
if [ "${ZPOOL}" = "cache" ]; then
sv_comment_real "devices-zfs-import-scan"
else
# set default to scan
sv_comment_real "devices-zfs-import-cache"
fi
else
comment_zfs
fi
if [ "${LVM}" = "no" ] && \
[ "${DMRAID}" = "no" ] && \
[ "${BTRFS}" = "no" ] && \

24
module/boot@/service/system/devices/devices-zfs

@ -1,24 +1,24 @@
[main]
@type = oneshot
@description = "Mount zfs devices"
@version = @vers@
@description = "Mount ZFS datasets"
@optsdepends = ( devices-zfs-import-scan devices-zfs-import-cache )
@options = ( log env )
@user = ( root )
@depends = ( mount-dev )
@options = ( env )
[start]
@build = auto
@execute =
@execute =
(
execl-envfile ${conf_file}
ifelse -X { s6-test ${ZFS} = yes }
{
if { 66-echo -- [devices-zfs] starts... }
if { 66-yeller -cdp devices-zfs -1 /dev/console starts... }
if -nt {
if { 66-which -q zfs }
if { zpool import -a }
66-echo -- [devices-zfs] started successfully
execl-cmdline -s { zfs mount ${cmd_args} }
}
66-echo -- [devices-zfs] deactivated
66-yeller -fcdp devices-zfs -1 /dev/console crashed!
)
[environment]
conf_file=!@BOOTCONF@
cmd_args=!-a

24
module/boot@/service/system/devices/devices-zfs-import-cache

@ -0,0 +1,24 @@
[main]
@type = oneshot
@version = @vers@
@description = "Import ZFS pools by cache file"
@options = ( log env )
@user = ( root )
[start]
@build = auto
@execute =
(
if { 66-yeller -cdp devices-zfs-import-cache -1 /dev/console starts... }
if -nt {
execl-cmdline -s { zpool import -c ${conf_dir}/${conf_file} ${cmd_args} }
}
66-yeller -fcdp devices-zfs-import-cache -1 /dev/console crashed!
)
[environment]
conf_dir=!/etc/zfs
conf_file=!zpool.cache
cmd_args=!-aN

22
module/boot@/service/system/devices/devices-zfs-import-scan

@ -0,0 +1,22 @@
[main]
@type = oneshot
@version = @vers@
@description = "Import ZFS pools by device scanning"
@options = ( log env )
@user = ( root )
[start]
@build = auto
@execute =
(
if { 66-yeller -cdp devices-zfs-import-scan -1 /dev/console starts... }
if -nt {
execl-cmdline -s { zpool import ${cmd_args} }
}
66-yeller -fcdp devices-zfs-import-scan -1 /dev/console crashed!
)
[environment]
cmd_args=!-aN -o cachefile=none

5
service/boot@

@ -150,6 +150,11 @@
@ZFS@
## Zpool method to import zfs devices [scan|cache]
## It has no effects if ZFS is commented.
@ZPOOL@
#========================== Security ===================================
## Active encrypted devices [yes|no].

Loading…
Cancel
Save