1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 
  22 #
  23 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 
  27 #
  28 # Copyright (c) 2013 by Delphix. All rights reserved.
  29 #
  30 
  31 . $STF_SUITE/include/libtest.shlib
  32 
  33 set -A disk_array $(find_disks $DISKS)
  34 case "${#disk_array[*]}" in
  35 0)
  36         DISK_COUNT=0
  37         ;;
  38 1)
  39         # We need to repartition the single disk to two slices
  40         DISK_COUNT=1
  41         META_DISK0=${disk_array[0]}
  42         SINGLE_DISK=$META_DISK0
  43         META_DISK1=$META_DISK0
  44         ZFS_DISK2=$META_DISK0
  45         META_SIDE0=${SINGLE_DISK}s0
  46         META_SIDE1=${SINGLE_DISK}s1
  47         ZFS_SIDE2=${SINGLE_DISK}s3
  48         ;;
  49 2)
  50         # We need to repartition the single disk to two slices and allocate
  51         # the 2nd disk to ZFS
  52         DISK_COUNT=2
  53         META_DISK0=${disk_array[0]}
  54         SINGLE_DISK=$META_DISK0
  55         META_DISK1=$META_DISK0
  56         ZFS_DISK2=${disk_array[1]}
  57         META_SIDE0=${SINGLE_DISK}s0
  58         META_SIDE1=${SINGLE_DISK}s1
  59         ZFS_SIDE2=${ZFS_DISK2}s0
  60         ;;
  61 *)
  62         # In this case there are at least enough disks to use.
  63         DISK_COUNT=3
  64         META_DISK0=${disk_array[0]}
  65         META_DISK1=${disk_array[1]}
  66         ZFS_DISK2=${disk_array[2]}
  67         META_SIDE0=${META_DISK0}s0
  68         META_SIDE1=${META_DISK1}s0
  69         ZFS_SIDE2=${ZFS_DISK2}s0
  70         ;;
  71 esac
  72 
  73 export DISK_COUNT META_DISK0 META_DISK1 ZFS_DISK2
  74 export META_SIDE0 META_SIDE1 ZFS_SIDE2 SINGLE_DISK
  75 
  76 export TESTFILE=testfile
  77 export FS_SIZE=500m
  78 export META_DEVICE_ID=d99
  79 export META_DEVICE_PATH=/dev/md/dsk/$META_DEVICE_ID
  80 export FILE_COUNT=20
  81 export FILE_SIZE=$(( 1024 * 1024 ))