]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/zfs/zpool/offline/option-t.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / zfs / zpool / offline / option-t.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 dir=`dirname $0`
5 . ${dir}/../../misc.sh
6
7 echo "1..219"
8
9 disks_create 8
10 names_create 1
11
12 expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
13 expect_ok ${ZPOOL} offline ${name0} ${disk0}
14 exp=`(
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 )`
31 expect "${exp}" ${ZPOOL} status ${name0}
32 expect_ok ${ZPOOL} export ${name0}
33 expect_ok ${ZPOOL} import ${import_flags} ${name0}
34 exp=`(
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 )`
51 expect "${exp}" ${ZPOOL} status ${name0}
52 expect_ok ${ZPOOL} online ${name0} ${disk0}
53 expect_ok ${ZPOOL} destroy ${name0}
54 expect_fl ${ZPOOL} status -x ${name0}
55
56 expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
57 expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
58 exp=`(
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 )`
75 expect "${exp}" ${ZPOOL} status ${name0}
76 expect_ok ${ZPOOL} export ${name0}
77 expect_ok ${ZPOOL} import ${import_flags} ${name0}
78 exp=`(
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 )`
89 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
90 expect_ok ${ZPOOL} destroy ${name0}
91 expect_fl ${ZPOOL} status -x ${name0}
92
93 expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
94 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
95 expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
96 exp=`(
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 )`
114 expect "${exp}" ${ZPOOL} status ${name0}
115 add_msg=""
116 expect_ok ${ZPOOL} export ${name0}
117 expect_ok ${ZPOOL} import ${import_flags} ${name0}
118 exp=`(
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 )`
135 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
136 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
137 add_msg=""
138 expect_ok ${ZPOOL} online ${name0} ${disk0}
139 expect_ok ${ZPOOL} online ${name0} ${disk1}
140 expect_ok ${ZPOOL} destroy ${name0}
141 expect_fl ${ZPOOL} status -x ${name0}
142
143 expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
144 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
145 expect_ok ${ZPOOL} offline -t ${name0} ${disk0} ${disk1}
146 exp=`(
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 )`
164 expect "${exp}" ${ZPOOL} status ${name0}
165 add_msg=""
166 expect_ok ${ZPOOL} export ${name0}
167 expect_ok ${ZPOOL} import ${import_flags} ${name0}
168 exp=`(
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 )`
180 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
181 expect_ok ${ZPOOL} destroy ${name0}
182 expect_fl ${ZPOOL} status -x ${name0}
183
184 expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} ${disk2}
185 expect_ok ${ZPOOL} offline ${name0} ${disk0}
186 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
187 expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
188 exp=`(
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 )`
206 expect "${exp}" ${ZPOOL} status ${name0}
207 add_msg=""
208 expect_ok ${ZPOOL} export ${name0}
209 expect_ok ${ZPOOL} import ${import_flags} ${name0}
210 exp=`(
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 )`
227 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
228 expect_ok ${ZPOOL} online ${name0} ${disk0}
229 expect_ok ${ZPOOL} destroy ${name0}
230 expect_fl ${ZPOOL} status -x ${name0}
231
232 expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3}
233 expect_ok ${ZPOOL} offline ${name0} ${disk0}
234 expect_ok ${ZPOOL} offline -t ${name0} ${disk3}
235 exp=`(
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 )`
255 expect "${exp}" ${ZPOOL} status ${name0}
256 expect_ok ${ZPOOL} export ${name0}
257 expect_ok ${ZPOOL} import ${import_flags} ${name0}
258 exp=`(
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 )`
277 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
278 expect_ok ${ZPOOL} online ${name0} ${disk0}
279 expect_ok ${ZPOOL} destroy ${name0}
280 expect_fl ${ZPOOL} status -x ${name0}
281
282 expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
283 expect_ok ${ZPOOL} offline ${name0} ${disk0}
284 exp=`(
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 )`
302 expect "${exp}" ${ZPOOL} status ${name0}
303 expect_ok ${ZPOOL} export ${name0}
304 expect_ok ${ZPOOL} import ${import_flags} ${name0}
305 exp=`(
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 )`
322 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
323 expect_ok ${ZPOOL} online ${name0} ${disk0}
324 expect_ok ${ZPOOL} destroy ${name0}
325 expect_fl ${ZPOOL} status -x ${name0}
326
327 expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
328 expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
329 exp=`(
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 )`
347 expect "${exp}" ${ZPOOL} status ${name0}
348 expect_ok ${ZPOOL} export ${name0}
349 expect_ok ${ZPOOL} import ${import_flags} ${name0}
350 exp=`(
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 )`
362 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
363 expect_ok ${ZPOOL} destroy ${name0}
364 expect_fl ${ZPOOL} status -x ${name0}
365
366 expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} raidz1 ${disk3} ${disk4} ${disk5}
367 expect_ok ${ZPOOL} offline ${name0} ${disk1}
368 expect_ok ${ZPOOL} offline -t ${name0} ${disk5}
369 exp=`(
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 )`
391 expect "${exp}" ${ZPOOL} status ${name0}
392 expect_ok ${ZPOOL} export ${name0}
393 expect_ok ${ZPOOL} import ${import_flags} ${name0}
394 exp=`(
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 )`
415 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
416 expect_ok ${ZPOOL} online ${name0} ${disk1}
417 expect_ok ${ZPOOL} destroy ${name0}
418 expect_fl ${ZPOOL} status -x ${name0}
419
420 expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
421 expect_ok ${ZPOOL} offline ${name0} ${disk0}
422 exp=`(
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 )`
441 expect "${exp}" ${ZPOOL} status ${name0}
442 expect_ok ${ZPOOL} export ${name0}
443 expect_ok ${ZPOOL} import ${import_flags} ${name0}
444 exp=`(
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 )`
462 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
463 expect_ok ${ZPOOL} online ${name0} ${disk0}
464 expect_ok ${ZPOOL} destroy ${name0}
465 expect_fl ${ZPOOL} status -x ${name0}
466
467 expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
468 expect_ok ${ZPOOL} offline -t ${name0} ${disk0}
469 exp=`(
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 )`
488 expect "${exp}" ${ZPOOL} status ${name0}
489 expect_ok ${ZPOOL} export ${name0}
490 expect_ok ${ZPOOL} import ${import_flags} ${name0}
491 exp=`(
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 )`
504 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
505 expect_ok ${ZPOOL} destroy ${name0}
506 expect_fl ${ZPOOL} status -x ${name0}
507
508 expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
509 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
510 expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
511 exp=`(
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 )`
530 expect "${exp}" ${ZPOOL} status ${name0}
531 add_msg=""
532 expect_ok ${ZPOOL} export ${name0}
533 expect_ok ${ZPOOL} import ${import_flags} ${name0}
534 exp=`(
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 )`
552 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
553 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
554 add_msg=""
555 expect_ok ${ZPOOL} online ${name0} ${disk0}
556 expect_ok ${ZPOOL} online ${name0} ${disk1}
557 expect_ok ${ZPOOL} destroy ${name0}
558 expect_fl ${ZPOOL} status -x ${name0}
559
560 expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
561 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
562 expect_ok ${ZPOOL} offline -t ${name0} ${disk0} ${disk1}
563 exp=`(
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 )`
582 expect "${exp}" ${ZPOOL} status ${name0}
583 add_msg=""
584 expect_ok ${ZPOOL} export ${name0}
585 expect_ok ${ZPOOL} import ${import_flags} ${name0}
586 exp=`(
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 )`
599 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
600 expect_ok ${ZPOOL} destroy ${name0}
601 expect_fl ${ZPOOL} status -x ${name0}
602
603 expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
604 expect_ok ${ZPOOL} offline ${name0} ${disk0}
605 add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
606 expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
607 exp=`(
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 )`
626 expect "${exp}" ${ZPOOL} status ${name0}
627 add_msg=""
628 expect_ok ${ZPOOL} export ${name0}
629 expect_ok ${ZPOOL} import ${import_flags} ${name0}
630 exp=`(
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 )`
648 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
649 expect_ok ${ZPOOL} online ${name0} ${disk0}
650 expect_ok ${ZPOOL} destroy ${name0}
651 expect_fl ${ZPOOL} status -x ${name0}
652
653 expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
654 expect_ok ${ZPOOL} offline ${name0} ${disk1}
655 expect_ok ${ZPOOL} offline -t ${name0} ${disk6}
656 exp=`(
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 )`
680 expect "${exp}" ${ZPOOL} status ${name0}
681 expect_ok ${ZPOOL} export ${name0}
682 expect_ok ${ZPOOL} import ${import_flags} ${name0}
683 exp=`(
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 )`
706 expect "${exp}" ${ZPOOL} status ${name0} \| grep -v 'scrub:'
707 expect_ok ${ZPOOL} online ${name0} ${disk1}
708 expect_ok ${ZPOOL} destroy ${name0}
709 expect_fl ${ZPOOL} status -x ${name0}
710
711 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
712 expect_ok ${ZPOOL} offline ${name0} ${disk1}
713 exp=`(
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 )`
732 expect "${exp}" ${ZPOOL} status ${name0}
733 expect_ok ${ZPOOL} export ${name0}
734 expect_ok ${ZPOOL} import ${import_flags} ${name0}
735 exp=`(
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 )`
754 expect "${exp}" ${ZPOOL} status ${name0}
755 expect_ok ${ZPOOL} online ${name0} ${disk1}
756 expect_ok ${ZPOOL} destroy ${name0}
757 expect_fl ${ZPOOL} status -x ${name0}
758
759 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
760 expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
761 exp=`(
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 )`
780 expect "${exp}" ${ZPOOL} status ${name0}
781 expect_ok ${ZPOOL} export ${name0}
782 expect_ok ${ZPOOL} import ${import_flags} ${name0}
783 exp=`(
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 )`
797 expect "${exp}" ${ZPOOL} status ${name0}
798 expect_ok ${ZPOOL} destroy ${name0}
799 expect_fl ${ZPOOL} status -x ${name0}
800
801 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
802 expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
803 exp=`(
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 )`
823 expect "${exp}" ${ZPOOL} status ${name0}
824 expect_ok ${ZPOOL} export ${name0}
825 expect_ok ${ZPOOL} import ${import_flags} ${name0}
826 exp=`(
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 )`
846 expect "${exp}" ${ZPOOL} status ${name0}
847 expect_ok ${ZPOOL} online ${name0} ${disk1}
848 expect_ok ${ZPOOL} online ${name0} ${disk2}
849 expect_ok ${ZPOOL} destroy ${name0}
850 expect_fl ${ZPOOL} status -x ${name0}
851
852 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
853 expect_ok ${ZPOOL} offline -t ${name0} ${disk1} ${disk2}
854 exp=`(
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 )`
874 expect "${exp}" ${ZPOOL} status ${name0}
875 expect_ok ${ZPOOL} export ${name0}
876 expect_ok ${ZPOOL} import ${import_flags} ${name0}
877 exp=`(
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 )`
892 expect "${exp}" ${ZPOOL} status ${name0}
893 expect_ok ${ZPOOL} destroy ${name0}
894 expect_fl ${ZPOOL} status -x ${name0}
895
896 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
897 expect_ok ${ZPOOL} offline ${name0} ${disk1}
898 expect_ok ${ZPOOL} offline -t ${name0} ${disk2}
899 exp=`(
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 )`
919 expect "${exp}" ${ZPOOL} status ${name0}
920 expect_ok ${ZPOOL} export ${name0}
921 expect_ok ${ZPOOL} import ${import_flags} ${name0}
922 exp=`(
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 )`
942 expect "${exp}" ${ZPOOL} status ${name0}
943 expect_ok ${ZPOOL} online ${name0} ${disk1}
944 expect_ok ${ZPOOL} destroy ${name0}
945 expect_fl ${ZPOOL} status -x ${name0}
946
947 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4}
948 expect_ok ${ZPOOL} offline ${name0} ${disk1}
949 expect_ok ${ZPOOL} offline -t ${name0} ${disk3}
950 exp=`(
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 )`
972 expect "${exp}" ${ZPOOL} status ${name0}
973 expect_ok ${ZPOOL} export ${name0}
974 expect_ok ${ZPOOL} import ${import_flags} ${name0}
975 exp=`(
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 )`
997 expect "${exp}" ${ZPOOL} status ${name0}
998 expect_ok ${ZPOOL} online ${name0} ${disk1}
999 expect_ok ${ZPOOL} destroy ${name0}
1000 expect_fl ${ZPOOL} status -x ${name0}
1001
1002 expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
1003 expect_ok ${ZPOOL} offline ${name0} ${disk1}
1004 exp=`(
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 )`
1017 expect "${exp}" ${ZPOOL} status ${name0}
1018 expect_ok ${ZPOOL} export ${name0}
1019 expect_ok ${ZPOOL} import ${import_flags} ${name0}
1020 exp=`(
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 )`
1033 expect "${exp}" ${ZPOOL} status ${name0}
1034 expect_ok ${ZPOOL} online ${name0} ${disk1}
1035 expect_ok ${ZPOOL} destroy ${name0}
1036 expect_fl ${ZPOOL} status -x ${name0}
1037
1038 expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
1039 expect_ok ${ZPOOL} offline -t ${name0} ${disk1}
1040 exp=`(
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 )`
1053 expect "${exp}" ${ZPOOL} status ${name0}
1054 expect_ok ${ZPOOL} export ${name0}
1055 expect_ok ${ZPOOL} import ${import_flags} ${name0}
1056 exp=`(
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 )`
1069 expect "${exp}" ${ZPOOL} status ${name0}
1070 expect_ok ${ZPOOL} destroy ${name0}
1071 expect_fl ${ZPOOL} status -x ${name0}
1072
1073 expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1} ${disk2}
1074 expect_ok ${ZPOOL} offline ${name0} ${disk1}
1075 expect_ok ${ZPOOL} offline -t ${name0} ${disk2}
1076 exp=`(
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 )`
1089 expect "${exp}" ${ZPOOL} status ${name0}
1090 expect_ok ${ZPOOL} export ${name0}
1091 expect_ok ${ZPOOL} import ${import_flags} ${name0}
1092 exp=`(
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 )`
1105 expect "${exp}" ${ZPOOL} status ${name0}
1106 expect_ok ${ZPOOL} online ${name0} ${disk1}
1107 expect_ok ${ZPOOL} destroy ${name0}
1108 expect_fl ${ZPOOL} status -x ${name0}
1109
1110 disks_destroy