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 2008 Sun Microsystems, Inc. All rights reserved.
24 # Use is subject to license terms.
25 #
26 # ident "@(#)tp_delete_002.ksh 1.3 08/06/11 SMI"
27 #
28
29 #
30 # delete test case
31 #
32
33 #__stc_assertion_start
34 #
35 #ID: delete002
36 #
37 #DESCRIPTION:
38 #
39 # Forcefully deleting a group with a share leaves the share
40 # in an unmountable state.
41 #
42 #STRATEGY:
43 #
44 # Setup:
45 # - Create first share group with default options.
46 # - Add a share to the group
47 # Test:
48 # - Delete share group with the -f option
49 # - Verify that the share group no longer exists.
50 # - Verify that the share mount point can be unmounted.
51 # Cleanup:
52 # - N/A
53 #
54 # STRATEGY_NOTES:
55 # - * Legacy methods will be used so long as they are still
56 # present.
57 # - Return status is checked for all share-related commands
58 # executed.
59 # - For all commands that modify the share configuration, the
60 # associated reporting commands will be executed and output
61 # checked to verify the expected changes have occurred.
62 # - This test if fails will leave the mount point in a bad state
63 # an care needs to be taken to clean up this state, by
64 # removing and reading the mount point and remounting the
65 # device.
66 #
67 #KEYWORDS:
68 #
69 # delete
70 #
71 #TESTABILITY: explicit
72 #
73 #AUTHOR: sean.wilcox@sun.com
74 #
75 #REVIEWERS: TBD
76 #
77 #TEST_AUTOMATION_LEVEL: automated
78 #
79 #CODING_STATUS: COMPLETE
80 #
81 #__stc_assertion_end
82 function delete002 {
83 tet_result PASS
84 tc_id="delete002"
85 tc_desc="Forcibly a group with a share"
86 cmd_list=""
87 unset GROUPS
88 print_test_case $tc_id - $tc_desc
89 #
90 # Setup
91 #
92 # Create share group
93 create ${TG[0]}
94 # Add the share to the group
95 add_share POS ${TG[0]} "" ${MP[0]}
96 # Forcibly delete the group. (Dry run then for real.)
97 delete POS ${TG[0]} -n -f
98 delete POS ${TG[0]} "-f"
99 # Check that umount succeeds
100 if [ $report_only ]
101 then
102 return
103 fi
104
105 TMPDEV=`grep ${MP[0]} /etc/mnttab | awk '{print $1}'`
106 tet_infoline " - umount ${MP[0]}"
107 umount ${MP[0]}
108 if [ $? -ne 0 ]
109 then
110 tet_infoline "Must forcibly umount the mountpoint"
111 reset_paths
112 tet_result FAIL
113 else
114 # remount the mount point
115 echo $TMPDEV | grep dev | grep dsk > /dev/null 2>&1
116 if [ $? -eq 0 ]
117 then
118 tet_infoline " - mount $TMPDEV ${MP[0]}"
119 mount $TMPDEV ${MP[0]}
120 else
121 tet_infoline " - zfs mount $TMPDEV"
122 zfs mount $TMPDEV
123 fi
124 if [ $? -ne 0 ]
125 then
126 tet_infoline "Remount failed"
127 reset_paths
128 tet_result FAIL
129 fi
130 fi
131 #
132 # Cleanup
133 #
134 report_cmds $tc_id POS
135 }