xref: /freebsd/tools/regression/zfs/zpool/offline/option-t.t (revision 0b3105a37d7adcadcb720112fed4dc4e8040be99)
1#!/bin/sh
2# $FreeBSD$
3
4dir=`dirname $0`
5. ${dir}/../../misc.sh
6
7echo "1..219"
8
9disks_create 8
10names_create 1
11
12expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
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 "	  mirror      DEGRADED     0     0     0"
27  echo "	    ${disk0}  OFFLINE      0     0     0"
28  echo "	    ${disk1}  ONLINE       0     0     0"
29  echo "errors: No known data errors"
30)`
31expect "${exp}" ${ZPOOL} status ${name0}
32expect_ok ${ZPOOL} export ${name0}
33expect_ok ${ZPOOL} import ${import_flags} ${name0}
34exp=`(
35  echo "  pool: ${name0}"
36  echo " state: DEGRADED"
37  echo "status: One or more devices has been taken offline by the administrator."
38  echo "        Sufficient replicas exist for the pool to continue functioning in a"
39  echo "        degraded state."
40  echo "action: Online the device using 'zpool online' or replace the device with"
41  echo "        'zpool replace'."
42  echo " scrub: none requested"
43  echo "config:"
44  echo "	NAME          STATE     READ WRITE CKSUM"
45  echo "	${name0}      DEGRADED     0     0     0"
46  echo "	  mirror      DEGRADED     0     0     0"
47  echo "	    ${disk0}  OFFLINE      0     0     0"
48  echo "	    ${disk1}  ONLINE       0     0     0"
49  echo "errors: No known data errors"
50)`
51expect "${exp}" ${ZPOOL} status ${name0}
52expect_ok ${ZPOOL} online ${name0} ${disk0}
53expect_ok ${ZPOOL} destroy ${name0}
54expect_fl ${ZPOOL} status -x ${name0}
55
56expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
57expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
58exp=`(
59  echo "  pool: ${name0}"
60  echo " state: DEGRADED"
61  echo "status: One or more devices has been taken offline by the administrator."
62  echo "        Sufficient replicas exist for the pool to continue functioning in a"
63  echo "        degraded state."
64  echo "action: Online the device using 'zpool online' or replace the device with"
65  echo "        'zpool replace'."
66  echo " scrub: none requested"
67  echo "config:"
68  echo "	NAME          STATE     READ WRITE CKSUM"
69  echo "	${name0}      DEGRADED     0     0     0"
70  echo "	  mirror      DEGRADED     0     0     0"
71  echo "	    ${disk0}  OFFLINE      0     0     0"
72  echo "	    ${disk1}  ONLINE       0     0     0"
73  echo "errors: No known data errors"
74)`
75expect "${exp}" ${ZPOOL} status ${name0}
76expect_ok ${ZPOOL} export ${name0}
77expect_ok ${ZPOOL} import ${import_flags} ${name0}
78exp=`(
79  echo "  pool: ${name0}"
80  echo " state: ONLINE"
81  echo "config:"
82  echo "	NAME          STATE   READ WRITE CKSUM"
83  echo "	${name0}      ONLINE     0     0     0"
84  echo "	  mirror      ONLINE     0     0     0"
85  echo "	    ${disk0}  ONLINE     0     0     0"
86  echo "	    ${disk1}  ONLINE     0     0     0"
87  echo "errors: No known data errors"
88)`
89expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
90expect_ok ${ZPOOL} destroy ${name0}
91expect_fl ${ZPOOL} status -x ${name0}
92
93expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
94add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
95expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
96exp=`(
97  echo "  pool: ${name0}"
98  echo " state: DEGRADED"
99  echo "status: One or more devices has been taken offline by the administrator."
100  echo "        Sufficient replicas exist for the pool to continue functioning in a"
101  echo "        degraded state."
102  echo "action: Online the device using 'zpool online' or replace the device with"
103  echo "        'zpool replace'."
104  echo " scrub: none requested"
105  echo "config:"
106  echo "	NAME          STATE     READ WRITE CKSUM"
107  echo "	${name0}      DEGRADED     0     0     0"
108  echo "	  mirror      DEGRADED     0     0     0"
109  echo "	    ${disk0}  OFFLINE      0     0     0"
110  echo "	    ${disk1}  OFFLINE      0     0     0"
111  echo "	    ${disk2}  ONLINE       0     0     0"
112  echo "errors: No known data errors"
113)`
114expect "${exp}" ${ZPOOL} status ${name0}
115add_msg=""
116expect_ok ${ZPOOL} export ${name0}
117expect_ok ${ZPOOL} import ${import_flags} ${name0}
118exp=`(
119  echo "  pool: ${name0}"
120  echo " state: DEGRADED"
121  echo "status: One or more devices has been taken offline by the administrator."
122  echo "        Sufficient replicas exist for the pool to continue functioning in a"
123  echo "        degraded state."
124  echo "action: Online the device using 'zpool online' or replace the device with"
125  echo "        'zpool replace'."
126  echo "config:"
127  echo "	NAME          STATE     READ WRITE CKSUM"
128  echo "	${name0}      DEGRADED     0     0     0"
129  echo "	  mirror      DEGRADED     0     0     0"
130  echo "	    ${disk0}  OFFLINE      0     0     0"
131  echo "	    ${disk1}  OFFLINE      0     0     0"
132  echo "	    ${disk2}  ONLINE       0     0     0"
133  echo "errors: No known data errors"
134)`
135add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
136expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
137add_msg=""
138expect_ok ${ZPOOL} online ${name0} ${disk0}
139expect_ok ${ZPOOL} online ${name0} ${disk1}
140expect_ok ${ZPOOL} destroy ${name0}
141expect_fl ${ZPOOL} status -x ${name0}
142
143expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
144add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
145expect_ok ${ZPOOL} offline -t ${name0} ${disk0} ${disk1}
146exp=`(
147  echo "  pool: ${name0}"
148  echo " state: DEGRADED"
149  echo "status: One or more devices has been taken offline by the administrator."
150  echo "        Sufficient replicas exist for the pool to continue functioning in a"
151  echo "        degraded state."
152  echo "action: Online the device using 'zpool online' or replace the device with"
153  echo "        'zpool replace'."
154  echo " scrub: none requested"
155  echo "config:"
156  echo "	NAME          STATE     READ WRITE CKSUM"
157  echo "	${name0}      DEGRADED     0     0     0"
158  echo "	  mirror      DEGRADED     0     0     0"
159  echo "	    ${disk0}  OFFLINE      0     0     0"
160  echo "	    ${disk1}  OFFLINE      0     0     0"
161  echo "	    ${disk2}  ONLINE       0     0     0"
162  echo "errors: No known data errors"
163)`
164expect "${exp}" ${ZPOOL} status ${name0}
165add_msg=""
166expect_ok ${ZPOOL} export ${name0}
167expect_ok ${ZPOOL} import ${import_flags} ${name0}
168exp=`(
169  echo "  pool: ${name0}"
170  echo " state: ONLINE"
171  echo "config:"
172  echo "	NAME          STATE   READ WRITE CKSUM"
173  echo "	${name0}      ONLINE     0     0     0"
174  echo "	  mirror      ONLINE     0     0     0"
175  echo "	    ${disk0}  ONLINE     0     0     0"
176  echo "	    ${disk1}  ONLINE     0     0     0"
177  echo "	    ${disk2}  ONLINE     0     0     0"
178  echo "errors: No known data errors"
179)`
180expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
181expect_ok ${ZPOOL} destroy ${name0}
182expect_fl ${ZPOOL} status -x ${name0}
183
184expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
185expect_ok ${ZPOOL} offline ${name0} ${disk0}
186add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
187expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
188exp=`(
189  echo "  pool: ${name0}"
190  echo " state: DEGRADED"
191  echo "status: One or more devices has been taken offline by the administrator."
192  echo "        Sufficient replicas exist for the pool to continue functioning in a"
193  echo "        degraded state."
194  echo "action: Online the device using 'zpool online' or replace the device with"
195  echo "        'zpool replace'."
196  echo " scrub: none requested"
197  echo "config:"
198  echo "	NAME          STATE     READ WRITE CKSUM"
199  echo "	${name0}      DEGRADED     0     0     0"
200  echo "	  mirror      DEGRADED     0     0     0"
201  echo "	    ${disk0}  OFFLINE      0     0     0"
202  echo "	    ${disk1}  OFFLINE      0     0     0"
203  echo "	    ${disk2}  ONLINE       0     0     0"
204  echo "errors: No known data errors"
205)`
206expect "${exp}" ${ZPOOL} status ${name0}
207add_msg=""
208expect_ok ${ZPOOL} export ${name0}
209expect_ok ${ZPOOL} import ${import_flags} ${name0}
210exp=`(
211  echo "  pool: ${name0}"
212  echo " state: DEGRADED"
213  echo "status: One or more devices has been taken offline by the administrator."
214  echo "        Sufficient replicas exist for the pool to continue functioning in a"
215  echo "        degraded state."
216  echo "action: Online the device using 'zpool online' or replace the device with"
217  echo "        'zpool replace'."
218  echo "config:"
219  echo "	NAME          STATE     READ WRITE CKSUM"
220  echo "	${name0}      DEGRADED     0     0     0"
221  echo "	  mirror      DEGRADED     0     0     0"
222  echo "	    ${disk0}  OFFLINE      0     0     0"
223  echo "	    ${disk1}  ONLINE       0     0     0"
224  echo "	    ${disk2}  ONLINE       0     0     0"
225  echo "errors: No known data errors"
226)`
227expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
228expect_ok ${ZPOOL} online ${name0} ${disk0}
229expect_ok ${ZPOOL} destroy ${name0}
230expect_fl ${ZPOOL} status -x ${name0}
231
232expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
233expect_ok ${ZPOOL} offline ${name0} ${disk0}
234expect_ok ${ZPOOL} offline -t ${name0} ${disk3}
235exp=`(
236  echo "  pool: ${name0}"
237  echo " state: DEGRADED"
238  echo "status: One or more devices has been taken offline by the administrator."
239  echo "        Sufficient replicas exist for the pool to continue functioning in a"
240  echo "        degraded state."
241  echo "action: Online the device using 'zpool online' or replace the device with"
242  echo "        'zpool replace'."
243  echo " scrub: none requested"
244  echo "config:"
245  echo "	NAME          STATE     READ WRITE CKSUM"
246  echo "	${name0}      DEGRADED     0     0     0"
247  echo "	  mirror      DEGRADED     0     0     0"
248  echo "	    ${disk0}  OFFLINE      0     0     0"
249  echo "	    ${disk1}  ONLINE       0     0     0"
250  echo "	  mirror      DEGRADED     0     0     0"
251  echo "	    ${disk2}  ONLINE       0     0     0"
252  echo "	    ${disk3}  OFFLINE      0     0     0"
253  echo "errors: No known data errors"
254)`
255expect "${exp}" ${ZPOOL} status ${name0}
256expect_ok ${ZPOOL} export ${name0}
257expect_ok ${ZPOOL} import ${import_flags} ${name0}
258exp=`(
259  echo "  pool: ${name0}"
260  echo " state: DEGRADED"
261  echo "status: One or more devices has been taken offline by the administrator."
262  echo "        Sufficient replicas exist for the pool to continue functioning in a"
263  echo "        degraded state."
264  echo "action: Online the device using 'zpool online' or replace the device with"
265  echo "        'zpool replace'."
266  echo "config:"
267  echo "	NAME          STATE     READ WRITE CKSUM"
268  echo "	${name0}      DEGRADED     0     0     0"
269  echo "	  mirror      DEGRADED     0     0     0"
270  echo "	    ${disk0}  OFFLINE      0     0     0"
271  echo "	    ${disk1}  ONLINE       0     0     0"
272  echo "	  mirror      ONLINE       0     0     0"
273  echo "	    ${disk2}  ONLINE       0     0     0"
274  echo "	    ${disk3}  ONLINE       0     0     0"
275  echo "errors: No known data errors"
276)`
277expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
278expect_ok ${ZPOOL} online ${name0} ${disk0}
279expect_ok ${ZPOOL} destroy ${name0}
280expect_fl ${ZPOOL} status -x ${name0}
281
282expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
283expect_ok ${ZPOOL} offline ${name0} ${disk0}
284exp=`(
285  echo "  pool: ${name0}"
286  echo " state: DEGRADED"
287  echo "status: One or more devices has been taken offline by the administrator."
288  echo "        Sufficient replicas exist for the pool to continue functioning in a"
289  echo "        degraded state."
290  echo "action: Online the device using 'zpool online' or replace the device with"
291  echo "        'zpool replace'."
292  echo " scrub: none requested"
293  echo "config:"
294  echo "	NAME          STATE     READ WRITE CKSUM"
295  echo "	${name0}      DEGRADED     0     0     0"
296  echo "	  raidz1      DEGRADED     0     0     0"
297  echo "	    ${disk0}  OFFLINE      0     0     0"
298  echo "	    ${disk1}  ONLINE       0     0     0"
299  echo "	    ${disk2}  ONLINE       0     0     0"
300  echo "errors: No known data errors"
301)`
302expect "${exp}" ${ZPOOL} status ${name0}
303expect_ok ${ZPOOL} export ${name0}
304expect_ok ${ZPOOL} import ${import_flags} ${name0}
305exp=`(
306  echo "  pool: ${name0}"
307  echo " state: DEGRADED"
308  echo "status: One or more devices has been taken offline by the administrator."
309  echo "        Sufficient replicas exist for the pool to continue functioning in a"
310  echo "        degraded state."
311  echo "action: Online the device using 'zpool online' or replace the device with"
312  echo "        'zpool replace'."
313  echo "config:"
314  echo "	NAME          STATE     READ WRITE CKSUM"
315  echo "	${name0}      DEGRADED     0     0     0"
316  echo "	  raidz1      DEGRADED     0     0     0"
317  echo "	    ${disk0}  OFFLINE      0     0     0"
318  echo "	    ${disk1}  ONLINE       0     0     0"
319  echo "	    ${disk2}  ONLINE       0     0     0"
320  echo "errors: No known data errors"
321)`
322expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
323expect_ok ${ZPOOL} online ${name0} ${disk0}
324expect_ok ${ZPOOL} destroy ${name0}
325expect_fl ${ZPOOL} status -x ${name0}
326
327expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
328expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
329exp=`(
330  echo "  pool: ${name0}"
331  echo " state: DEGRADED"
332  echo "status: One or more devices has been taken offline by the administrator."
333  echo "        Sufficient replicas exist for the pool to continue functioning in a"
334  echo "        degraded state."
335  echo "action: Online the device using 'zpool online' or replace the device with"
336  echo "        'zpool replace'."
337  echo " scrub: none requested"
338  echo "config:"
339  echo "	NAME          STATE     READ WRITE CKSUM"
340  echo "	${name0}      DEGRADED     0     0     0"
341  echo "	  raidz1      DEGRADED     0     0     0"
342  echo "	    ${disk0}  OFFLINE      0     0     0"
343  echo "	    ${disk1}  ONLINE       0     0     0"
344  echo "	    ${disk2}  ONLINE       0     0     0"
345  echo "errors: No known data errors"
346)`
347expect "${exp}" ${ZPOOL} status ${name0}
348expect_ok ${ZPOOL} export ${name0}
349expect_ok ${ZPOOL} import ${import_flags} ${name0}
350exp=`(
351  echo "  pool: ${name0}"
352  echo " state: ONLINE"
353  echo "config:"
354  echo "	NAME          STATE   READ WRITE CKSUM"
355  echo "	${name0}      ONLINE     0     0     0"
356  echo "	  raidz1      ONLINE     0     0     0"
357  echo "	    ${disk0}  ONLINE     0     0     0"
358  echo "	    ${disk1}  ONLINE     0     0     0"
359  echo "	    ${disk2}  ONLINE     0     0     0"
360  echo "errors: No known data errors"
361)`
362expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
363expect_ok ${ZPOOL} destroy ${name0}
364expect_fl ${ZPOOL} status -x ${name0}
365
366expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} raidz1 ${disk3} ${disk4} ${disk5}
367expect_ok ${ZPOOL} offline ${name0} ${disk1}
368expect_ok ${ZPOOL} offline -t ${name0} ${disk5}
369exp=`(
370  echo "  pool: ${name0}"
371  echo " state: DEGRADED"
372  echo "status: One or more devices has been taken offline by the administrator."
373  echo "        Sufficient replicas exist for the pool to continue functioning in a"
374  echo "        degraded state."
375  echo "action: Online the device using 'zpool online' or replace the device with"
376  echo "        'zpool replace'."
377  echo " scrub: none requested"
378  echo "config:"
379  echo "	NAME          STATE     READ WRITE CKSUM"
380  echo "	${name0}      DEGRADED     0     0     0"
381  echo "	  raidz1      DEGRADED     0     0     0"
382  echo "	    ${disk0}  ONLINE       0     0     0"
383  echo "	    ${disk1}  OFFLINE      0     0     0"
384  echo "	    ${disk2}  ONLINE       0     0     0"
385  echo "	  raidz1      DEGRADED     0     0     0"
386  echo "	    ${disk3}  ONLINE       0     0     0"
387  echo "	    ${disk4}  ONLINE       0     0     0"
388  echo "	    ${disk5}  OFFLINE      0     0     0"
389  echo "errors: No known data errors"
390)`
391expect "${exp}" ${ZPOOL} status ${name0}
392expect_ok ${ZPOOL} export ${name0}
393expect_ok ${ZPOOL} import ${import_flags} ${name0}
394exp=`(
395  echo "  pool: ${name0}"
396  echo " state: DEGRADED"
397  echo "status: One or more devices has been taken offline by the administrator."
398  echo "        Sufficient replicas exist for the pool to continue functioning in a"
399  echo "        degraded state."
400  echo "action: Online the device using 'zpool online' or replace the device with"
401  echo "        'zpool replace'."
402  echo "config:"
403  echo "	NAME          STATE     READ WRITE CKSUM"
404  echo "	${name0}      DEGRADED     0     0     0"
405  echo "	  raidz1      DEGRADED     0     0     0"
406  echo "	    ${disk0}  ONLINE       0     0     0"
407  echo "	    ${disk1}  OFFLINE      0     0     0"
408  echo "	    ${disk2}  ONLINE       0     0     0"
409  echo "	  raidz1      ONLINE       0     0     0"
410  echo "	    ${disk3}  ONLINE       0     0     0"
411  echo "	    ${disk4}  ONLINE       0     0     0"
412  echo "	    ${disk5}  ONLINE       0     0     0"
413  echo "errors: No known data errors"
414)`
415expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
416expect_ok ${ZPOOL} online ${name0} ${disk1}
417expect_ok ${ZPOOL} destroy ${name0}
418expect_fl ${ZPOOL} status -x ${name0}
419
420expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
421expect_ok ${ZPOOL} offline ${name0} ${disk0}
422exp=`(
423  echo "  pool: ${name0}"
424  echo " state: DEGRADED"
425  echo "status: One or more devices has been taken offline by the administrator."
426  echo "        Sufficient replicas exist for the pool to continue functioning in a"
427  echo "        degraded state."
428  echo "action: Online the device using 'zpool online' or replace the device with"
429  echo "        'zpool replace'."
430  echo " scrub: none requested"
431  echo "config:"
432  echo "	NAME          STATE     READ WRITE CKSUM"
433  echo "	${name0}      DEGRADED     0     0     0"
434  echo "	  raidz2      DEGRADED     0     0     0"
435  echo "	    ${disk0}  OFFLINE      0     0     0"
436  echo "	    ${disk1}  ONLINE       0     0     0"
437  echo "	    ${disk2}  ONLINE       0     0     0"
438  echo "	    ${disk3}  ONLINE       0     0     0"
439  echo "errors: No known data errors"
440)`
441expect "${exp}" ${ZPOOL} status ${name0}
442expect_ok ${ZPOOL} export ${name0}
443expect_ok ${ZPOOL} import ${import_flags} ${name0}
444exp=`(
445  echo "  pool: ${name0}"
446  echo " state: DEGRADED"
447  echo "status: One or more devices has been taken offline by the administrator."
448  echo "        Sufficient replicas exist for the pool to continue functioning in a"
449  echo "        degraded state."
450  echo "action: Online the device using 'zpool online' or replace the device with"
451  echo "        'zpool replace'."
452  echo "config:"
453  echo "	NAME          STATE     READ WRITE CKSUM"
454  echo "	${name0}      DEGRADED     0     0     0"
455  echo "	  raidz2      DEGRADED     0     0     0"
456  echo "	    ${disk0}  OFFLINE      0     0     0"
457  echo "	    ${disk1}  ONLINE       0     0     0"
458  echo "	    ${disk2}  ONLINE       0     0     0"
459  echo "	    ${disk3}  ONLINE       0     0     0"
460  echo "errors: No known data errors"
461)`
462expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
463expect_ok ${ZPOOL} online ${name0} ${disk0}
464expect_ok ${ZPOOL} destroy ${name0}
465expect_fl ${ZPOOL} status -x ${name0}
466
467expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
468expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
469exp=`(
470  echo "  pool: ${name0}"
471  echo " state: DEGRADED"
472  echo "status: One or more devices has been taken offline by the administrator."
473  echo "        Sufficient replicas exist for the pool to continue functioning in a"
474  echo "        degraded state."
475  echo "action: Online the device using 'zpool online' or replace the device with"
476  echo "        'zpool replace'."
477  echo " scrub: none requested"
478  echo "config:"
479  echo "	NAME          STATE     READ WRITE CKSUM"
480  echo "	${name0}      DEGRADED     0     0     0"
481  echo "	  raidz2      DEGRADED     0     0     0"
482  echo "	    ${disk0}  OFFLINE      0     0     0"
483  echo "	    ${disk1}  ONLINE       0     0     0"
484  echo "	    ${disk2}  ONLINE       0     0     0"
485  echo "	    ${disk3}  ONLINE       0     0     0"
486  echo "errors: No known data errors"
487)`
488expect "${exp}" ${ZPOOL} status ${name0}
489expect_ok ${ZPOOL} export ${name0}
490expect_ok ${ZPOOL} import ${import_flags} ${name0}
491exp=`(
492  echo "  pool: ${name0}"
493  echo " state: ONLINE"
494  echo "config:"
495  echo "	NAME          STATE   READ WRITE CKSUM"
496  echo "	${name0}      ONLINE     0     0     0"
497  echo "	  raidz2      ONLINE     0     0     0"
498  echo "	    ${disk0}  ONLINE     0     0     0"
499  echo "	    ${disk1}  ONLINE     0     0     0"
500  echo "	    ${disk2}  ONLINE     0     0     0"
501  echo "	    ${disk3}  ONLINE     0     0     0"
502  echo "errors: No known data errors"
503)`
504expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
505expect_ok ${ZPOOL} destroy ${name0}
506expect_fl ${ZPOOL} status -x ${name0}
507
508expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
509add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
510expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
511exp=`(
512  echo "  pool: ${name0}"
513  echo " state: DEGRADED"
514  echo "status: One or more devices has been taken offline by the administrator."
515  echo "        Sufficient replicas exist for the pool to continue functioning in a"
516  echo "        degraded state."
517  echo "action: Online the device using 'zpool online' or replace the device with"
518  echo "        'zpool replace'."
519  echo " scrub: none requested"
520  echo "config:"
521  echo "	NAME          STATE     READ WRITE CKSUM"
522  echo "	${name0}      DEGRADED     0     0     0"
523  echo "	  raidz2      DEGRADED     0     0     0"
524  echo "	    ${disk0}  OFFLINE      0     0     0"
525  echo "	    ${disk1}  OFFLINE      0     0     0"
526  echo "	    ${disk2}  ONLINE       0     0     0"
527  echo "	    ${disk3}  ONLINE       0     0     0"
528  echo "errors: No known data errors"
529)`
530expect "${exp}" ${ZPOOL} status ${name0}
531add_msg=""
532expect_ok ${ZPOOL} export ${name0}
533expect_ok ${ZPOOL} import ${import_flags} ${name0}
534exp=`(
535  echo "  pool: ${name0}"
536  echo " state: DEGRADED"
537  echo "status: One or more devices has been taken offline by the administrator."
538  echo "        Sufficient replicas exist for the pool to continue functioning in a"
539  echo "        degraded state."
540  echo "action: Online the device using 'zpool online' or replace the device with"
541  echo "        'zpool replace'."
542  echo "config:"
543  echo "	NAME          STATE     READ WRITE CKSUM"
544  echo "	${name0}      DEGRADED     0     0     0"
545  echo "	  raidz2      DEGRADED     0     0     0"
546  echo "	    ${disk0}  OFFLINE      0     0     0"
547  echo "	    ${disk1}  OFFLINE      0     0     0"
548  echo "	    ${disk2}  ONLINE       0     0     0"
549  echo "	    ${disk3}  ONLINE       0     0     0"
550  echo "errors: No known data errors"
551)`
552add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
553expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
554add_msg=""
555expect_ok ${ZPOOL} online ${name0} ${disk0}
556expect_ok ${ZPOOL} online ${name0} ${disk1}
557expect_ok ${ZPOOL} destroy ${name0}
558expect_fl ${ZPOOL} status -x ${name0}
559
560expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
561add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
562expect_ok ${ZPOOL} offline -t ${name0} ${disk0} ${disk1}
563exp=`(
564  echo "  pool: ${name0}"
565  echo " state: DEGRADED"
566  echo "status: One or more devices has been taken offline by the administrator."
567  echo "        Sufficient replicas exist for the pool to continue functioning in a"
568  echo "        degraded state."
569  echo "action: Online the device using 'zpool online' or replace the device with"
570  echo "        'zpool replace'."
571  echo " scrub: none requested"
572  echo "config:"
573  echo "	NAME          STATE     READ WRITE CKSUM"
574  echo "	${name0}      DEGRADED     0     0     0"
575  echo "	  raidz2      DEGRADED     0     0     0"
576  echo "	    ${disk0}  OFFLINE      0     0     0"
577  echo "	    ${disk1}  OFFLINE      0     0     0"
578  echo "	    ${disk2}  ONLINE       0     0     0"
579  echo "	    ${disk3}  ONLINE       0     0     0"
580  echo "errors: No known data errors"
581)`
582expect "${exp}" ${ZPOOL} status ${name0}
583add_msg=""
584expect_ok ${ZPOOL} export ${name0}
585expect_ok ${ZPOOL} import ${import_flags} ${name0}
586exp=`(
587  echo "  pool: ${name0}"
588  echo " state: ONLINE"
589  echo "config:"
590  echo "	NAME          STATE   READ WRITE CKSUM"
591  echo "	${name0}      ONLINE     0     0     0"
592  echo "	  raidz2      ONLINE     0     0     0"
593  echo "	    ${disk0}  ONLINE     0     0     0"
594  echo "	    ${disk1}  ONLINE     0     0     0"
595  echo "	    ${disk2}  ONLINE     0     0     0"
596  echo "	    ${disk3}  ONLINE     0     0     0"
597  echo "errors: No known data errors"
598)`
599expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
600expect_ok ${ZPOOL} destroy ${name0}
601expect_fl ${ZPOOL} status -x ${name0}
602
603expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
604expect_ok ${ZPOOL} offline ${name0} ${disk0}
605add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
606expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
607exp=`(
608  echo "  pool: ${name0}"
609  echo " state: DEGRADED"
610  echo "status: One or more devices has been taken offline by the administrator."
611  echo "        Sufficient replicas exist for the pool to continue functioning in a"
612  echo "        degraded state."
613  echo "action: Online the device using 'zpool online' or replace the device with"
614  echo "        'zpool replace'."
615  echo " scrub: none requested"
616  echo "config:"
617  echo "	NAME          STATE     READ WRITE CKSUM"
618  echo "	${name0}      DEGRADED     0     0     0"
619  echo "	  raidz2      DEGRADED     0     0     0"
620  echo "	    ${disk0}  OFFLINE      0     0     0"
621  echo "	    ${disk1}  OFFLINE      0     0     0"
622  echo "	    ${disk2}  ONLINE       0     0     0"
623  echo "	    ${disk3}  ONLINE       0     0     0"
624  echo "errors: No known data errors"
625)`
626expect "${exp}" ${ZPOOL} status ${name0}
627add_msg=""
628expect_ok ${ZPOOL} export ${name0}
629expect_ok ${ZPOOL} import ${import_flags} ${name0}
630exp=`(
631  echo "  pool: ${name0}"
632  echo " state: DEGRADED"
633  echo "status: One or more devices has been taken offline by the administrator."
634  echo "        Sufficient replicas exist for the pool to continue functioning in a"
635  echo "        degraded state."
636  echo "action: Online the device using 'zpool online' or replace the device with"
637  echo "        'zpool replace'."
638  echo "config:"
639  echo "	NAME          STATE     READ WRITE CKSUM"
640  echo "	${name0}      DEGRADED     0     0     0"
641  echo "	  raidz2      DEGRADED     0     0     0"
642  echo "	    ${disk0}  OFFLINE      0     0     0"
643  echo "	    ${disk1}  ONLINE       0     0     0"
644  echo "	    ${disk2}  ONLINE       0     0     0"
645  echo "	    ${disk3}  ONLINE       0     0     0"
646  echo "errors: No known data errors"
647)`
648expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
649expect_ok ${ZPOOL} online ${name0} ${disk0}
650expect_ok ${ZPOOL} destroy ${name0}
651expect_fl ${ZPOOL} status -x ${name0}
652
653expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
654expect_ok ${ZPOOL} offline ${name0} ${disk1}
655expect_ok ${ZPOOL} offline -t ${name0} ${disk6}
656exp=`(
657  echo "  pool: ${name0}"
658  echo " state: DEGRADED"
659  echo "status: One or more devices has been taken offline by the administrator."
660  echo "        Sufficient replicas exist for the pool to continue functioning in a"
661  echo "        degraded state."
662  echo "action: Online the device using 'zpool online' or replace the device with"
663  echo "        'zpool replace'."
664  echo " scrub: none requested"
665  echo "config:"
666  echo "	NAME          STATE     READ WRITE CKSUM"
667  echo "	${name0}      DEGRADED     0     0     0"
668  echo "	  raidz2      DEGRADED     0     0     0"
669  echo "	    ${disk0}  ONLINE       0     0     0"
670  echo "	    ${disk1}  OFFLINE      0     0     0"
671  echo "	    ${disk2}  ONLINE       0     0     0"
672  echo "	    ${disk3}  ONLINE       0     0     0"
673  echo "	  raidz2      DEGRADED     0     0     0"
674  echo "	    ${disk4}  ONLINE       0     0     0"
675  echo "	    ${disk5}  ONLINE       0     0     0"
676  echo "	    ${disk6}  OFFLINE      0     0     0"
677  echo "	    ${disk7}  ONLINE       0     0     0"
678  echo "errors: No known data errors"
679)`
680expect "${exp}" ${ZPOOL} status ${name0}
681expect_ok ${ZPOOL} export ${name0}
682expect_ok ${ZPOOL} import ${import_flags} ${name0}
683exp=`(
684  echo "  pool: ${name0}"
685  echo " state: DEGRADED"
686  echo "status: One or more devices has been taken offline by the administrator."
687  echo "        Sufficient replicas exist for the pool to continue functioning in a"
688  echo "        degraded state."
689  echo "action: Online the device using 'zpool online' or replace the device with"
690  echo "        'zpool replace'."
691  echo "config:"
692  echo "	NAME          STATE     READ WRITE CKSUM"
693  echo "	${name0}      DEGRADED     0     0     0"
694  echo "	  raidz2      DEGRADED     0     0     0"
695  echo "	    ${disk0}  ONLINE       0     0     0"
696  echo "	    ${disk1}  OFFLINE      0     0     0"
697  echo "	    ${disk2}  ONLINE       0     0     0"
698  echo "	    ${disk3}  ONLINE       0     0     0"
699  echo "	  raidz2      ONLINE       0     0     0"
700  echo "	    ${disk4}  ONLINE       0     0     0"
701  echo "	    ${disk5}  ONLINE       0     0     0"
702  echo "	    ${disk6}  ONLINE       0     0     0"
703  echo "	    ${disk7}  ONLINE       0     0     0"
704  echo "errors: No known data errors"
705)`
706expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
707expect_ok ${ZPOOL} online ${name0} ${disk1}
708expect_ok ${ZPOOL} destroy ${name0}
709expect_fl ${ZPOOL} status -x ${name0}
710
711expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
712expect_ok ${ZPOOL} offline ${name0} ${disk1}
713exp=`(
714  echo "  pool: ${name0}"
715  echo " state: DEGRADED"
716  echo "status: One or more devices has been taken offline by the administrator."
717  echo "        Sufficient replicas exist for the pool to continue functioning in a"
718  echo "        degraded state."
719  echo "action: Online the device using 'zpool online' or replace the device with"
720  echo "        'zpool replace'."
721  echo " scrub: none requested"
722  echo "config:"
723  echo "	NAME          STATE     READ WRITE CKSUM"
724  echo "	${name0}      DEGRADED     0     0     0"
725  echo "	  ${disk0}    ONLINE       0     0     0"
726  echo "	logs          DEGRADED     0     0     0"
727  echo "	  mirror      DEGRADED     0     0     0"
728  echo "	    ${disk1}  OFFLINE      0     0     0"
729  echo "	    ${disk2}  ONLINE       0     0     0"
730  echo "errors: No known data errors"
731)`
732expect "${exp}" ${ZPOOL} status ${name0}
733expect_ok ${ZPOOL} export ${name0}
734expect_ok ${ZPOOL} import ${import_flags} ${name0}
735exp=`(
736  echo "  pool: ${name0}"
737  echo " state: DEGRADED"
738  echo "status: One or more devices has been taken offline by the administrator."
739  echo "        Sufficient replicas exist for the pool to continue functioning in a"
740  echo "        degraded state."
741  echo "action: Online the device using 'zpool online' or replace the device with"
742  echo "        'zpool replace'."
743  echo " scrub: none requested"
744  echo "config:"
745  echo "	NAME          STATE     READ WRITE CKSUM"
746  echo "	${name0}      DEGRADED     0     0     0"
747  echo "	  ${disk0}    ONLINE       0     0     0"
748  echo "	logs          DEGRADED     0     0     0"
749  echo "	  mirror      DEGRADED     0     0     0"
750  echo "	    ${disk1}  OFFLINE      0     0     0"
751  echo "	    ${disk2}  ONLINE       0     0     0"
752  echo "errors: No known data errors"
753)`
754expect "${exp}" ${ZPOOL} status ${name0}
755expect_ok ${ZPOOL} online ${name0} ${disk1}
756expect_ok ${ZPOOL} destroy ${name0}
757expect_fl ${ZPOOL} status -x ${name0}
758
759expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
760expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
761exp=`(
762  echo "  pool: ${name0}"
763  echo " state: DEGRADED"
764  echo "status: One or more devices has been taken offline by the administrator."
765  echo "        Sufficient replicas exist for the pool to continue functioning in a"
766  echo "        degraded state."
767  echo "action: Online the device using 'zpool online' or replace the device with"
768  echo "        'zpool replace'."
769  echo " scrub: none requested"
770  echo "config:"
771  echo "	NAME          STATE     READ WRITE CKSUM"
772  echo "	${name0}      DEGRADED     0     0     0"
773  echo "	  ${disk0}    ONLINE       0     0     0"
774  echo "	logs          DEGRADED     0     0     0"
775  echo "	  mirror      DEGRADED     0     0     0"
776  echo "	    ${disk1}  OFFLINE      0     0     0"
777  echo "	    ${disk2}  ONLINE       0     0     0"
778  echo "errors: No known data errors"
779)`
780expect "${exp}" ${ZPOOL} status ${name0}
781expect_ok ${ZPOOL} export ${name0}
782expect_ok ${ZPOOL} import ${import_flags} ${name0}
783exp=`(
784  echo "  pool: ${name0}"
785  echo " state: ONLINE"
786  echo " scrub: none requested"
787  echo "config:"
788  echo "	NAME          STATE   READ WRITE CKSUM"
789  echo "	${name0}      ONLINE     0     0     0"
790  echo "	  ${disk0}    ONLINE     0     0     0"
791  echo "	logs          ONLINE     0     0     0"
792  echo "	  mirror      ONLINE     0     0     0"
793  echo "	    ${disk1}  ONLINE     0     0     0"
794  echo "	    ${disk2}  ONLINE     0     0     0"
795  echo "errors: No known data errors"
796)`
797expect "${exp}" ${ZPOOL} status ${name0}
798expect_ok ${ZPOOL} destroy ${name0}
799expect_fl ${ZPOOL} status -x ${name0}
800
801expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
802expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
803exp=`(
804  echo "  pool: ${name0}"
805  echo " state: DEGRADED"
806  echo "status: One or more devices has been taken offline by the administrator."
807  echo "        Sufficient replicas exist for the pool to continue functioning in a"
808  echo "        degraded state."
809  echo "action: Online the device using 'zpool online' or replace the device with"
810  echo "        'zpool replace'."
811  echo " scrub: none requested"
812  echo "config:"
813  echo "	NAME          STATE     READ WRITE CKSUM"
814  echo "	${name0}      DEGRADED     0     0     0"
815  echo "	  ${disk0}    ONLINE       0     0     0"
816  echo "	logs          DEGRADED     0     0     0"
817  echo "	  mirror      DEGRADED     0     0     0"
818  echo "	    ${disk1}  OFFLINE      0     0     0"
819  echo "	    ${disk2}  OFFLINE      0     0     0"
820  echo "	    ${disk3}  ONLINE       0     0     0"
821  echo "errors: No known data errors"
822)`
823expect "${exp}" ${ZPOOL} status ${name0}
824expect_ok ${ZPOOL} export ${name0}
825expect_ok ${ZPOOL} import ${import_flags} ${name0}
826exp=`(
827  echo "  pool: ${name0}"
828  echo " state: DEGRADED"
829  echo "status: One or more devices has been taken offline by the administrator."
830  echo "        Sufficient replicas exist for the pool to continue functioning in a"
831  echo "        degraded state."
832  echo "action: Online the device using 'zpool online' or replace the device with"
833  echo "        'zpool replace'."
834  echo " scrub: none requested"
835  echo "config:"
836  echo "	NAME          STATE     READ WRITE CKSUM"
837  echo "	${name0}      DEGRADED     0     0     0"
838  echo "	  ${disk0}    ONLINE       0     0     0"
839  echo "	logs          DEGRADED     0     0     0"
840  echo "	  mirror      DEGRADED     0     0     0"
841  echo "	    ${disk1}  OFFLINE      0     0     0"
842  echo "	    ${disk2}  OFFLINE      0     0     0"
843  echo "	    ${disk3}  ONLINE       0     0     0"
844  echo "errors: No known data errors"
845)`
846expect "${exp}" ${ZPOOL} status ${name0}
847expect_ok ${ZPOOL} online ${name0} ${disk1}
848expect_ok ${ZPOOL} online ${name0} ${disk2}
849expect_ok ${ZPOOL} destroy ${name0}
850expect_fl ${ZPOOL} status -x ${name0}
851
852expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
853expect_ok ${ZPOOL} offline -t ${name0} ${disk1} ${disk2}
854exp=`(
855  echo "  pool: ${name0}"
856  echo " state: DEGRADED"
857  echo "status: One or more devices has been taken offline by the administrator."
858  echo "        Sufficient replicas exist for the pool to continue functioning in a"
859  echo "        degraded state."
860  echo "action: Online the device using 'zpool online' or replace the device with"
861  echo "        'zpool replace'."
862  echo " scrub: none requested"
863  echo "config:"
864  echo "	NAME          STATE     READ WRITE CKSUM"
865  echo "	${name0}      DEGRADED     0     0     0"
866  echo "	  ${disk0}    ONLINE       0     0     0"
867  echo "	logs          DEGRADED     0     0     0"
868  echo "	  mirror      DEGRADED     0     0     0"
869  echo "	    ${disk1}  OFFLINE      0     0     0"
870  echo "	    ${disk2}  OFFLINE      0     0     0"
871  echo "	    ${disk3}  ONLINE       0     0     0"
872  echo "errors: No known data errors"
873)`
874expect "${exp}" ${ZPOOL} status ${name0}
875expect_ok ${ZPOOL} export ${name0}
876expect_ok ${ZPOOL} import ${import_flags} ${name0}
877exp=`(
878  echo "  pool: ${name0}"
879  echo " state: ONLINE"
880  echo " scrub: none requested"
881  echo "config:"
882  echo "	NAME          STATE   READ WRITE CKSUM"
883  echo "	${name0}      ONLINE     0     0     0"
884  echo "	  ${disk0}    ONLINE     0     0     0"
885  echo "	logs          ONLINE     0     0     0"
886  echo "	  mirror      ONLINE     0     0     0"
887  echo "	    ${disk1}  ONLINE     0     0     0"
888  echo "	    ${disk2}  ONLINE     0     0     0"
889  echo "	    ${disk3}  ONLINE     0     0     0"
890  echo "errors: No known data errors"
891)`
892expect "${exp}" ${ZPOOL} status ${name0}
893expect_ok ${ZPOOL} destroy ${name0}
894expect_fl ${ZPOOL} status -x ${name0}
895
896expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
897expect_ok ${ZPOOL} offline ${name0} ${disk1}
898expect_ok ${ZPOOL} offline -t ${name0} ${disk2}
899exp=`(
900  echo "  pool: ${name0}"
901  echo " state: DEGRADED"
902  echo "status: One or more devices has been taken offline by the administrator."
903  echo "        Sufficient replicas exist for the pool to continue functioning in a"
904  echo "        degraded state."
905  echo "action: Online the device using 'zpool online' or replace the device with"
906  echo "        'zpool replace'."
907  echo " scrub: none requested"
908  echo "config:"
909  echo "	NAME          STATE     READ WRITE CKSUM"
910  echo "	${name0}      DEGRADED     0     0     0"
911  echo "	  ${disk0}    ONLINE       0     0     0"
912  echo "	logs          DEGRADED     0     0     0"
913  echo "	  mirror      DEGRADED     0     0     0"
914  echo "	    ${disk1}  OFFLINE      0     0     0"
915  echo "	    ${disk2}  OFFLINE      0     0     0"
916  echo "	    ${disk3}  ONLINE       0     0     0"
917  echo "errors: No known data errors"
918)`
919expect "${exp}" ${ZPOOL} status ${name0}
920expect_ok ${ZPOOL} export ${name0}
921expect_ok ${ZPOOL} import ${import_flags} ${name0}
922exp=`(
923  echo "  pool: ${name0}"
924  echo " state: DEGRADED"
925  echo "status: One or more devices has been taken offline by the administrator."
926  echo "        Sufficient replicas exist for the pool to continue functioning in a"
927  echo "        degraded state."
928  echo "action: Online the device using 'zpool online' or replace the device with"
929  echo "        'zpool replace'."
930  echo " scrub: none requested"
931  echo "config:"
932  echo "	NAME          STATE     READ WRITE CKSUM"
933  echo "	${name0}      DEGRADED     0     0     0"
934  echo "	  ${disk0}    ONLINE       0     0     0"
935  echo "	logs          DEGRADED     0     0     0"
936  echo "	  mirror      DEGRADED     0     0     0"
937  echo "	    ${disk1}  OFFLINE      0     0     0"
938  echo "	    ${disk2}  ONLINE       0     0     0"
939  echo "	    ${disk3}  ONLINE       0     0     0"
940  echo "errors: No known data errors"
941)`
942expect "${exp}" ${ZPOOL} status ${name0}
943expect_ok ${ZPOOL} online ${name0} ${disk1}
944expect_ok ${ZPOOL} destroy ${name0}
945expect_fl ${ZPOOL} status -x ${name0}
946
947expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4}
948expect_ok ${ZPOOL} offline ${name0} ${disk1}
949expect_ok ${ZPOOL} offline -t ${name0} ${disk3}
950exp=`(
951  echo "  pool: ${name0}"
952  echo " state: DEGRADED"
953  echo "status: One or more devices has been taken offline by the administrator."
954  echo "        Sufficient replicas exist for the pool to continue functioning in a"
955  echo "        degraded state."
956  echo "action: Online the device using 'zpool online' or replace the device with"
957  echo "        'zpool replace'."
958  echo " scrub: none requested"
959  echo "config:"
960  echo "	NAME          STATE     READ WRITE CKSUM"
961  echo "	${name0}      DEGRADED     0     0     0"
962  echo "	  ${disk0}    ONLINE       0     0     0"
963  echo "	logs          DEGRADED     0     0     0"
964  echo "	  mirror      DEGRADED     0     0     0"
965  echo "	    ${disk1}  OFFLINE      0     0     0"
966  echo "	    ${disk2}  ONLINE       0     0     0"
967  echo "	  mirror      DEGRADED     0     0     0"
968  echo "	    ${disk3}  OFFLINE      0     0     0"
969  echo "	    ${disk4}  ONLINE       0     0     0"
970  echo "errors: No known data errors"
971)`
972expect "${exp}" ${ZPOOL} status ${name0}
973expect_ok ${ZPOOL} export ${name0}
974expect_ok ${ZPOOL} import ${import_flags} ${name0}
975exp=`(
976  echo "  pool: ${name0}"
977  echo " state: DEGRADED"
978  echo "status: One or more devices has been taken offline by the administrator."
979  echo "        Sufficient replicas exist for the pool to continue functioning in a"
980  echo "        degraded state."
981  echo "action: Online the device using 'zpool online' or replace the device with"
982  echo "        'zpool replace'."
983  echo " scrub: none requested"
984  echo "config:"
985  echo "	NAME          STATE     READ WRITE CKSUM"
986  echo "	${name0}      DEGRADED     0     0     0"
987  echo "	  ${disk0}    ONLINE       0     0     0"
988  echo "	logs          DEGRADED     0     0     0"
989  echo "	  mirror      DEGRADED     0     0     0"
990  echo "	    ${disk1}  OFFLINE      0     0     0"
991  echo "	    ${disk2}  ONLINE       0     0     0"
992  echo "	  mirror      ONLINE       0     0     0"
993  echo "	    ${disk3}  ONLINE       0     0     0"
994  echo "	    ${disk4}  ONLINE       0     0     0"
995  echo "errors: No known data errors"
996)`
997expect "${exp}" ${ZPOOL} status ${name0}
998expect_ok ${ZPOOL} online ${name0} ${disk1}
999expect_ok ${ZPOOL} destroy ${name0}
1000expect_fl ${ZPOOL} status -x ${name0}
1001
1002expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
1003expect_ok ${ZPOOL} offline ${name0} ${disk1}
1004exp=`(
1005  echo "  pool: ${name0}"
1006  echo " state: ONLINE"
1007  echo " scrub: none requested"
1008  echo "config:"
1009  echo "	NAME        STATE    READ WRITE CKSUM"
1010  echo "	${name0}    ONLINE      0     0     0"
1011  echo "	  ${disk0}  ONLINE      0     0     0"
1012  echo "	cache"
1013  echo "	  ${disk1}  OFFLINE     0     0     0"
1014  echo "	  ${disk2}  ONLINE      0     0     0"
1015  echo "errors: No known data errors"
1016)`
1017expect "${exp}" ${ZPOOL} status ${name0}
1018expect_ok ${ZPOOL} export ${name0}
1019expect_ok ${ZPOOL} import ${import_flags} ${name0}
1020exp=`(
1021  echo "  pool: ${name0}"
1022  echo " state: ONLINE"
1023  echo " scrub: none requested"
1024  echo "config:"
1025  echo "	NAME        STATE    READ WRITE CKSUM"
1026  echo "	${name0}    ONLINE      0     0     0"
1027  echo "	  ${disk0}  ONLINE      0     0     0"
1028  echo "	cache"
1029  echo "	  ${disk1}  OFFLINE     0     0     0"
1030  echo "	  ${disk2}  ONLINE      0     0     0"
1031  echo "errors: No known data errors"
1032)`
1033expect "${exp}" ${ZPOOL} status ${name0}
1034expect_ok ${ZPOOL} online ${name0} ${disk1}
1035expect_ok ${ZPOOL} destroy ${name0}
1036expect_fl ${ZPOOL} status -x ${name0}
1037
1038expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
1039expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
1040exp=`(
1041  echo "  pool: ${name0}"
1042  echo " state: ONLINE"
1043  echo " scrub: none requested"
1044  echo "config:"
1045  echo "	NAME        STATE    READ WRITE CKSUM"
1046  echo "	${name0}    ONLINE      0     0     0"
1047  echo "	  ${disk0}  ONLINE      0     0     0"
1048  echo "	cache"
1049  echo "	  ${disk1}  OFFLINE     0     0     0"
1050  echo "	  ${disk2}  ONLINE      0     0     0"
1051  echo "errors: No known data errors"
1052)`
1053expect "${exp}" ${ZPOOL} status ${name0}
1054expect_ok ${ZPOOL} export ${name0}
1055expect_ok ${ZPOOL} import ${import_flags} ${name0}
1056exp=`(
1057  echo "  pool: ${name0}"
1058  echo " state: ONLINE"
1059  echo " scrub: none requested"
1060  echo "config:"
1061  echo "	NAME        STATE    READ WRITE CKSUM"
1062  echo "	${name0}    ONLINE      0     0     0"
1063  echo "	  ${disk0}  ONLINE      0     0     0"
1064  echo "	cache"
1065  echo "	  ${disk1}  ONLINE      0     0     0"
1066  echo "	  ${disk2}  ONLINE      0     0     0"
1067  echo "errors: No known data errors"
1068)`
1069expect "${exp}" ${ZPOOL} status ${name0}
1070expect_ok ${ZPOOL} destroy ${name0}
1071expect_fl ${ZPOOL} status -x ${name0}
1072
1073expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
1074expect_ok ${ZPOOL} offline ${name0} ${disk1}
1075expect_ok ${ZPOOL} offline -t ${name0} ${disk2}
1076exp=`(
1077  echo "  pool: ${name0}"
1078  echo " state: ONLINE"
1079  echo " scrub: none requested"
1080  echo "config:"
1081  echo "	NAME        STATE    READ WRITE CKSUM"
1082  echo "	${name0}    ONLINE      0     0     0"
1083  echo "	  ${disk0}  ONLINE      0     0     0"
1084  echo "	cache"
1085  echo "	  ${disk1}  OFFLINE     0     0     0"
1086  echo "	  ${disk2}  OFFLINE     0     0     0"
1087  echo "errors: No known data errors"
1088)`
1089expect "${exp}" ${ZPOOL} status ${name0}
1090expect_ok ${ZPOOL} export ${name0}
1091expect_ok ${ZPOOL} import ${import_flags} ${name0}
1092exp=`(
1093  echo "  pool: ${name0}"
1094  echo " state: ONLINE"
1095  echo " scrub: none requested"
1096  echo "config:"
1097  echo "	NAME        STATE    READ WRITE CKSUM"
1098  echo "	${name0}    ONLINE      0     0     0"
1099  echo "	  ${disk0}  ONLINE      0     0     0"
1100  echo "	cache"
1101  echo "	  ${disk1}  OFFLINE     0     0     0"
1102  echo "	  ${disk2}  ONLINE      0     0     0"
1103  echo "errors: No known data errors"
1104)`
1105expect "${exp}" ${ZPOOL} status ${name0}
1106expect_ok ${ZPOOL} online ${name0} ${disk1}
1107expect_ok ${ZPOOL} destroy ${name0}
1108expect_fl ${ZPOOL} status -x ${name0}
1109
1110disks_destroy
1111