zpool_create_004_pos.ksh revision d583b39bfb4e2571d3e41097c5c357ffe353ad45
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2008 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
#
# Copyright (c) 2012 by Delphix. All rights reserved.
#
#
# DESCRIPTION:
# 'zpool create [-f]' can create a storage pool with large number of
# file-in-zfs-filesystem-based vdevs without any errors.
#
# STRATEGY:
# 1. Create assigned number of files in ZFS filesystem as vdevs
# 2. Creating a new pool based on the vdevs should get success
# 3. Fill in the filesystem and create a partially writen file as vdev
# 4. Add the new file into vdevs list and create a pool
# 5. Creating a storage pool with the new vdevs list should be failed.
#
verify_runnable "global"
function cleanup
{
typeset pool=""
for pool in foo $TESTPOOL2 $TESTPOOL1; do
poolexists $pool && \
done
if datasetexists $TESTPOOL/$TESTFS; then
fi
if poolexists $TESTPOOL; then
fi
if [[ -d $TESTDIR ]]; then
fi
}
#
# Create a pool and fs on the assigned disk, and dynamically create large
# numbers of files as vdevs.(the default value is <VDEVS_NUM>)
#
function setup_vdevs #<disk>
{
typeset disk=$1
typeset -l largest_num=0
typeset -l slice_size=0
typeset vdev=""
#
# Get disk size for zfs filesystem
#
#minus $largest_num/$MD_OVERHEAD to leave space for metadata
else
# If file_size too large, the time cost will increase so
# we limit the file_size to $FILE_SIZE, and thus the
# total time spent on creating file can be controlled
# within the timeout.
fi
# Add $vdevs_num/$MD_OVERHEAD to provide enough space for
# metadata
fi
[[ -d $TESTDIR ]] && \
typeset -l count=0
typeset PIDLIST=""
vdevs_list="$vdevs_list ${TESTDIR}/file.$count"
done
# wait all mkfiles to finish
wait $PIDLIST
if (( $? != 0 )); then
log_fail "create vdevs failed."
fi
return 0
}
log_assert " 'zpool create [-f]' can create a storage pool with large " \
"numbers of vdevs without any errors."
if [[ -n $DISK ]]; then
else
fi
log_note "Create storage pool with number of $VDEVS_NUM file vdevs should " \
"succeed."
vdevs_list=""
if poolexists $TESTPOOL1; then
else
log_fail " Creating pool with large numbers of file-vdevs fail."
fi
log_note "Creating storage pool with partially written file as vdev should " \
"fail."
# Count the broken file size. make sure it should be greater than $left_space
# so, here, we plus a number -- $file_size, this number can be any other number.
vdevs_list="$vdevs_list ${TESTDIR}/broken_file"
log_pass "'zpool create [-f]' with $vdevs_num vdevs success."