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 37verify_runnable "both" 38 39function 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 48log_onexit cleanup 49 50log_assert "ZFS should perform raw sends of datasets" 51 52typeset passphrase="password" 53typeset snap="$TESTPOOL/$TESTFS@snap" 54typeset snap1="$TESTPOOL/$TESTFS1@snap" 55 56log_must eval "echo $passphrase | zfs create -o encryption=on" \ 57 "-o keyformat=passphrase $TESTPOOL/$TESTFS1" 58 59log_must zfs snapshot $snap 60log_must zfs snapshot $snap1 61 62log_must eval "zfs send -w $snap > /dev/null" 63log_must eval "zfs send -w $snap1 > /dev/null" 64 65log_note "Verify ZFS can perform raw sends with properties" 66log_must eval "zfs send -wp $snap > /dev/null" 67log_must eval "zfs send -wp $snap1 > /dev/null" 68 69log_note "Verify ZFS can perform raw replication sends" 70log_must eval "zfs send -wR $snap > /dev/null" 71log_must eval "zfs send -wR $snap1 > /dev/null" 72 73log_note "Verify ZFS can perform a raw send of an encrypted datasets with" \ 74 "its key unloaded" 75log_must zfs unmount $TESTPOOL/$TESTFS1 76log_must zfs unload-key $TESTPOOL/$TESTFS1 77log_must eval "zfs send -w $snap1 > /dev/null" 78 79log_pass "ZFS performs raw sends of datasets" 80