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 #       Attaching special vdev 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. Try to attach new special device
  31 #       6. Display pool status
  32 #       7. Scrub pool and check status
  33 #
  34 
  35 verify_runnable "global"
  36 log_assert "Attaching special vdev succeeds."
  37 log_onexit cleanup
  38 for wbc_mode in "on" "off" ; do
  39         log_must create_pool $TESTPOOL $pool_type
  40         log_must display_status $TESTPOOL
  41         log_must zpool add -f $TESTPOOL special $SSD_DISK1
  42         log_must set_wbc_mode $TESTPOOL $wbc_mode
  43         log_must display_status $TESTPOOL
  44         log_must zpool attach $TESTPOOL $SSD_DISK1 $SSD_DISK2
  45         log_must display_status $TESTPOOL
  46         while is_pool_resilvering $TESTPOOL ; do
  47                 sleep 1
  48         done
  49         log_must zpool scrub $TESTPOOL
  50         while is_pool_scrubbing $TESTPOOL ; do
  51                 sleep 1
  52         done
  53         log_must check_pool_errors $TESTPOOL
  54         log_must destroy_pool $TESTPOOL
  55 done
  56 log_pass "Attaching special vdev succeeds."