]>
git.proxmox.com Git - mirror_zfs.git/blob - tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_encryption.ksh
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
21 # 'zpool split' should be able to split encrypted pools
24 # 1. Create an encrypted pool
25 # 2. Split and re-import the pool, verify altroot is mounted.
28 verify_runnable
"both"
32 destroy_pool
$TESTPOOL
33 destroy_pool
$TESTPOOL2
34 rm -f $DEVICE1 $DEVICE2
37 log_assert
"'zpool split' should be able to split encrypted pools"
40 DEVICE1
="$TEST_BASE_DIR/device-1"
41 DEVICE2
="$TEST_BASE_DIR/device-2"
43 altroot
="$TESTDIR/zpool-split-$RANDOM"
45 # 1. Create an encrypted pool
46 truncate
-s $SPA_MINDEVSIZE $DEVICE1
47 truncate
-s $SPA_MINDEVSIZE $DEVICE2
48 log_must
eval "echo "$passphrase" | zpool create -O encryption=aes-256-ccm " \
49 "-O keyformat=passphrase $TESTPOOL mirror $DEVICE1 $DEVICE2"
51 # 2. Split and re-import the pool, verify altroot is mounted.
52 log_must
eval "echo "$passphrase" | zpool split -l -R $altroot " \
53 "$TESTPOOL $TESTPOOL2"
54 log_must
test "$(get_prop 'encryption' $TESTPOOL2)" == "aes-256-ccm"
55 log_must
test "$(get_pool_prop 'altroot' $TESTPOOL2)" == "$altroot"
56 log_must mounted
$altroot/$TESTPOOL2
58 log_pass
"'zpool split' can split encrypted pools"