5 # The contents of this file are subject to the terms of the
6 # Common Development and Distribution License (the "License").
7 # You may not use this file except in compliance with the License.
9 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 # or http://www.opensolaris.org/os/licensing.
11 # See the License for the specific language governing permissions
12 # and limitations under the License.
14 # When distributing Covered Code, include this CDDL HEADER in each
15 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 # If applicable, add the following below this CDDL HEADER, with the
17 # fields enclosed by brackets "[]" replaced with your own identifying
18 # information: Portions Copyright [yyyy] [name of copyright owner]
24 # Copyright (c) 2012, 2016 by Delphix. All rights reserved.
27 . $STF_SUITE/include/libtest.shlib
28 . $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg
30 #################################################################################
32 # Pool can be imported with active read-only compatible features. If a feature
33 # is read-only compatible but also inactive its property status should be
34 # "inactive" rather than "readonly".
37 # 2. Export and inject variety of unsupported features.
38 # 3. Try to import read-write, this should fail. The error should only list
39 # the active read-only compatible feature and mention "readonly=on".
40 # 4. Import the pool in read-only mode.
41 # 5. Verify values of unsupported@ properties.
43 ################################################################################
45 verify_runnable "global"
47 enabled_features="com.test:xxx_unsup0 com.test:xxx_unsup2"
48 active_features="com.test:xxx_unsup1 com.test:xxx_unsup3"
52 poolexists $TESTPOOL1 && destroy_pool $TESTPOOL1
55 log_must mkfile $FILE_SIZE $VDEV0
58 log_assert "Pool with active read-only compatible features can be imported."
61 log_must zpool create $TESTPOOL1 $VDEV0
62 log_must zpool export $TESTPOOL1
64 for feature in $enabled_features $active_features; do
65 log_must zhack -d $DEVICE_DIR feature enable -r $TESTPOOL1 $feature
68 for feature in $active_features; do
69 log_must zhack -d $DEVICE_DIR feature ref $TESTPOOL1 $feature
72 log_mustnot zpool import -d $DEVICE_DIR $TESTPOOL1
74 # error message should mention "readonly"
75 log_must eval "zpool import -d $DEVICE_DIR $TESTPOOL1 | grep readonly"
76 log_mustnot poolexists $TESTPOOL1
78 for feature in $enabled_features; do
79 log_mustnot eval "zpool import -d $DEVICE_DIR $TESTPOOL1 \
81 log_mustnot poolexists $TESTPOOL1
84 for feature in $active_features; do
85 log_must eval "zpool import -d $DEVICE_DIR $TESTPOOL1 \
87 log_mustnot poolexists $TESTPOOL1
90 log_must zpool import -o readonly=on -d $DEVICE_DIR $TESTPOOL1
92 for feature in $enabled_features; do
93 state=$(zpool list -Ho unsupported@$feature $TESTPOOL1)
94 if [[ "$state" != "inactive" ]]; then
95 log_fail "unsupported@$feature is '$state'"
99 for feature in $active_features; do
100 state=$(zpool list -Ho unsupported@$feature $TESTPOOL1)
101 if [[ "$state" != "readonly" ]]; then
102 log_fail "unsupported@$feature is '$state'"