]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_raw.ksh
Vendor import of openzfs master @ 184df27eef0abdc7ab2105b21257f753834b936b
[FreeBSD/FreeBSD.git] / tests / zfs-tests / tests / functional / cli_root / zfs_send / zfs_send_raw.ksh
1 #!/bin/ksh -p
2 #
3 # CDDL HEADER START
4 #
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
8 # 1.0 of the CDDL.
9 #
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.
13 #
14 # CDDL HEADER END
15 #
16
17 #
18 # Copyright (c) 2017, Datto, Inc. All rights reserved.
19 #
20
21 . $STF_SUITE/include/libtest.shlib
22
23 #
24 # DESCRIPTION:
25 # ZFS should perform raw sends of datasets.
26 #
27 # STRATEGY:
28 # 1. Create an encrypted dataset
29 # 2. Snapshot the default dataset and the encrypted dataset
30 # 3. Attempt a raw send of both datasets
31 # 4. Attempt a raw send with properties of both datasets
32 # 5. Attempt a raw replication send of both datasets
33 # 6. Unmount and unload the encrypted dataset key
34 # 7. Attempt a raw send of the encrypted dataset
35 #
36
37 verify_runnable "both"
38
39 function cleanup
40 {
41         snapexists $snap && \
42                 log_must zfs destroy $snap
43
44         datasetexists $TESTPOOL/$TESTFS1 && \
45                 log_must zfs destroy -r $TESTPOOL/$TESTFS1
46 }
47
48 log_onexit cleanup
49
50 log_assert "ZFS should perform raw sends of datasets"
51
52 typeset passphrase="password"
53 typeset snap="$TESTPOOL/$TESTFS@snap"
54 typeset snap1="$TESTPOOL/$TESTFS1@snap"
55
56 log_must eval "echo $passphrase | zfs create -o encryption=on" \
57         "-o keyformat=passphrase $TESTPOOL/$TESTFS1"
58
59 log_must zfs snapshot $snap
60 log_must zfs snapshot $snap1
61
62 log_must eval "zfs send -w $snap > /dev/null"
63 log_must eval "zfs send -w $snap1 > /dev/null"
64
65 log_note "Verify ZFS can perform raw sends with properties"
66 log_must eval "zfs send -wp $snap > /dev/null"
67 log_must eval "zfs send -wp $snap1 > /dev/null"
68
69 log_note "Verify ZFS can perform raw replication sends"
70 log_must eval "zfs send -wR $snap > /dev/null"
71 log_must eval "zfs send -wR $snap1 > /dev/null"
72
73 log_note "Verify ZFS can perform a raw send of an encrypted datasets with" \
74         "its key unloaded"
75 log_must zfs unmount $TESTPOOL/$TESTFS1
76 log_must zfs unload-key $TESTPOOL/$TESTFS1
77 log_must eval "zfs send -w $snap1 > /dev/null"
78
79 log_pass "ZFS performs raw sends of datasets"