1#!/bin/sh
2# $FreeBSD$
3
4dir=`dirname $0`
5. ${dir}/../../misc.sh
6
7echo "1..33"
8
9disks_create 8
10names_create 1
11
12expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2}
13expect_ok ${ZPOOL} offline ${name0} ${disk0}
14exp=`(
15  echo "  pool: ${name0}"
16  echo " state: DEGRADED"
17  echo "status: One or more devices has been taken offline by the administrator."
18  echo "        Sufficient replicas exist for the pool to continue functioning in a"
19  echo "        degraded state."
20  echo "action: Online the device using 'zpool online' or replace the device with"
21  echo "        'zpool replace'."
22  echo " scrub: none requested"
23  echo "config:"
24  echo "	NAME          STATE     READ WRITE CKSUM"
25  echo "	${name0}      DEGRADED     0     0     0"
26  echo "	  raidz2      DEGRADED     0     0     0"
27  echo "	    ${disk0}  OFFLINE      0     0     0"
28  echo "	    ${disk1}  ONLINE       0     0     0"
29  echo "	    ${disk2}  ONLINE       0     0     0"
30  echo "errors: No known data errors"
31)`
32expect "${exp}" ${ZPOOL} status ${name0}
33expect_ok ${ZPOOL} destroy ${name0}
34expect_fl ${ZPOOL} status -x ${name0}
35
36expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
37expect_ok ${ZPOOL} offline ${name0} ${disk1}
38exp=`(
39  echo "  pool: ${name0}"
40  echo " state: DEGRADED"
41  echo "status: One or more devices has been taken offline by the administrator."
42  echo "        Sufficient replicas exist for the pool to continue functioning in a"
43  echo "        degraded state."
44  echo "action: Online the device using 'zpool online' or replace the device with"
45  echo "        'zpool replace'."
46  echo " scrub: none requested"
47  echo "config:"
48  echo "	NAME          STATE     READ WRITE CKSUM"
49  echo "	${name0}      DEGRADED     0     0     0"
50  echo "	  raidz2      DEGRADED     0     0     0"
51  echo "	    ${disk0}  ONLINE       0     0     0"
52  echo "	    ${disk1}  OFFLINE      0     0     0"
53  echo "	    ${disk2}  ONLINE       0     0     0"
54  echo "errors: No known data errors"
55)`
56expect "${exp}" ${ZPOOL} status ${name0}
57expect_ok ${ZPOOL} destroy ${name0}
58expect_fl ${ZPOOL} status -x ${name0}
59
60expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
61expect_ok ${ZPOOL} offline ${name0} ${disk2}
62exp=`(
63  echo "  pool: ${name0}"
64  echo " state: DEGRADED"
65  echo "status: One or more devices has been taken offline by the administrator."
66  echo "        Sufficient replicas exist for the pool to continue functioning in a"
67  echo "        degraded state."
68  echo "action: Online the device using 'zpool online' or replace the device with"
69  echo "        'zpool replace'."
70  echo " scrub: none requested"
71  echo "config:"
72  echo "	NAME          STATE     READ WRITE CKSUM"
73  echo "	${name0}      DEGRADED     0     0     0"
74  echo "	  raidz2      DEGRADED     0     0     0"
75  echo "	    ${disk0}  ONLINE       0     0     0"
76  echo "	    ${disk1}  ONLINE       0     0     0"
77  echo "	    ${disk2}  OFFLINE      0     0     0"
78  echo "errors: No known data errors"
79)`
80expect "${exp}" ${ZPOOL} status ${name0}
81expect_ok ${ZPOOL} destroy ${name0}
82expect_fl ${ZPOOL} status -x ${name0}
83
84expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
85add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
86expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
87add_msg=""
88expect_fl ${ZPOOL} offline ${name0} ${disk2}
89exp=`(
90  echo "  pool: ${name0}"
91  echo " state: DEGRADED"
92  echo "status: One or more devices has been taken offline by the administrator."
93  echo "        Sufficient replicas exist for the pool to continue functioning in a"
94  echo "        degraded state."
95  echo "action: Online the device using 'zpool online' or replace the device with"
96  echo "        'zpool replace'."
97  echo " scrub: none requested"
98  echo "config:"
99  echo "	NAME          STATE     READ WRITE CKSUM"
100  echo "	${name0}      DEGRADED     0     0     0"
101  echo "	  raidz2      DEGRADED     0     0     0"
102  echo "	    ${disk0}  OFFLINE      0     0     0"
103  echo "	    ${disk1}  OFFLINE      0     0     0"
104  echo "	    ${disk2}  ONLINE       0     0     0"
105  echo "errors: No known data errors"
106)`
107add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
108expect "${exp}" ${ZPOOL} status ${name0}
109add_msg=""
110expect_ok ${ZPOOL} destroy ${name0}
111expect_fl ${ZPOOL} status -x ${name0}
112
113expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
114expect_ok ${ZPOOL} offline ${name0} ${disk1}
115exp=`(
116  echo "  pool: ${name0}"
117  echo " state: DEGRADED"
118  echo "status: One or more devices has been taken offline by the administrator."
119  echo "        Sufficient replicas exist for the pool to continue functioning in a"
120  echo "        degraded state."
121  echo "action: Online the device using 'zpool online' or replace the device with"
122  echo "        'zpool replace'."
123  echo " scrub: none requested"
124  echo "config:"
125  echo "	NAME          STATE     READ WRITE CKSUM"
126  echo "	${name0}      DEGRADED     0     0     0"
127  echo "	  raidz2      DEGRADED     0     0     0"
128  echo "	    ${disk0}  ONLINE       0     0     0"
129  echo "	    ${disk1}  OFFLINE      0     0     0"
130  echo "	    ${disk2}  ONLINE       0     0     0"
131  echo "	    ${disk3}  ONLINE       0     0     0"
132  echo "	  raidz2      ONLINE       0     0     0"
133  echo "	    ${disk4}  ONLINE       0     0     0"
134  echo "	    ${disk5}  ONLINE       0     0     0"
135  echo "	    ${disk6}  ONLINE       0     0     0"
136  echo "	    ${disk7}  ONLINE       0     0     0"
137  echo "errors: No known data errors"
138)`
139expect "${exp}" ${ZPOOL} status ${name0}
140add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
141expect_ok ${ZPOOL} offline ${name0} ${disk3}
142exp=`(
143  echo "  pool: ${name0}"
144  echo " state: DEGRADED"
145  echo "status: One or more devices has been taken offline by the administrator."
146  echo "        Sufficient replicas exist for the pool to continue functioning in a"
147  echo "        degraded state."
148  echo "action: Online the device using 'zpool online' or replace the device with"
149  echo "        'zpool replace'."
150  echo " scrub: none requested"
151  echo "config:"
152  echo "	NAME          STATE     READ WRITE CKSUM"
153  echo "	${name0}      DEGRADED     0     0     0"
154  echo "	  raidz2      DEGRADED     0     0     0"
155  echo "	    ${disk0}  ONLINE       0     0     0"
156  echo "	    ${disk1}  OFFLINE      0     0     0"
157  echo "	    ${disk2}  ONLINE       0     0     0"
158  echo "	    ${disk3}  OFFLINE      0     0     0"
159  echo "	  raidz2      ONLINE       0     0     0"
160  echo "	    ${disk4}  ONLINE       0     0     0"
161  echo "	    ${disk5}  ONLINE       0     0     0"
162  echo "	    ${disk6}  ONLINE       0     0     0"
163  echo "	    ${disk7}  ONLINE       0     0     0"
164  echo "errors: No known data errors"
165)`
166expect "${exp}" ${ZPOOL} status ${name0}
167expect_ok ${ZPOOL} offline ${name0} ${disk4} ${disk7}
168add_msg=""
169expect_fl ${ZPOOL} offline ${name0} ${disk0}
170expect_fl ${ZPOOL} offline ${name0} ${disk2}
171expect_fl ${ZPOOL} offline ${name0} ${disk5} ${disk6}
172exp=`(
173  echo "  pool: ${name0}"
174  echo " state: DEGRADED"
175  echo "status: One or more devices has been taken offline by the administrator."
176  echo "        Sufficient replicas exist for the pool to continue functioning in a"
177  echo "        degraded state."
178  echo "action: Online the device using 'zpool online' or replace the device with"
179  echo "        'zpool replace'."
180  echo " scrub: none requested"
181  echo "config:"
182  echo "	NAME          STATE     READ WRITE CKSUM"
183  echo "	${name0}      DEGRADED     0     0     0"
184  echo "	  raidz2      DEGRADED     0     0     0"
185  echo "	    ${disk0}  ONLINE       0     0     0"
186  echo "	    ${disk1}  OFFLINE      0     0     0"
187  echo "	    ${disk2}  ONLINE       0     0     0"
188  echo "	    ${disk3}  OFFLINE      0     0     0"
189  echo "	  raidz2      DEGRADED     0     0     0"
190  echo "	    ${disk4}  OFFLINE      0     0     0"
191  echo "	    ${disk5}  ONLINE       0     0     0"
192  echo "	    ${disk6}  ONLINE       0     0     0"
193  echo "	    ${disk7}  OFFLINE      0     0     0"
194  echo "errors: No known data errors"
195)`
196add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
197expect "${exp}" ${ZPOOL} status ${name0}
198add_msg=""
199expect_ok ${ZPOOL} destroy ${name0}
200expect_fl ${ZPOOL} status -x ${name0}
201
202disks_destroy
203