3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2018, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
17 .
$STF_SUITE/include
/libtest.shlib
18 .
$STF_SUITE/tests
/functional
/removal
/removal.kshlib
22 # 'zfs remap' should only work with supported parameters.
25 # 1. Prepare a pool where a top-level VDEV has been removed
26 # 2. Verify every supported parameter to 'zfs remap' is accepted
27 # 3. Verify other unsupported parameters raise an error
30 # The 'zfs remap' command has been disabled and may be removed.
31 export ZFS_REMAP_ENABLED
=YES
33 verify_runnable
"both"
37 destroy_pool
$TESTPOOL
41 log_assert
"'zfs remap' should only work with supported parameters"
47 b
="$TESTPOOL/fs#bmark"
50 typeset goodparams
=("$f" "$v" "$c")
51 typeset badparams
=("-H" "-p" "-?" "$s" "$b" "$f $f" "$f $v" "$f $s")
53 DISK1
="$TEST_BASE_DIR/zfs_remap-1"
54 DISK2
="$TEST_BASE_DIR/zfs_remap-2"
56 # 1. Prepare a pool where a top-level VDEV has been removed
57 log_must truncate
-s $
(($MINVDEVSIZE * 2)) $DISK1
58 log_must zpool create
$TESTPOOL $DISK1
59 log_must zfs create
$f
60 log_must zfs create
-V 1M
-s $v
62 log_must zfs bookmark
$s $b
63 log_must zfs clone
$s $c
64 log_must truncate
-s $
(($MINVDEVSIZE * 2)) $DISK2
65 log_must zpool add
$TESTPOOL $DISK2
66 log_must zpool remove
$TESTPOOL $DISK1
67 log_must wait_for_removal
$TESTPOOL
69 # 2. Verify every supported parameter to 'zfs remap' is accepted
70 for param
in "${goodparams[@]}"
72 log_must zfs remap
$param
75 # 3. Verify other unsupported parameters raise an error
76 for param
in "${badparams[@]}"
78 log_mustnot zfs remap
$param
81 log_pass
"'zfs remap' only works with supported parameters"