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