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