Authored by: Toomas Soome <tsoome@me.com>
Reviewed by: Igor Kozhukhov <igor@dilos.org>
Reviewed by: Marcel Telka <marcel@telka.sk>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Reviewed-by: George Melikov <mail@gmelikov.ru>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Porting Notes:
- Removed gzip and zle compression restriction on bootfs
datasets. Grub added support for these long ago. Ay
version of grub which understands lz4 also supports this.
- Enabled rootpool tests in runfile but skipped by default
in setup on Linux since they modify the rootpool.
- bootfs_006_pos.ksh, striped pools are allowed as bootfs.
OpenZFS-issue: https://www.illumos.org/issues/7404
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/
55a424c
Closes #5982
#define BOOTFS_COMPRESS_VALID(compress) \
((compress) == ZIO_COMPRESS_LZJB || \
(compress) == ZIO_COMPRESS_LZ4 || \
+ (compress) == ZIO_COMPRESS_GZIP_1 || \
+ (compress) == ZIO_COMPRESS_GZIP_2 || \
+ (compress) == ZIO_COMPRESS_GZIP_3 || \
+ (compress) == ZIO_COMPRESS_GZIP_4 || \
+ (compress) == ZIO_COMPRESS_GZIP_5 || \
+ (compress) == ZIO_COMPRESS_GZIP_6 || \
+ (compress) == ZIO_COMPRESS_GZIP_7 || \
+ (compress) == ZIO_COMPRESS_GZIP_8 || \
+ (compress) == ZIO_COMPRESS_GZIP_9 || \
+ (compress) == ZIO_COMPRESS_ZLE || \
(compress) == ZIO_COMPRESS_ON || \
(compress) == ZIO_COMPRESS_OFF)
[tests/functional/atime]
tests = ['atime_001_pos', 'atime_002_neg', 'atime_003_pos']
-# DISABLED:
-# bootfs_006_pos - needs investigation
-# bootfs_008_neg - needs investigation
[tests/functional/bootfs]
tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos',
- 'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_007_neg']
+ 'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos',
+ 'bootfs_008_pos']
# DISABLED:
# cache_001_pos - needs investigation
'reservation_013_pos', 'reservation_014_pos', 'reservation_015_pos',
'reservation_016_pos', 'reservation_017_pos']
-# DISABLED: Root pools must be handled differently under Linux
-#[tests/functional/rootpool]
-#tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_neg']
+[tests/functional/rootpool]
+tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos']
# DISABLED:
# rsend_008_pos - Fails for OpenZFS on illumos
function get_rootfs
{
typeset rootfs=""
- rootfs=$(awk '{if ($2 == "/" && $3 == "zfs") print $1}' \
- /etc/mnttab)
+
+ if ! is_linux; then
+ rootfs=$(awk '{if ($2 == "/" && $3 == "zfs") print $1}' \
+ /etc/mnttab)
+ fi
if [[ -z "$rootfs" ]]; then
log_fail "Can not get rootfs"
fi
{
typeset rootfs=""
typeset rootpool=""
- rootfs=$(awk '{if ($2 == "/" && $3 =="zfs") print $1}' \
- /etc/mnttab)
+
+ if ! is_linux; then
+ rootfs=$(awk '{if ($2 == "/" && $3 =="zfs") print $1}' \
+ /etc/mnttab)
+ fi
if [[ -z "$rootfs" ]]; then
log_fail "Can not get rootpool"
fi
bootfs_004_neg.ksh \
bootfs_005_neg.ksh \
bootfs_006_pos.ksh \
- bootfs_007_neg.ksh \
- bootfs_008_neg.ksh
+ bootfs_007_pos.ksh \
+ bootfs_008_pos.ksh
log_must zpool create $TESTPOOL mirror $VDEV1 $VDEV2 spare $VDEV3
verify_bootfs $TESTPOOL
-## the following configurations are not supported as bootable pools
-
-# stripe
-log_must zpool create $TESTPOOL $VDEV1 $VDEV2
-verify_no_bootfs $TESTPOOL
-
-# stripe + hotspare
-log_must zpool create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
-verify_no_bootfs $TESTPOOL
+if is_linux; then
+ # stripe
+ log_must zpool create $TESTPOOL $VDEV1 $VDEV2
+ verify_bootfs $TESTPOOL
+
+ # stripe + hotspare
+ log_must zpool create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
+ verify_bootfs $TESTPOOL
+else
+ ## the following configurations are not supported as bootable pools
+
+ # stripe
+ log_must zpool create $TESTPOOL $VDEV1 $VDEV2
+ verify_no_bootfs $TESTPOOL
+
+ # stripe + hotspare
+ log_must zpool create $TESTPOOL $VDEV1 $VDEV2 spare $VDEV3
+ verify_no_bootfs $TESTPOOL
+fi
# raidz
log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2
-verify_no_bootfs $TESTPOOL
+verify_bootfs $TESTPOOL
# raidz + hotspare
log_must zpool create $TESTPOOL raidz $VDEV1 $VDEV2 spare $VDEV3
-verify_no_bootfs $TESTPOOL
+verify_bootfs $TESTPOOL
# raidz2
log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3
-verify_no_bootfs $TESTPOOL
+verify_bootfs $TESTPOOL
# raidz2 + hotspare
log_must zpool create $TESTPOOL raidz2 $VDEV1 $VDEV2 $VDEV3 spare $VDEV4
-verify_no_bootfs $TESTPOOL
+verify_bootfs $TESTPOOL
log_pass "Pools of correct vdev types accept boot property"
+++ /dev/null
-#!/bin/ksh -p
-#
-# CDDL HEADER START
-#
-# The contents of this file are subject to the terms of the
-# Common Development and Distribution License (the "License").
-# You may not use this file except in compliance with the License.
-#
-# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
-# or http://www.opensolaris.org/os/licensing.
-# See the License for the specific language governing permissions
-# and limitations under the License.
-#
-# When distributing Covered Code, include this CDDL HEADER in each
-# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
-# If applicable, add the following below this CDDL HEADER, with the
-# fields enclosed by brackets "[]" replaced with your own identifying
-# information: Portions Copyright [yyyy] [name of copyright owner]
-#
-# CDDL HEADER END
-#
-
-#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
-#
-
-#
-# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
-#
-
-. $STF_SUITE/include/libtest.shlib
-
-#
-# DESCRIPTION:
-#
-# Setting bootfs on a pool which was configured with the whole disk
-# (i.e. EFI) will fail
-#
-# STRATEGY:
-# 1. create a pool with a whole disk
-# 2. create a filesystem on this pool
-# 3. verify we can not set bootfs on the filesystem we just created.
-#
-
-verify_runnable "global"
-
-function cleanup {
- if poolexists $TESTPOOL ; then
- destroy_pool "$TESTPOOL"
- fi
-}
-
-log_onexit cleanup
-
-DISK=${DISKS%% *}
-typeset EFI_BOOTFS=$TESTPOOL/efs
-typeset assert_mesg="setting bootfs on a pool which was configured with the \
- whole disk will fail"
-
-log_assert $assert_mesg
-create_pool "$TESTPOOL" "$DISK"
-log_must zfs create $EFI_BOOTFS
-
-if is_linux; then
- log_must zpool set bootfs=$EFI_BOOTFS $TESTPOOL
-else
- log_mustnot zpool set bootfs=$EFI_BOOTFS $TESTPOOL
-fi
-
-log_pass $assert_mesg
#
# DESCRIPTION:
#
-# setting bootfs on a dataset which has gzip compression enabled will fail
+# setting bootfs on a dataset which has gzip compression enabled will not fail
#
# STRATEGY:
# 1. create pools based on a valid vdev
-# 2. create a filesystem on this pool and set the compression property to gzip1-9
+# 2. create a filesystem on this pool, set the compression property to gzip1-9
# 3. set the pool's bootfs property to filesystem we just configured which
-# should fail
+# should not fail
#
verify_runnable "global"
}
typeset assert_msg="setting bootfs on a dataset which has gzip \
- compression enabled will fail"
+ compression enabled will not fail"
-typeset VDEV=$TESTDIR/bootfs_008_neg_a.$$.dat
+typeset VDEV=$TEST_BASE_DIR/bootfs_008_pos_a.$$.dat
typeset COMP_FS=$TESTPOOL/COMP_FS
log_onexit cleanup
while (( i < ${#gtype[@]} )); do
log_must zfs set compression=${gtype[i]} $COMP_FS
- log_mustnot zpool set bootfs=$COMP_FS $TESTPOOL
+ log_must zpool set bootfs=$COMP_FS $TESTPOOL
log_must zfs set compression=off $COMP_FS
(( i += 1 ))
done
cleanup.ksh \
rootpool_002_neg.ksh \
rootpool_003_neg.ksh \
- rootpool_007_neg.ksh
+ rootpool_007_pos.ksh
#
# DESCRIPTION:
#
-# the zfs rootfilesystem's compression property can not set to gzip[1-9]
+# the zfs rootfilesystem's compression property can be set to gzip[1-9]
#
# STRATEGY:
# 1) check if the current system is installed as zfs root
# 2) get the rootfs
-# 3) set the rootfs's compression to gzip 1-9 which should fail.
+# 3) set the rootfs's compression to gzip 1-9 which should not fail.
#
verify_runnable "global"
typeset rootfs=$(get_pool_prop bootfs $rootpool)
typeset orig_compress=$(get_prop compression $rootfs)
-typeset assert_msg="the zfs rootfs's compression property can not set to \
+typeset assert_msg="the zfs rootfs's compression property can be set to \
gzip and gzip[1-9]"
set -A gtype "gzip" "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" \
typeset -i i=0
while (( i < ${#gtype[@]} )); do
- log_mustnot zfs set compression=${gtype[i]} $rootfs
+ log_must zfs set compression=${gtype[i]} $rootfs
(( i += 1 ))
done
. $STF_SUITE/include/libtest.shlib
verify_runnable "global"
+
+#
+# This functionality is supported under Linux, but these test cases
+# are disabled by default since they manipulate the systems root pool.
+#
+if is_linux; then
+ log_unsupported "Supported but disabled by default"
+fi