1#!/bin/ksh -p 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) 2015 by Delphix. All rights reserved. 16# 17 18. $STF_SUITE/tests/functional/rsend/rsend.kshlib 19. $STF_SUITE/include/properties.shlib 20 21# 22# Description: 23# Verify compressed send streams can still preserve properties 24# 25# Strategy: 26# 1. Randomly modify the properties in the src pool 27# 2. Send a full compressed stream with -p to preserve properties 28# 3. Verify all the received properties match the source datasets 29# 4. Repeat the process with -R instead of -p 30# 31 32verify_runnable "global" 33 34function cleanup 35{ 36 destroy_pool $POOL 37 destroy_pool $POOL2 38 log_must zpool create $POOL $DISK1 39 log_must zpool create $POOL2 $DISK2 40 log_must setup_test_model $POOL 41} 42 43log_assert "Compressed send doesn't interfere with preservation of properties" 44log_onexit cleanup 45 46typeset -a datasets=("" "/pclone" "/$FS" "/$FS/fs1" "/$FS/fs1/fs2" 47 "/$FS/fs1/fclone" "/vol" "/$FS/vol") 48 49typeset ds 50for opt in "-p" "-R"; do 51 for ds in ${datasets[@]}; do 52 randomize_ds_props $POOL$ds 53 done 54 55 if [ $opt = "-p" ]; then 56 for ds in ${datasets[@]}; do 57 log_must eval "zfs send -c $opt $POOL$ds@final > $BACKDIR/pool-final$opt" 58 log_must eval "zfs receive -dF $POOL2 < $BACKDIR/pool-final$opt" 59 done 60 else 61 log_must eval "zfs send -c $opt $POOL@final > $BACKDIR/pool-final$opt" 62 log_must eval "zfs receive -dF $POOL2 < $BACKDIR/pool-final$opt" 63 fi 64 65 for ds in ${datasets[@]}; do 66 typeset origin= 67 if [ $opt = "-p" ] && [ ${ds/clone//} != $ds ]; then 68 origin=noorigin 69 fi 70 log_must cmp_ds_prop $POOL$ds $POOL2$ds nosource $origin 71 log_must cmp_ds_prop $POOL$ds@final $POOL2$ds@final 72 done 73 74 # Don't cleanup the second time, since we do that on exit anyway. 75 [ $opt = "-p" ] && cleanup 76done 77 78log_pass "Compressed send doesn't interfere with preservation of properties" 79