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
28 #
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 #
31
32 . $STF_SUITE/tests/functional/rsend/rsend.kshlib
33
34 #
35 # DESCRIPTION:
36 # zfs send -R will backup all the filesystem properties correctly.
37 #
38 # STRATEGY:
39 # 1. Setting properties for all the filesystem and volumes randomly
40 # 2. Backup all the data from POOL by send -R
41 # 3. Restore all the data in POOL2
42 # 4. Verify all the perperties in two pools are same
43 #
44
45 verify_runnable "global"
46
47 function rand_set_prop
48 {
49 typeset dtst=$1
50 typeset prop=$2
51 shift 2
52 typeset value=$(random_get $@)
53
54 log_must eval "zfs set $prop='$value' $dtst"
55 }
56
57 function edited_prop
58 {
59 typeset behaviour=$1
60 typeset ds=$2
61 typeset backfile=$TESTDIR/edited_prop_$ds
62
63 case $behaviour in
64 "get")
65 typeset props=$(zfs inherit 2>&1 | \
66 awk '$2=="YES" {print $1}' | \
67 egrep -v "^vol|\.\.\.$")
68 for item in $props ; do
69 if [[ $item == "mlslabel" ]] && \
70 ! is_te_enabled ; then
71 continue
72 fi
73 zfs get -H -o property,value $item $ds >> \
74 $backfile
75 if (($? != 0)); then
76 log_fail "zfs get -H -o property,value"\
77 "$item $ds > $backfile"
78 fi
79 done
80 ;;
81 "set")
82 if [[ ! -f $backfile ]] ; then
83 log_fail "$ds need backup properties firstly."
84 fi
85
86 typeset prop value
|
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
28 #
29 # Copyright (c) 2013, 2016 by Delphix. All rights reserved.
30 # Copyright 2016 Nexenta Systems, Inc. All rights reserved.
31 #
32
33 . $STF_SUITE/tests/functional/rsend/rsend.kshlib
34
35 #
36 # DESCRIPTION:
37 # zfs send -R will backup all the filesystem properties correctly.
38 #
39 # STRATEGY:
40 # 1. Setting properties for all the filesystem and volumes randomly
41 # 2. Backup all the data from POOL by send -R
42 # 3. Restore all the data in POOL2
43 # 4. Verify all the perperties in two pools are same
44 #
45
46 verify_runnable "global"
47
48 function rand_set_prop
49 {
50 typeset dtst=$1
51 typeset prop=$2
52 shift 2
53 typeset value=$(random_get $@)
54
55 log_must eval "zfs set $prop='$value' $dtst"
56 }
57
58 #
59 # 'wbc_mode' is skipped, because the tested pools do not have
60 # 'special' vdev, so the setting of this property will cause
61 # test-fail
62 #
63 function edited_prop
64 {
65 typeset behaviour=$1
66 typeset ds=$2
67 typeset backfile=$TESTDIR/edited_prop_$ds
68
69 case $behaviour in
70 "get")
71 typeset props=$(zfs inherit 2>&1 | \
72 awk '$2=="YES" {print $1}' |
73 egrep -v "^wbc_mode" | \
74 egrep -v "^vol|\.\.\.$")
75 for item in $props ; do
76 if [[ $item == "mlslabel" ]] && \
77 ! is_te_enabled ; then
78 continue
79 fi
80 zfs get -H -o property,value $item $ds >> \
81 $backfile
82 if (($? != 0)); then
83 log_fail "zfs get -H -o property,value"\
84 "$item $ds > $backfile"
85 fi
86 done
87 ;;
88 "set")
89 if [[ ! -f $backfile ]] ; then
90 log_fail "$ds need backup properties firstly."
91 fi
92
93 typeset prop value
|