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 by Datto Inc. All rights reserved.
21 .
$STF_SUITE/tests
/functional
/rsend
/rsend.kshlib
22 .
$STF_SUITE/tests
/functional
/cli_root
/zfs_load-key
/zfs_load-key_common.kshlib
26 # Raw recursive sends preserve filesystem structure.
29 # 1. Create an encrypted filesystem with a clone and a child
30 # 2. Snapshot and send the filesystem tree
31 # 3. Verify that the filesystem structure was correctly received
32 # 4. Change the child to an encryption root and promote the clone
33 # 5. Snapshot and send the filesystem tree again
34 # 6. Verify that the new structure is received correctly
37 verify_runnable
"both"
41 log_must cleanup_pool
$POOL
42 log_must cleanup_pool
$POOL2
43 log_must setup_test_model
$POOL
46 log_assert
"Raw recursive sends preserve filesystem structure."
49 # Create the filesystem heirarchy
50 log_must cleanup_pool
$POOL
51 log_must
eval "echo $PASSPHRASE | zfs create -o encryption=on" \
52 "-o keyformat=passphrase $POOL/$FS"
53 log_must zfs snapshot
$POOL/$FS@snap
54 log_must zfs clone
$POOL/$FS@snap
$POOL/clone
55 log_must zfs create
$POOL/$FS/child
57 # Back up the tree and verify the structure
58 log_must zfs snapshot
-r $POOL@before
59 log_must
eval "zfs send -wR $POOL@before > $BACKDIR/fs-before-R"
60 log_must
eval "zfs receive -d -F $POOL2 < $BACKDIR/fs-before-R"
61 dstds
=$
(get_dst_ds
$POOL/$FS $POOL2)
62 log_must cmp_ds_subs
$POOL/$FS $dstds
64 log_must verify_encryption_root
$POOL/$FS $POOL/$FS
65 log_must verify_keylocation
$POOL/$FS "prompt"
66 log_must verify_origin
$POOL/$FS "-"
68 log_must verify_encryption_root
$POOL/clone
$POOL/$FS
69 log_must verify_keylocation
$POOL/clone
"none"
70 log_must verify_origin
$POOL/clone
"$POOL/$FS@snap"
72 log_must verify_encryption_root
$POOL/$FS/child
$POOL/$FS
73 log_must verify_keylocation
$POOL/$FS/child
"none"
75 # Alter the heirarchy and re-send
76 log_must
eval "echo $PASSPHRASE1 | zfs change-key -o keyformat=passphrase" \
78 log_must zfs promote
$POOL/clone
79 log_must zfs snapshot
-r $POOL@after
80 log_must
eval "zfs send -wR -i $POOL@before $POOL@after >" \
82 log_must
eval "zfs receive -d -F $POOL2 < $BACKDIR/fs-after-R"
83 log_must cmp_ds_subs
$POOL/$FS $dstds
85 log_must verify_encryption_root
$POOL/$FS $POOL/clone
86 log_must verify_keylocation
$POOL/$FS "none"
87 log_must verify_origin
$POOL/$FS "$POOL/clone@snap"
89 log_must verify_encryption_root
$POOL/clone
$POOL/clone
90 log_must verify_keylocation
$POOL/clone
"prompt"
91 log_must verify_origin
$POOL/clone
"-"
93 log_must verify_encryption_root
$POOL/$FS/child
$POOL/$FS/child
94 log_must verify_keylocation
$POOL/$FS/child
"prompt"
96 log_pass
"Raw recursive sends preserve filesystem structure."