1#!/bin/ksh 2 3# 4# This file and its contents are supplied under the terms of the 5# Common Development and Distribution License ("CDDL"), version 1.0. 6# You may only use this file in accordance with the terms of version 7# 1.0 of the CDDL. 8# 9# A full copy of the text of the CDDL should have accompanied this 10# source. A copy of the CDDL is also available via the Internet at 11# http://www.illumos.org/license/CDDL. 12# 13 14# 15# Copyright (c) 2018 by Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/redacted_send/redacted.kshlib 19 20# 21# Description: 22# Verify the functionality of the redaction_bookmarks and redacted_datasets 23# features. 24# 25# Strategy: 26# 1. Create a pool with all features disabled. 27# 2. Verify redacted send fails. 28# 3. Enable redaction_bookmarks and verify redacted sends works. 29# 4. Verify receipt of a redacted stream fails. 30# 5. Enable recacted_datasets and verify zfs receive works. 31# 32 33typeset ds_name="disabled" 34typeset sendfs="$POOL/$ds_name" 35typeset sendfs1="$POOL2/${ds_name}1" 36typeset recvfs="$POOL2/$ds_name" 37typeset clone="$POOL/${ds_name}_clone" 38typeset clone1="$POOL2/${ds_name}_clone1" 39typeset tmpdir="$(get_prop mountpoint $POOL)/tmp" 40typeset stream=$(mktemp $tmpdir/stream.XXXX) 41setup_dataset $ds_name '' 42 43function cleanup 44{ 45 destroy_pool $POOL2 46 create_pool $POOL2 $DISK2 47 log_must zfs snapshot $POOL2@init 48 redacted_cleanup $sendfs $recvfs 49} 50 51log_onexit cleanup 52 53destroy_pool $POOL2 54log_must zpool create -d $POOL2 $DISK2 55 56log_must zfs create $sendfs1 57log_must zfs snapshot $sendfs1@snap 58log_must zfs clone $sendfs1@snap $clone1 59log_must zfs snapshot $clone1@snap 60 61log_mustnot zfs redact $sendfs1@snap book1 $clone1@snap 62log_must zpool set feature@redaction_bookmarks=enabled $POOL2 63log_must zfs redact $sendfs1@snap book1 $clone1@snap 64 65log_must zfs redact $sendfs@snap book1 $clone@snap 66log_must eval "zfs send --redact book1 $sendfs@snap >$stream" 67log_mustnot eval "zfs recv $recvfs <$stream" 68log_must zpool set feature@redacted_datasets=enabled $POOL2 69log_must eval "zfs recv $recvfs <$stream" 70 71log_pass "The redacted send/recv features work correctly." 72