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 2007 Sun Microsystems, Inc. All rights reserved. 25# Use is subject to license terms. 26 27. $STF_SUITE/include/libtest.kshlib 28. $STF_SUITE/tests/cli_root/zfs_copies/zfs_copies.kshlib 29 30################################################################################ 31# 32# __stc_assertion_start 33# 34# ID: zfs_copies_001_pos 35# 36# DESCRIPTION: 37# Verify "copies" property can be correctly set as 1,2 and 3 and different 38# filesystem can have different value of "copies" property within the same pool. 39# 40# STRATEGY: 41# 1. Create different filesystems with copies set as 1,2,3; 42# 2. Verify that the "copies" property has been set correctly 43# 44# TESTABILITY: explicit 45# 46# TEST_AUTOMATION_LEVEL: automated 47# 48# CODING_STATUS: COMPLETED (2006-05-31) 49# 50# __stc_assertion_end 51# 52################################################################################ 53 54verify_runnable "both" 55 56function cleanup 57{ 58 typeset ds 59 60 for ds in $fs1 $fs2 $vol1 $vol2; do 61 if datasetexists $ds; then 62 log_must $ZFS destroy $ds 63 fi 64 done 65} 66 67log_assert "Verify 'copies' property with correct arguments works or not." 68log_onexit cleanup 69 70fs=$TESTPOOL/$TESTFS 71fs1=$TESTPOOL/$TESTFS1 72fs2=$TESTPOOL/$TESTFS2 73vol=$TESTPOOL/$TESTVOL 74vol1=$TESTPOOL/$TESTVOL1 75vol2=$TESTPOOL/$TESTVOL2 76 77# 78# Check the default value for copies property 79# 80for ds in $fs $vol; do 81 cmp_prop $ds 1 82done 83 84for val in 1 2 3; do 85 log_must $ZFS create -o copies=$val $fs1 86 if is_global_zone; then 87 log_must $ZFS create -V $VOLSIZE -o copies=$val $vol1 88 else 89 log_must $ZFS create -o copies=$val $vol1 90 fi 91 for ds in $fs1 $vol1; do 92 cmp_prop $ds $val 93 done 94 95 for val2 in 3 2 1; do 96 log_must $ZFS create -o copies=$val2 $fs2 97 if is_global_zone; then 98 log_must $ZFS create -V $VOLSIZE -o copies=$val2 $vol2 99 else 100 log_must $ZFS create -o copies=$val2 $vol2 101 fi 102 for ds in $fs2 $vol2; do 103 cmp_prop $ds $val2 104 log_must $ZFS destroy $ds 105 done 106 done 107 108 for ds in $fs1 $vol1; do 109 log_must $ZFS destroy $ds 110 done 111 112done 113 114for val in 3 2 1; do 115 for ds in $fs $vol; do 116 log_must $ZFS set copies=$val $ds 117 cmp_prop $ds $val 118 done 119done 120 121log_pass "'copies' property with correct arguments works as expected. " 122