f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# CDDL HEADER START
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# The contents of this file are subject to the terms of the
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Common Development and Distribution License (the "License").
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# You may not use this file except in compliance with the License.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# or http://www.opensolaris.org/os/licensing.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# See the License for the specific language governing permissions
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# and limitations under the License.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# When distributing Covered Code, include this CDDL HEADER in each
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# If applicable, add the following below this CDDL HEADER, with the
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# fields enclosed by brackets "[]" replaced with your own identifying
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# information: Portions Copyright [yyyy] [name of copyright owner]
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# CDDL HEADER END
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Use is subject to license terms.
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy# Copyright (c) 2013, 2016 by Delphix. All rights reserved.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy. $STF_SUITE/tests/functional/rsend/rsend.kshlib
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# zfs send -R will backup all the filesystem properties correctly.
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# 1. Setting properties for all the filesystem and volumes randomly
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# 2. Backup all the data from POOL by send -R
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# 3. Restore all the data in POOL2
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# 4. Verify all the perperties in two pools are same
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy log_must eval "zfs set $prop='$value' $dtst"
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedy zfs get -H -o property,value $item $ds >> \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy if [[ ! -f $backfile ]] ; then
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy log_fail "$ds need backup properties firstly."
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy while read prop value ; do
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy log_fail "Unrecognized behaviour: $behaviour"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy if [[ -d $TESTDIR ]]; then
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedylog_assert "Verify zfs send -R will backup all the filesystem properties " \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedyfor fs in "$POOL" "$POOL/pclone" "$POOL/$FS" "$POOL/$FS/fs1" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "$POOL/$FS/fs1/fs2" "$POOL/$FS/fs1/fclone" ; do
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs aclinherit "discard" "noallow" "secure" "passthrough"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs checksum "on" "off" "fletcher2" "fletcher4" "sha256"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs aclmode "discard" "groupmask" "passthrough"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs checksum "on" "off" "fletcher2" "fletcher4" "sha256"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs compression "on" "off" "lzjb" "gzip" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" "gzip-6" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "gzip-7" "gzip-8" "gzip-9"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs recordsize "512" "2K" "8K" "32K" "128K"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs snapdir "hidden" "visible"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $fs user:prop "aaa" "bbb" "23421" "()-+?"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedyfor vol in "$POOL/vol" "$POOL/$FS/vol" ; do
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $vol checksum "on" "off" "fletcher2" "fletcher4" "sha256"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $vol compression "on" "off" "lzjb" "gzip" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "gzip-1" "gzip-2" "gzip-3" "gzip-4" "gzip-5" "gzip-6" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "gzip-7" "gzip-8" "gzip-9"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy rand_set_prop $vol user:prop "aaa" "bbb" "23421" "()-+?"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Verify inherited property can be received
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedyrand_set_prop $POOL sharenfs "on" "off" "rw"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Duplicate POOL2 for testing
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedylog_must eval "zfs send -R $POOL@final > $BACKDIR/pool-final-R"
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedylog_must eval "zfs receive -d -F $POOL2 < $BACKDIR/pool-final-R"
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy# Define all the POOL/POOL2 datasets pair
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "$POOL/$FS/fs1/fs2" "$POOL2/$FS/fs1/fs2" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "$POOL/pclone" "$POOL2/pclone" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy "$POOL/$FS/fs1/fclone" "$POOL2/$FS/fs1/fclone" \
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy log_must cmp_ds_prop ${pair[$i]} ${pair[((i+1))]}
1d32ba663e202c24a5a1f2e5aef83fffb447cb7fJohn Wren Kennedyzpool upgrade -v | grep "Snapshot properties" > /dev/null 2>&1
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedy log_must cmp_ds_prop ${pair[$i]}@final ${pair[((i+1))]}@final
f38cb554a534c6df738be3f4d23327e69888e634John Wren Kennedylog_pass "Verify zfs send -R will backup all the filesystem properties " \