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 2009 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # ident "@(#)tp_zfs_003.ksh     1.4     09/08/01 SMI"
  27 #
  28 
  29 #
  30 # zfs-share test case
  31 #
  32 
  33 #__stc_assertion_start
  34 #
  35 #ID: zfs003
  36 #
  37 #DESCRIPTION:
  38 #
  39 #       Create a zfs share with properties via zfs but is not shared and
  40 #       attempt to share via sharemgr.
  41 #
  42 #STRATEGY:
  43 #
  44 #       Setup:
  45 #               share a zfs file system via zfs and set a property via zfs
  46 #       Test:
  47 #               sharemgr set same option to reverse
  48 #               verify that the zfs option is still set
  49 #               unshare the file system and add to a test_group via sharemgr
  50 #               sharemgr set option to reverse
  51 #               confirm set succeeded.
  52 #               remove-share via sharemgr and re-share via zfs
  53 #               confirm zfs setting is still set.
  54 #       Cleanup:
  55 #               unshare the zfs file system via zfs 
  56 #
  57 #       STRATEGY_NOTES:
  58 #               This may not be a failure if the file system is unshared.
  59 #               The option must be set on the default group (which does
  60 #               some bad things right now).
  61 #
  62 #KEYWORDS:
  63 #
  64 #       zfs
  65 #
  66 #TESTABILITY: explicit
  67 #
  68 #AUTHOR: sean.wilcox@sun.com
  69 #
  70 #REVIEWERS: TBD
  71 #
  72 #TEST_AUTOMATION_LEVEL: automated
  73 #
  74 #CODING_STATUS: COMPLETE
  75 #
  76 #__stc_assertion_end
  77 function zfs003 {
  78         tet_result PASS
  79         tc_id="zfs003"
  80         tc_desc="zfs share properties set, and currently not shared via zfs"
  81         cmd_list=""
  82         unset GROUPS
  83         print_test_case $tc_id - $tc_desc
  84 
  85         #
  86         # Setup
  87         #
  88         create test_group_1
  89         tet_infoline " - /usr/sbin/zfs set sharenfs=on `convertzfs ${MP[1]}`"
  90         eval /usr/sbin/zfs set sharenfs=on `convertzfs ${MP[1]}`
  91         tet_infoline " - /usr/sbin/zfs set sharenfs=nosuid `convertzfs ${MP[1]}`"
  92         eval /usr/sbin/zfs set sharenfs=nosuid `convertzfs ${MP[1]}`
  93         set_ NEG zfs "-p nosuid=false"
  94 
  95         tet_infoline " - /usr/sbin/zfs unshare `convertzfs ${MP[1]}`"
  96         eval /usr/sbin/zfs unshare `convertzfs ${MP[1]}`
  97         add_share test_group_1 "" ${MP[1]}
  98         set_ POS test_group_1 "-p nosuid=false"
  99         remove_share ${MP[1]}
 100         tet_infoline " - zfs share `convertzfs ${MP[1]}`"
 101         zfs share `convertzfs ${MP[1]}`
 102         zfs get sharenfs `convertzfs ${MP[1]}` | grep nosuid | \
 103             grep -v false > /dev/null
 104         if [ $? -ne 0 ]
 105         then
 106                 tet_infoline "FAIL - nosuid zfs setting was removed"
 107                 tet_result FAIL
 108         fi
 109 
 110         tet_infoline " - /usr/sbin/zfs set sharenfs=off `convertzfs ${MP[1]}`"
 111         eval /usr/sbin/zfs set sharenfs=off `convertzfs ${MP[1]}`
 112         delete_all_test_groups
 113         report_cmds $tc_id POS
 114 }