1 #! /usr/bin/ksh -p
   2 #
   3 #
   4 # This file and its contents are supplied under the terms of the
   5 # Common Development and Distribution License ("CDDL"), version 1.0.
   6 # You may only use this file in accordance with the terms of version
   7 # 1.0 of the CDDL.
   8 #
   9 # A full copy of the text of the CDDL should have accompanied this
  10 # source.  A copy of the CDDL is also available via the Internet at
  11 # http://www.illumos.org/license/CDDL.
  12 #
  13 
  14 #
  15 # Copyright 2016 Nexenta Systems, Inc. All rights reserved.
  16 #
  17 
  18 . $STF_SUITE/tests/functional/wbc/wbc.cfg
  19 . $STF_SUITE/tests/functional/wbc/wbc.kshlib
  20 
  21 #
  22 # DESCRIPTION:
  23 #       Creating a pool and adding special device to existing pool succeeds
  24 #
  25 # STRATEGY:
  26 #       1. Create pool without separated special devices
  27 #       2. Display pool status
  28 #       3. Add special device
  29 #       4. Display pool status
  30 #       5. Scrub pool and check status
  31 #       6. Destroy and loop to create pool with different configuration
  32 #
  33 
  34 verify_runnable "global"
  35 log_assert "Creating a pool and adding special device to existing pool succeeds"
  36 log_onexit cleanup
  37 for pool_type in "stripe" "mirror" "raidz" "raidz2" "raidz3" ; do
  38         for special_type in "stripe" "mirror" ; do
  39                 for wbc_mode in "on" "off" ; do
  40                         log_must create_pool $TESTPOOL $pool_type
  41                         if [[ $special_type == "stripe" ]] ; then
  42                                 log_must zpool add -f $TESTPOOL special \
  43                                     $SSD_DISKS
  44                         else
  45                                 log_must zpool add -f $TESTPOOL special \
  46                                     $special_type $SSD_DISKS
  47                         fi
  48                         log_must set_wbc_mode $TESTPOOL $wbc_mode
  49                         log_must display_status $TESTPOOL
  50                         log_must sync
  51                         log_must zpool scrub $TESTPOOL
  52                         while is_pool_scrubbing $TESTPOOL ; do
  53                                 sleep 1
  54                         done
  55                         log_must check_pool_errors $TESTPOOL
  56                         log_must destroy_pool $TESTPOOL
  57                 done
  58         done
  59 done
  60 log_pass "Creating a pool and adding special device to existing pool succeeds"