5 # This file and its contents are supplied under the terms of the
6 # Common Development and Distribution License ("CDDL"), version 1.0.
7 # You may only use this file in accordance with the terms of version
10 # A full copy of the text of the CDDL should have accompanied this
11 # source. A copy of the CDDL is also available via the Internet at
12 # http://www.illumos.org/license/CDDL.
18 # Copyright (c) 2017 Datto, Inc. All rights reserved.
21 . $STF_SUITE/include/libtest.shlib
25 # 'zpool import' should import a pool with Errata #3 while preventing
26 # the user from performing read write operations
29 # 1. Import a pre-packaged pool with Errata #3
30 # 2. Attempt to write to the effected datasets
31 # 3. Attempt to read from the effected datasets
32 # 4. Attempt to perform a raw send of the effected datasets
33 # 5. Perform a regular send of the datasets under a new encryption root
34 # 6. Verify the new datasets can be read from and written to
35 # 7. Destroy the old effected datasets
36 # 8. Reimport the pool and verify that the errata is no longer present
39 verify_runnable "global"
44 function uncompress_pool
46 log_note "Creating pool from $POOL_FILE"
48 $STF_SUITE/tests/functional/cli_root/zpool_import/blockfiles/$POOL_FILE.bz2 \
49 > /$TESTPOOL/$POOL_FILE
55 poolexists $POOL_NAME && log_must zpool destroy $POOL_NAME
56 [[ -e /$TESTPOOL/$POOL_FILE ]] && rm /$TESTPOOL/$POOL_FILE
61 log_assert "Verify that Errata 3 is properly handled"
64 log_must zpool import -d /$TESTPOOL/ $POOL_NAME
65 log_must eval "zpool status $POOL_NAME | grep -q Errata"
66 log_must eval "zpool status $POOL_NAME | grep -q ZFS-8000-ER"
67 log_must eval "echo 'password' | zfs load-key $POOL_NAME/testfs"
68 log_must eval "echo 'password' | zfs load-key $POOL_NAME/testvol"
70 log_mustnot zfs mount $POOL_NAME/testfs
71 log_must zfs mount -o ro $POOL_NAME/testfs
73 old_mntpnt=$(get_prop mountpoint $POOL_NAME/testfs)
74 log_must eval "ls $old_mntpnt | grep -q testfile"
76 log_mustnot dd if=/dev/zero of=/dev/zvol/$POOL_NAME/testvol bs=512 count=1
77 log_must dd if=/dev/zvol/$POOL_NAME/testvol of=/dev/null bs=512 count=1
78 log_must eval "echo 'password' | zfs create \
79 -o encryption=on -o keyformat=passphrase -o keylocation=prompt \
81 log_mustnot eval "zfs send -w $POOL_NAME/testfs@snap1 | \
82 zfs recv $POOL_NAME/encroot/testfs"
83 log_mustnot eval "zfs send -w $POOL_NAME/testvol@snap1 | \
84 zfs recv $POOL_NAME/encroot/testvol"
86 log_must eval "zfs send $POOL_NAME/testfs@snap1 | \
87 zfs recv $POOL_NAME/encroot/testfs"
88 log_must eval "zfs send $POOL_NAME/testvol@snap1 | \
89 zfs recv $POOL_NAME/encroot/testvol"
91 log_must dd if=/dev/zero of=/dev/zvol/$POOL_NAME/encroot/testvol bs=512 count=1
92 new_mntpnt=$(get_prop mountpoint $POOL_NAME/encroot/testfs)
93 log_must eval "ls $new_mntpnt | grep -q testfile"
94 log_must zfs destroy -r $POOL_NAME/testfs
95 log_must zfs destroy -r $POOL_NAME/testvol
97 log_must zpool export $POOL_NAME
98 log_must zpool import -d /$TESTPOOL/ $POOL_NAME
99 log_mustnot eval "zpool status $POOL_NAME | grep -q Errata"
100 log_mustnot eval "zpool status $POOL_NAME | grep -q ZFS-8000-ER"
101 log_pass "Errata 3 is properly handled"