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