1#!/usr/local/bin/ksh93 -p 2# 3# CDDL HEADER START 4# 5# The contents of this file are subject to the terms of the 6# Common Development and Distribution License (the "License"). 7# You may not use this file except in compliance with the License. 8# 9# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10# or http://www.opensolaris.org/os/licensing. 11# See the License for the specific language governing permissions 12# and limitations under the License. 13# 14# When distributing Covered Code, include this CDDL HEADER in each 15# file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16# If applicable, add the following below this CDDL HEADER, with the 17# fields enclosed by brackets "[]" replaced with your own identifying 18# information: Portions Copyright [yyyy] [name of copyright owner] 19# 20# CDDL HEADER END 21# 22 23# 24# Copyright 2009 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26# 27# ident "@(#)rsend_011_pos.ksh 1.2 09/08/06 SMI" 28# 29 30. $STF_SUITE/tests/rsend/rsend.kshlib 31 32################################################################################# 33# 34# __stc_assertion_start 35# 36# ID: rsend_011_pos 37# 38# DESCRIPTION: 39# Changes made by 'zfs inherit' can be properly received. 40# 41# STRATEGY: 42# 1. Inherit property for filesystem and volume 43# 2. Send and restore them in the target pool 44# 3. Verify all the datasets can be properly backup and receive 45# 46# TESTABILITY: explicit 47# 48# TEST_AUTOMATION_LEVEL: automated 49# 50# CODING_STATUS: COMPLETED (2007-10-10) 51# 52# __stc_assertion_end 53# 54################################################################################ 55 56verify_runnable "both" 57 58function cleanup 59{ 60 unmount_all_safe > /dev/null 2>&1 61 log_must cleanup_pool $POOL 62 log_must cleanup_pool $POOL2 63 64 log_must setup_test_model $POOL 65} 66 67log_assert "Verify changes made by 'zfs inherit' can be properly received." 68log_onexit cleanup 69 70# 71# Setting all the $FS properties as local value, 72# 73for prop in $(fs_inherit_prop); do 74 value=$(get_prop $prop $POOL/$FS) 75 log_must $ZFS set $prop=$value $POOL/$FS 76done 77 78# 79# Inherit propertes in sub-datasets 80# 81for ds in "$POOL/$FS/fs1" "$POOL/$FS/fs1/fs2" "$POOL/$FS/fs1/fclone" ; do 82 for prop in $(fs_inherit_prop) ; do 83 $ZFS inherit $prop $ds 84 if (($? !=0 )); then 85 log_fail "$ZFS inherit $prop $ds" 86 fi 87 done 88done 89if is_global_zone ; then 90 for prop in $(vol_inherit_prop) ; do 91 $ZFS inherit $prop $POOL/$FS/vol 92 if (($? !=0 )); then 93 log_fail "$ZFS inherit $prop $POOL/$FS/vol" 94 fi 95 done 96fi 97 98# 99# Verify datasets can be backup and restore correctly 100# Unmount $POOL/$FS to avoid two fs mount in the same mountpoint 101# 102log_must eval "$ZFS send -R $POOL@final > $BACKDIR/pool-R" 103log_must $ZFS unmount -f $POOL/$FS 104log_must eval "$ZFS receive -d -F $POOL2 < $BACKDIR/pool-R" 105 106dstds=$(get_dst_ds $POOL $POOL2) 107# 108# Define all the POOL/POOL2 datasets pair 109# 110set -A pair "$POOL" "$dstds" \ 111 "$POOL/$FS" "$dstds/$FS" \ 112 "$POOL/$FS/fs1" "$dstds/$FS/fs1" \ 113 "$POOL/$FS/fs1/fs2" "$dstds/$FS/fs1/fs2" \ 114 "$POOL/pclone" "$dstds/pclone" \ 115 "$POOL/$FS/fs1/fclone" "$dstds/$FS/fs1/fclone" 116 117if is_global_zone ; then 118 typeset -i n=${#pair[@]} 119 pair[((n))]="$POOL/vol"; pair[((n+1))]="$dstds/vol" 120 pair[((n+2))]="$POOL/$FS/vol" pair[((n+3))]="$dstds/$FS/vol" 121fi 122 123# 124# Verify all the sub-datasets can be properly received. 125# 126log_must cmp_ds_subs $POOL $dstds 127typeset -i i=0 128while ((i < ${#pair[@]})); do 129 log_must cmp_ds_cont ${pair[$i]} ${pair[((i+1))]} 130 log_must cmp_ds_prop ${pair[$i]} ${pair[((i+1))]} 131 132 ((i += 2)) 133done 134 135log_pass "Changes made by 'zfs inherit' can be properly received." 136