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 2007 Sun Microsystems, Inc.  All rights reserved.
  24 # Use is subject to license terms.
  25 #
  26 # NFSv4 CREATE operation test - negative tests
  27 #       Test NOSPC/DQUOT/ROFS, need special FSs support
  28 
  29 # include all test enironment
  30 source CREATE.env
  31 
  32 # connect to the test server
  33 Connect
  34 
  35 
  36 # setting local variables
  37 set TNAME $argv0
  38 set bfh [get_fh "$BASEDIRS"]
  39 
  40 
  41 # Start testing
  42 # --------------------------------------------------------------
  43 # a: Create a dir when FS has no more quota, expect DQUOT
  44 set expcode "DQUOT"
  45 set ASSERTION "Create while target FS has no more quota, expect $expcode"
  46 set tag $TNAME{a}
  47 putmsg stdout 0 "$tag: $ASSERTION"
  48 set qpath [path2comp $env(QUOTADIR) $DELM]
  49 set res [compound {Putrootfh; foreach c $qpath {Lookup $c}; 
  50         Getfh; Lookup "quotas"}]
  51 # add check of quota setup for Solaris:
  52 if {($env(SRVOS) == "Solaris") && ($status == "NOENT")} {
  53         putmsg stdout 0 "\t Test NOTINUSE: QUOTA is not setup in server."
  54 } else {
  55         set qfh [lindex [lindex $res end-1] 2]
  56         # Under cipso in Trusted Extension, we do "Create" operation 
  57         # for QUOTA in non-global zone
  58         if {[is_cipso $env(SERVER)]} {
  59                 set res [exec zlogin $env(ZONENAME) \
  60                         "su $env(TUSER2) -c \"export qfh=$qfh; /nfsh /$TNAME\""]
  61                 set status [lindex $res 0]
  62         } else {
  63                 set res [compound {Putfh $qfh; Create "qd.[pid]" {{mode 777}} d}]
  64         }
  65         ckres "Create" $status $expcode $res $PASS
  66 }
  67 
  68 # c: try to Create when FS has no more inode, expect NOSPC
  69 set expcode "NOSPC"
  70 set ASSERTION "Create while target FS has no more inode, expect $expcode"
  71 set tag $TNAME{c}
  72 putmsg stdout 0 "$tag: $ASSERTION"
  73 set nsfh [get_fh [path2comp $env(NSPCDIR) $DELM]]
  74 if {$nsfh == ""} {
  75         putmsg stdout 0 "\t Test NOTINUSE: NOSPC-FS is not setup in server."
  76 } else {
  77         set res [compound {Putfh $nsfh; Create "nd.[pid]" {{mode 777}} d}]
  78         ckres "Create" $status $expcode $res $PASS
  79 }
  80 
  81 
  82 # h: try to Create when FS is READONLY, expect ROFS
  83 set expcode "ROFS"
  84 set ASSERTION "Create while target FS is READONLY, expect $expcode"
  85 set tag $TNAME{h}
  86 putmsg stdout 0 "$tag: $ASSERTION"
  87 set rofh [get_fh [path2comp $env(ROFSDIR) $DELM]]
  88 if {$rofh == ""} {
  89         putmsg stdout 0 "\t Test NOTINUSE: ROFS is not setup in server."
  90 } else {
  91         set res [compound {Putfh $rofh; Create "d2.[pid]" {{mode 777}} d}]
  92         ckres "Create" $status $expcode $res $PASS
  93 }
  94 
  95 
  96 # --------------------------------------------------------------
  97 # disconnect and exit
  98 Disconnect
  99 exit $PASS