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