1#!/bin/sh
2# $FreeBSD$
3
4dir=`dirname $0`
5. ${dir}/../../misc.sh
6
7[ "${os}" = "FreeBSD" ] && die "panics FreeBSD; see bug # 194586"
8
9echo "1..100"
10
11disks_create 7
12disks_create 1 64M
13files_create 7
14files_create 1 64M
15names_create 1
16
17expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
18expect_fl ${ZPOOL} add ${name0} mirror ${disk7} ${disk2}
19exp=`(
20  echo "  pool: ${name0}"
21  echo " state: ONLINE"
22  echo " scrub: none requested"
23  echo "config:"
24  echo "	NAME          STATE   READ WRITE CKSUM"
25  echo "	${name0}      ONLINE     0     0     0"
26  echo "	  mirror      ONLINE     0     0     0"
27  echo "	    ${disk0}  ONLINE     0     0     0"
28  echo "	    ${disk1}  ONLINE     0     0     0"
29  echo "errors: No known data errors"
30)`
31expect "${exp}" ${ZPOOL} status ${name0}
32expect_ok ${ZPOOL} destroy ${name0}
33expect_fl ${ZPOOL} status -x ${name0}
34
35expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1}
36expect_ok ${ZPOOL} add -f ${name0} mirror ${disk7} ${disk2}
37exp=`(
38  echo "  pool: ${name0}"
39  echo " state: ONLINE"
40  echo " scrub: none requested"
41  echo "config:"
42  echo "	NAME          STATE   READ WRITE CKSUM"
43  echo "	${name0}      ONLINE     0     0     0"
44  echo "	  mirror      ONLINE     0     0     0"
45  echo "	    ${disk0}  ONLINE     0     0     0"
46  echo "	    ${disk1}  ONLINE     0     0     0"
47  echo "	  mirror      ONLINE     0     0     0"
48  echo "	    ${disk7}  ONLINE     0     0     0"
49  echo "	    ${disk2}  ONLINE     0     0     0"
50  echo "errors: No known data errors"
51)`
52expect "${exp}" ${ZPOOL} status ${name0}
53expect_ok ${ZPOOL} destroy ${name0}
54expect_fl ${ZPOOL} status -x ${name0}
55
56expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
57expect_fl ${ZPOOL} add ${name0} mirror ${file7} ${file2}
58exp=`(
59  echo "  pool: ${name0}"
60  echo " state: ONLINE"
61  echo " scrub: none requested"
62  echo "config:"
63  echo "	NAME          STATE   READ WRITE CKSUM"
64  echo "	${name0}      ONLINE     0     0     0"
65  echo "	  mirror      ONLINE     0     0     0"
66  echo "	    ${file0}  ONLINE     0     0     0"
67  echo "	    ${file1}  ONLINE     0     0     0"
68  echo "errors: No known data errors"
69)`
70expect "${exp}" ${ZPOOL} status ${name0}
71expect_ok ${ZPOOL} destroy ${name0}
72expect_fl ${ZPOOL} status -x ${name0}
73
74expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
75expect_ok ${ZPOOL} add -f ${name0} mirror ${file7} ${file2}
76exp=`(
77  echo "  pool: ${name0}"
78  echo " state: ONLINE"
79  echo " scrub: none requested"
80  echo "config:"
81  echo "	NAME          STATE   READ WRITE CKSUM"
82  echo "	${name0}      ONLINE     0     0     0"
83  echo "	  mirror      ONLINE     0     0     0"
84  echo "	    ${file0}  ONLINE     0     0     0"
85  echo "	    ${file1}  ONLINE     0     0     0"
86  echo "	  mirror      ONLINE     0     0     0"
87  echo "	    ${file7}  ONLINE     0     0     0"
88  echo "	    ${file2}  ONLINE     0     0     0"
89  echo "errors: No known data errors"
90)`
91expect "${exp}" ${ZPOOL} status ${name0}
92expect_ok ${ZPOOL} destroy ${name0}
93expect_fl ${ZPOOL} status -x ${name0}
94
95expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
96expect_fl ${ZPOOL} add ${name0} raidz1 ${disk3} ${disk7} ${disk4}
97exp=`(
98  echo "  pool: ${name0}"
99  echo " state: ONLINE"
100  echo " scrub: none requested"
101  echo "config:"
102  echo "	NAME          STATE   READ WRITE CKSUM"
103  echo "	${name0}      ONLINE     0     0     0"
104  echo "	  raidz1      ONLINE     0     0     0"
105  echo "	    ${disk0}  ONLINE     0     0     0"
106  echo "	    ${disk1}  ONLINE     0     0     0"
107  echo "	    ${disk2}  ONLINE     0     0     0"
108  echo "errors: No known data errors"
109)`
110expect "${exp}" ${ZPOOL} status ${name0}
111expect_ok ${ZPOOL} destroy ${name0}
112expect_fl ${ZPOOL} status -x ${name0}
113
114expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
115expect_ok ${ZPOOL} add -f ${name0} raidz1 ${disk3} ${disk7} ${disk4}
116exp=`(
117  echo "  pool: ${name0}"
118  echo " state: ONLINE"
119  echo " scrub: none requested"
120  echo "config:"
121  echo "	NAME          STATE   READ WRITE CKSUM"
122  echo "	${name0}      ONLINE     0     0     0"
123  echo "	  raidz1      ONLINE     0     0     0"
124  echo "	    ${disk0}  ONLINE     0     0     0"
125  echo "	    ${disk1}  ONLINE     0     0     0"
126  echo "	    ${disk2}  ONLINE     0     0     0"
127  echo "	  raidz1      ONLINE     0     0     0"
128  echo "	    ${disk3}  ONLINE     0     0     0"
129  echo "	    ${disk7}  ONLINE     0     0     0"
130  echo "	    ${disk4}  ONLINE     0     0     0"
131  echo "errors: No known data errors"
132)`
133expect "${exp}" ${ZPOOL} status ${name0}
134expect_ok ${ZPOOL} destroy ${name0}
135expect_fl ${ZPOOL} status -x ${name0}
136
137expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
138expect_fl ${ZPOOL} add ${name0} raidz1 ${file3} ${file7} ${file4}
139exp=`(
140  echo "  pool: ${name0}"
141  echo " state: ONLINE"
142  echo " scrub: none requested"
143  echo "config:"
144  echo "	NAME          STATE   READ WRITE CKSUM"
145  echo "	${name0}      ONLINE     0     0     0"
146  echo "	  raidz1      ONLINE     0     0     0"
147  echo "	    ${file0}  ONLINE     0     0     0"
148  echo "	    ${file1}  ONLINE     0     0     0"
149  echo "	    ${file2}  ONLINE     0     0     0"
150  echo "errors: No known data errors"
151)`
152expect "${exp}" ${ZPOOL} status ${name0}
153expect_ok ${ZPOOL} destroy ${name0}
154expect_fl ${ZPOOL} status -x ${name0}
155
156expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
157expect_ok ${ZPOOL} add -f ${name0} raidz1 ${file3} ${file7} ${file4}
158exp=`(
159  echo "  pool: ${name0}"
160  echo " state: ONLINE"
161  echo " scrub: none requested"
162  echo "config:"
163  echo "	NAME          STATE   READ WRITE CKSUM"
164  echo "	${name0}      ONLINE     0     0     0"
165  echo "	  raidz1      ONLINE     0     0     0"
166  echo "	    ${file0}  ONLINE     0     0     0"
167  echo "	    ${file1}  ONLINE     0     0     0"
168  echo "	    ${file2}  ONLINE     0     0     0"
169  echo "	  raidz1      ONLINE     0     0     0"
170  echo "	    ${file3}  ONLINE     0     0     0"
171  echo "	    ${file7}  ONLINE     0     0     0"
172  echo "	    ${file4}  ONLINE     0     0     0"
173  echo "errors: No known data errors"
174)`
175expect "${exp}" ${ZPOOL} status ${name0}
176expect_ok ${ZPOOL} destroy ${name0}
177expect_fl ${ZPOOL} status -x ${name0}
178
179expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
180expect_fl ${ZPOOL} add ${name0} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
181exp=`(
182  echo "  pool: ${name0}"
183  echo " state: ONLINE"
184  echo " scrub: none requested"
185  echo "config:"
186  echo "	NAME          STATE   READ WRITE CKSUM"
187  echo "	${name0}      ONLINE     0     0     0"
188  echo "	  raidz2      ONLINE     0     0     0"
189  echo "	    ${disk0}  ONLINE     0     0     0"
190  echo "	    ${disk1}  ONLINE     0     0     0"
191  echo "	    ${disk2}  ONLINE     0     0     0"
192  echo "	    ${disk3}  ONLINE     0     0     0"
193  echo "errors: No known data errors"
194)`
195expect "${exp}" ${ZPOOL} status ${name0}
196expect_ok ${ZPOOL} destroy ${name0}
197expect_fl ${ZPOOL} status -x ${name0}
198
199expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3}
200expect_ok ${ZPOOL} add -f ${name0} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
201exp=`(
202  echo "  pool: ${name0}"
203  echo " state: ONLINE"
204  echo " scrub: none requested"
205  echo "config:"
206  echo "	NAME          STATE   READ WRITE CKSUM"
207  echo "	${name0}      ONLINE     0     0     0"
208  echo "	  raidz2      ONLINE     0     0     0"
209  echo "	    ${disk0}  ONLINE     0     0     0"
210  echo "	    ${disk1}  ONLINE     0     0     0"
211  echo "	    ${disk2}  ONLINE     0     0     0"
212  echo "	    ${disk3}  ONLINE     0     0     0"
213  echo "	  raidz2      ONLINE     0     0     0"
214  echo "	    ${disk4}  ONLINE     0     0     0"
215  echo "	    ${disk5}  ONLINE     0     0     0"
216  echo "	    ${disk6}  ONLINE     0     0     0"
217  echo "	    ${disk7}  ONLINE     0     0     0"
218  echo "errors: No known data errors"
219)`
220expect "${exp}" ${ZPOOL} status ${name0}
221expect_ok ${ZPOOL} destroy ${name0}
222expect_fl ${ZPOOL} status -x ${name0}
223
224expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
225expect_fl ${ZPOOL} add ${name0} raidz2 ${file4} ${file5} ${file6} ${file7}
226exp=`(
227  echo "  pool: ${name0}"
228  echo " state: ONLINE"
229  echo " scrub: none requested"
230  echo "config:"
231  echo "	NAME          STATE   READ WRITE CKSUM"
232  echo "	${name0}      ONLINE     0     0     0"
233  echo "	  raidz2      ONLINE     0     0     0"
234  echo "	    ${file0}  ONLINE     0     0     0"
235  echo "	    ${file1}  ONLINE     0     0     0"
236  echo "	    ${file2}  ONLINE     0     0     0"
237  echo "	    ${file3}  ONLINE     0     0     0"
238  echo "errors: No known data errors"
239)`
240expect "${exp}" ${ZPOOL} status ${name0}
241expect_ok ${ZPOOL} destroy ${name0}
242expect_fl ${ZPOOL} status -x ${name0}
243
244expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
245expect_ok ${ZPOOL} add -f ${name0} raidz2 ${file4} ${file5} ${file6} ${file7}
246exp=`(
247  echo "  pool: ${name0}"
248  echo " state: ONLINE"
249  echo " scrub: none requested"
250  echo "config:"
251  echo "	NAME          STATE   READ WRITE CKSUM"
252  echo "	${name0}      ONLINE     0     0     0"
253  echo "	  raidz2      ONLINE     0     0     0"
254  echo "	    ${file0}  ONLINE     0     0     0"
255  echo "	    ${file1}  ONLINE     0     0     0"
256  echo "	    ${file2}  ONLINE     0     0     0"
257  echo "	    ${file3}  ONLINE     0     0     0"
258  echo "	  raidz2      ONLINE     0     0     0"
259  echo "	    ${file4}  ONLINE     0     0     0"
260  echo "	    ${file5}  ONLINE     0     0     0"
261  echo "	    ${file6}  ONLINE     0     0     0"
262  echo "	    ${file7}  ONLINE     0     0     0"
263  echo "errors: No known data errors"
264)`
265expect "${exp}" ${ZPOOL} status ${name0}
266expect_ok ${ZPOOL} destroy ${name0}
267expect_fl ${ZPOOL} status -x ${name0}
268
269expect_ok ${ZPOOL} create ${name0} ${disk0}
270add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
271expect_fl ${ZPOOL} add ${name0} log mirror ${disk1} ${disk7}
272exp=`(
273  echo "  pool: ${name0}"
274  echo " state: ONLINE"
275  echo " scrub: none requested"
276  echo "config:"
277  echo "	NAME        STATE   READ WRITE CKSUM"
278  echo "	${name0}    ONLINE     0     0     0"
279  echo "	  ${disk0}  ONLINE     0     0     0"
280  echo "errors: No known data errors"
281)`
282expect "${exp}" ${ZPOOL} status ${name0}
283add_msg=""
284expect_ok ${ZPOOL} destroy ${name0}
285expect_fl ${ZPOOL} status -x ${name0}
286
287expect_ok ${ZPOOL} create ${name0} ${disk0}
288expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk1} ${disk7}
289exp=`(
290  echo "  pool: ${name0}"
291  echo " state: ONLINE"
292  echo " scrub: none requested"
293  echo "config:"
294  echo "	NAME          STATE   READ WRITE CKSUM"
295  echo "	${name0}      ONLINE     0     0     0"
296  echo "	  ${disk0}    ONLINE     0     0     0"
297  echo "	logs          ONLINE     0     0     0"
298  echo "	  mirror      ONLINE     0     0     0"
299  echo "	    ${disk1}  ONLINE     0     0     0"
300  echo "	    ${disk7}  ONLINE     0     0     0"
301  echo "errors: No known data errors"
302)`
303expect "${exp}" ${ZPOOL} status ${name0}
304expect_ok ${ZPOOL} destroy ${name0}
305expect_fl ${ZPOOL} status -x ${name0}
306
307expect_ok ${ZPOOL} create ${name0} ${file0}
308add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
309expect_fl ${ZPOOL} add ${name0} log mirror ${file1} ${file7}
310exp=`(
311  echo "  pool: ${name0}"
312  echo " state: ONLINE"
313  echo " scrub: none requested"
314  echo "config:"
315  echo "	NAME        STATE   READ WRITE CKSUM"
316  echo "	${name0}    ONLINE     0     0     0"
317  echo "	  ${file0}  ONLINE     0     0     0"
318  echo "errors: No known data errors"
319)`
320expect "${exp}" ${ZPOOL} status ${name0}
321add_msg=""
322expect_ok ${ZPOOL} destroy ${name0}
323expect_fl ${ZPOOL} status -x ${name0}
324
325expect_ok ${ZPOOL} create ${name0} ${file0}
326expect_ok ${ZPOOL} add -f ${name0} log mirror ${file1} ${file7}
327exp=`(
328  echo "  pool: ${name0}"
329  echo " state: ONLINE"
330  echo " scrub: none requested"
331  echo "config:"
332  echo "	NAME          STATE   READ WRITE CKSUM"
333  echo "	${name0}      ONLINE     0     0     0"
334  echo "	  ${file0}    ONLINE     0     0     0"
335  echo "	logs          ONLINE     0     0     0"
336  echo "	  mirror      ONLINE     0     0     0"
337  echo "	    ${file1}  ONLINE     0     0     0"
338  echo "	    ${file7}  ONLINE     0     0     0"
339  echo "errors: No known data errors"
340)`
341expect "${exp}" ${ZPOOL} status ${name0}
342expect_ok ${ZPOOL} destroy ${name0}
343expect_fl ${ZPOOL} status -x ${name0}
344
345expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
346add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
347expect_fl ${ZPOOL} add ${name0} log mirror ${disk3} ${disk7}
348exp=`(
349  echo "  pool: ${name0}"
350  echo " state: ONLINE"
351  echo " scrub: none requested"
352  echo "config:"
353  echo "	NAME          STATE   READ WRITE CKSUM"
354  echo "	${name0}      ONLINE     0     0     0"
355  echo "	  ${disk0}    ONLINE     0     0     0"
356  echo "	logs          ONLINE     0     0     0"
357  echo "	  mirror      ONLINE     0     0     0"
358  echo "	    ${disk1}  ONLINE     0     0     0"
359  echo "	    ${disk2}  ONLINE     0     0     0"
360  echo "errors: No known data errors"
361)`
362expect "${exp}" ${ZPOOL} status ${name0}
363add_msg=""
364expect_ok ${ZPOOL} destroy ${name0}
365expect_fl ${ZPOOL} status -x ${name0}
366
367expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
368expect_ok ${ZPOOL} add -f ${name0} log mirror ${disk3} ${disk7}
369exp=`(
370  echo "  pool: ${name0}"
371  echo " state: ONLINE"
372  echo " scrub: none requested"
373  echo "config:"
374  echo "	NAME          STATE   READ WRITE CKSUM"
375  echo "	${name0}      ONLINE     0     0     0"
376  echo "	  ${disk0}    ONLINE     0     0     0"
377  echo "	logs          ONLINE     0     0     0"
378  echo "	  mirror      ONLINE     0     0     0"
379  echo "	    ${disk1}  ONLINE     0     0     0"
380  echo "	    ${disk2}  ONLINE     0     0     0"
381  echo "	  mirror      ONLINE     0     0     0"
382  echo "	    ${disk3}  ONLINE     0     0     0"
383  echo "	    ${disk7}  ONLINE     0     0     0"
384  echo "errors: No known data errors"
385)`
386expect "${exp}" ${ZPOOL} status ${name0}
387expect_ok ${ZPOOL} destroy ${name0}
388expect_fl ${ZPOOL} status -x ${name0}
389
390expect_ok ${ZPOOL} create ${name0} ${file0} log mirror ${file1} ${file2}
391add_msg="# TODO Sun CR 6726091, Lustre bug 16873"
392expect_fl ${ZPOOL} add ${name0} log mirror ${file3} ${file7}
393exp=`(
394  echo "  pool: ${name0}"
395  echo " state: ONLINE"
396  echo " scrub: none requested"
397  echo "config:"
398  echo "	NAME          STATE   READ WRITE CKSUM"
399  echo "	${name0}      ONLINE     0     0     0"
400  echo "	  ${file0}    ONLINE     0     0     0"
401  echo "	logs          ONLINE     0     0     0"
402  echo "	  mirror      ONLINE     0     0     0"
403  echo "	    ${file1}  ONLINE     0     0     0"
404  echo "	    ${file2}  ONLINE     0     0     0"
405  echo "errors: No known data errors"
406)`
407expect "${exp}" ${ZPOOL} status ${name0}
408add_msg=""
409expect_ok ${ZPOOL} destroy ${name0}
410expect_fl ${ZPOOL} status -x ${name0}
411
412expect_ok ${ZPOOL} create ${name0} ${file0} log mirror ${file1} ${file2}
413expect_ok ${ZPOOL} add -f ${name0} log mirror ${file3} ${file7}
414exp=`(
415  echo "  pool: ${name0}"
416  echo " state: ONLINE"
417  echo " scrub: none requested"
418  echo "config:"
419  echo "	NAME          STATE   READ WRITE CKSUM"
420  echo "	${name0}      ONLINE     0     0     0"
421  echo "	  ${file0}    ONLINE     0     0     0"
422  echo "	logs          ONLINE     0     0     0"
423  echo "	  mirror      ONLINE     0     0     0"
424  echo "	    ${file1}  ONLINE     0     0     0"
425  echo "	    ${file2}  ONLINE     0     0     0"
426  echo "	  mirror      ONLINE     0     0     0"
427  echo "	    ${file3}  ONLINE     0     0     0"
428  echo "	    ${file7}  ONLINE     0     0     0"
429  echo "errors: No known data errors"
430)`
431expect "${exp}" ${ZPOOL} status ${name0}
432expect_ok ${ZPOOL} destroy ${name0}
433expect_fl ${ZPOOL} status -x ${name0}
434
435disks_destroy
436files_destroy
437