1 #! /usr/bin/ksh -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 #
  24 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  25 # Use is subject to license terms.
  26 #
  27 # ident "@(#)tc_zones_share.ksh 1.6     09/08/16 SMI"
  28 #
  29 
  30 #
  31 # zones test case
  32 #
  33 
  34 tet_startup="startup"
  35 tet_cleanup="cleanup"
  36 
  37 iclist="ic1 ic2 ic3"
  38 ic1="zone_disable001"
  39 ic2="zone_remove001"
  40 ic3="zone_move001"
  41 
  42 #
  43 # Here we need to source the configure file and do the initial
  44 # setup for the tests.
  45 #       Initial Setup steps :
  46 #               - check for legacy share commands and setup
  47 #               - Create file systems
  48 #               
  49 function startup {
  50         tet_infoline "Checking environment and runability"
  51         share_startup
  52         if (( $? == 0 )); then
  53                 tet_infoline "Creating the zone ..."
  54                 if [[ $report_only != TRUE ]]; then
  55                         zones_min_setup testzone1 ${MP[3]}
  56                         if (( $? != 0 )); then
  57                                 tet_infoline "create zone failed"
  58                                 cancel_tests
  59                                 return
  60                         fi
  61                 fi
  62         fi
  63 }
  64 
  65 function cleanup {
  66         [[ $report_only != TRUE ]] && zones_min_cleanup testzone1 ${MP[3]}
  67         share_cleanup
  68         rm -f $SHR_TMPDIR/share_tests_zone*
  69 
  70         # Should recover the needed zfs in case of it was destroyed by zone
  71         # uninstall, otherwise, zone cannot be created with the same zone path
  72         # in the next time run, and other tests will be effected too if run
  73         # them after zone tests run. Especially in opensolaris, zones must be
  74         # installed within a ZFS file system, otherwise the zone install
  75         # command will generate the error "no zonepath dataset".
  76         if [[ $setup_once == TRUE ]]; then
  77                 $DF -F zfs ${MP[3]} > /dev/null 2>&1
  78                 if (( $? != 0 )); then
  79                         typeset zfspool="share_pool"
  80                         [[ -n $ZFSPOOL ]] && zfspool=$ZFSPOOL
  81                         create_zfs_fs $zfspool ${MP[3]} 1g
  82                         if (( $? != 0 )); then
  83                                 cti_result FAIL \
  84                                         "failed to recover zfs<${MP[3]}>"
  85                                 return 1
  86                         fi
  87                 fi
  88         fi
  89 }
  90 
  91 . ${TET_SUITE_ROOT}/sharefs-tests/tests/sharemgr/zones/tp_zones_001
  92 . ${TET_SUITE_ROOT}/sharefs-tests/tests/sharemgr/zones/tp_zones_002
  93 . ${TET_SUITE_ROOT}/sharefs-tests/tests/sharemgr/zones/tp_zones_003
  94 
  95 . ${TET_SUITE_ROOT}/sharefs-tests/lib/share_common
  96 . ${TET_SUITE_ROOT}/sharefs-tests/lib/zones_common
  97 
  98 . ${TET_ROOT}/common/lib/ctiutils.ksh
  99 . ${TET_ROOT}/lib/ksh/tcm.ksh