xref: /freebsd/tools/regression/zfs/zpool/add/files.t (revision a64729f5077d77e13b9497cb33ecb3c82e606ee8)
1#!/bin/sh
2
3dir=`dirname $0`
4. ${dir}/../../misc.sh
5
6echo "1..54"
7
8files_create 8
9names_create 1
10
11expect_ok ${ZPOOL} create ${name0} ${file0}
12expect_fl ${ZPOOL} add ${name0} ${file0}
13exp=`(
14  echo "  pool: ${name0}"
15  echo " state: ONLINE"
16  echo " scrub: none requested"
17  echo "config:"
18  echo "	NAME        STATE   READ WRITE CKSUM"
19  echo "	${name0}    ONLINE     0     0     0"
20  echo "	  ${file0}  ONLINE     0     0     0"
21  echo "errors: No known data errors"
22)`
23expect_ok ${ZPOOL} destroy ${name0}
24expect_fl ${ZPOOL} status -x ${name0}
25
26expect_ok ${ZPOOL} create ${name0} ${file0} ${file1}
27expect_fl ${ZPOOL} add ${name0} ${file0}
28expect_fl ${ZPOOL} add ${name0} ${file1}
29exp=`(
30  echo "  pool: ${name0}"
31  echo " state: ONLINE"
32  echo " scrub: none requested"
33  echo "config:"
34  echo "	NAME        STATE   READ WRITE CKSUM"
35  echo "	${name0}    ONLINE     0     0     0"
36  echo "	  ${file0}  ONLINE     0     0     0"
37  echo "errors: No known data errors"
38)`
39expect_ok ${ZPOOL} destroy ${name0}
40expect_fl ${ZPOOL} status -x ${name0}
41
42expect_ok ${ZPOOL} create ${name0} ${file0}
43expect_ok ${ZPOOL} add ${name0} ${file1}
44exp=`(
45  echo "  pool: ${name0}"
46  echo " state: ONLINE"
47  echo " scrub: none requested"
48  echo "config:"
49  echo "	NAME        STATE   READ WRITE CKSUM"
50  echo "	${name0}    ONLINE     0     0     0"
51  echo "	  ${file0}  ONLINE     0     0     0"
52  echo "	  ${file1}  ONLINE     0     0     0"
53  echo "errors: No known data errors"
54)`
55expect "${exp}" ${ZPOOL} status ${name0}
56expect_ok ${ZPOOL} destroy ${name0}
57expect_fl ${ZPOOL} status -x ${name0}
58
59expect_ok ${ZPOOL} create ${name0} ${file0} ${file1} ${file2}
60expect_ok ${ZPOOL} add ${name0} ${file3} ${file4}
61exp=`(
62  echo "  pool: ${name0}"
63  echo " state: ONLINE"
64  echo " scrub: none requested"
65  echo "config:"
66  echo "	NAME        STATE   READ WRITE CKSUM"
67  echo "	${name0}    ONLINE     0     0     0"
68  echo "	  ${file0}  ONLINE     0     0     0"
69  echo "	  ${file1}  ONLINE     0     0     0"
70  echo "	  ${file2}  ONLINE     0     0     0"
71  echo "	  ${file3}  ONLINE     0     0     0"
72  echo "	  ${file4}  ONLINE     0     0     0"
73  echo "errors: No known data errors"
74)`
75expect "${exp}" ${ZPOOL} status ${name0}
76expect_ok ${ZPOOL} destroy ${name0}
77expect_fl ${ZPOOL} status -x ${name0}
78
79expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
80expect_ok ${ZPOOL} add ${name0} mirror ${file2} ${file3}
81exp=`(
82  echo "  pool: ${name0}"
83  echo " state: ONLINE"
84  echo " scrub: none requested"
85  echo "config:"
86  echo "	NAME          STATE   READ WRITE CKSUM"
87  echo "	${name0}      ONLINE     0     0     0"
88  echo "	  mirror      ONLINE     0     0     0"
89  echo "	    ${file0}  ONLINE     0     0     0"
90  echo "	    ${file1}  ONLINE     0     0     0"
91  echo "	  mirror      ONLINE     0     0     0"
92  echo "	    ${file2}  ONLINE     0     0     0"
93  echo "	    ${file3}  ONLINE     0     0     0"
94  echo "errors: No known data errors"
95)`
96expect "${exp}" ${ZPOOL} status ${name0}
97expect_ok ${ZPOOL} destroy ${name0}
98expect_fl ${ZPOOL} status -x ${name0}
99
100expect_ok ${ZPOOL} create ${name0} raidz1 ${file0} ${file1} ${file2}
101expect_ok ${ZPOOL} add ${name0} raidz1 ${file3} ${file4} ${file5}
102exp=`(
103  echo "  pool: ${name0}"
104  echo " state: ONLINE"
105  echo " scrub: none requested"
106  echo "config:"
107  echo "	NAME          STATE   READ WRITE CKSUM"
108  echo "	${name0}      ONLINE     0     0     0"
109  echo "	  raidz1      ONLINE     0     0     0"
110  echo "	    ${file0}  ONLINE     0     0     0"
111  echo "	    ${file1}  ONLINE     0     0     0"
112  echo "	    ${file2}  ONLINE     0     0     0"
113  echo "	  raidz1      ONLINE     0     0     0"
114  echo "	    ${file3}  ONLINE     0     0     0"
115  echo "	    ${file4}  ONLINE     0     0     0"
116  echo "	    ${file5}  ONLINE     0     0     0"
117  echo "errors: No known data errors"
118)`
119expect "${exp}" ${ZPOOL} status ${name0}
120expect_ok ${ZPOOL} destroy ${name0}
121expect_fl ${ZPOOL} status -x ${name0}
122
123expect_ok ${ZPOOL} create ${name0} raidz2 ${file0} ${file1} ${file2} ${file3}
124expect_ok ${ZPOOL} add ${name0} raidz2 ${file4} ${file5} ${file6} ${file7}
125exp=`(
126  echo "  pool: ${name0}"
127  echo " state: ONLINE"
128  echo " scrub: none requested"
129  echo "config:"
130  echo "	NAME          STATE   READ WRITE CKSUM"
131  echo "	${name0}      ONLINE     0     0     0"
132  echo "	  raidz2      ONLINE     0     0     0"
133  echo "	    ${file0}  ONLINE     0     0     0"
134  echo "	    ${file1}  ONLINE     0     0     0"
135  echo "	    ${file2}  ONLINE     0     0     0"
136  echo "	    ${file3}  ONLINE     0     0     0"
137  echo "	  raidz2      ONLINE     0     0     0"
138  echo "	    ${file4}  ONLINE     0     0     0"
139  echo "	    ${file5}  ONLINE     0     0     0"
140  echo "	    ${file6}  ONLINE     0     0     0"
141  echo "	    ${file7}  ONLINE     0     0     0"
142  echo "errors: No known data errors"
143)`
144expect "${exp}" ${ZPOOL} status ${name0}
145expect_ok ${ZPOOL} destroy ${name0}
146expect_fl ${ZPOOL} status -x ${name0}
147
148expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
149expect_ok ${ZPOOL} add ${name0} spare ${file2} ${file3}
150exp=`(
151  echo "  pool: ${name0}"
152  echo " state: ONLINE"
153  echo " scrub: none requested"
154  echo "config:"
155  echo "	NAME          STATE   READ WRITE CKSUM"
156  echo "	${name0}      ONLINE     0     0     0"
157  echo "	  mirror      ONLINE     0     0     0"
158  echo "	    ${file0}  ONLINE     0     0     0"
159  echo "	    ${file1}  ONLINE     0     0     0"
160  echo "	spares"
161  echo "	  ${file2}    AVAIL"
162  echo "	  ${file3}    AVAIL"
163  echo "errors: No known data errors"
164)`
165expect "${exp}" ${ZPOOL} status ${name0}
166expect_ok ${ZPOOL} destroy ${name0}
167expect_fl ${ZPOOL} status -x ${name0}
168
169expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
170expect_ok ${ZPOOL} add ${name0} log ${file2} ${file3}
171exp=`(
172  echo "  pool: ${name0}"
173  echo " state: ONLINE"
174  echo " scrub: none requested"
175  echo "config:"
176  echo "	NAME          STATE   READ WRITE CKSUM"
177  echo "	${name0}      ONLINE     0     0     0"
178  echo "	  mirror      ONLINE     0     0     0"
179  echo "	    ${file0}  ONLINE     0     0     0"
180  echo "	    ${file1}  ONLINE     0     0     0"
181  echo "	logs          ONLINE     0     0     0"
182  echo "	  ${file2}    ONLINE     0     0     0"
183  echo "	  ${file3}    ONLINE     0     0     0"
184  echo "errors: No known data errors"
185)`
186expect "${exp}" ${ZPOOL} status ${name0}
187expect_ok ${ZPOOL} destroy ${name0}
188expect_fl ${ZPOOL} status -x ${name0}
189
190expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
191expect_ok ${ZPOOL} add ${name0} log mirror ${file2} ${file3}
192exp=`(
193  echo "  pool: ${name0}"
194  echo " state: ONLINE"
195  echo " scrub: none requested"
196  echo "config:"
197  echo "	NAME          STATE   READ WRITE CKSUM"
198  echo "	${name0}      ONLINE     0     0     0"
199  echo "	  mirror      ONLINE     0     0     0"
200  echo "	    ${file0}  ONLINE     0     0     0"
201  echo "	    ${file1}  ONLINE     0     0     0"
202  echo "	logs          ONLINE     0     0     0"
203  echo "	  mirror      ONLINE     0     0     0"
204  echo "	    ${file2}  ONLINE     0     0     0"
205  echo "	    ${file3}  ONLINE     0     0     0"
206  echo "errors: No known data errors"
207)`
208expect "${exp}" ${ZPOOL} status ${name0}
209expect_ok ${ZPOOL} destroy ${name0}
210expect_fl ${ZPOOL} status -x ${name0}
211
212expect_ok ${ZPOOL} create ${name0} mirror ${file0} ${file1}
213expect_fl ${ZPOOL} add ${name0} cache ${file2} ${file3}
214exp=`(
215  echo "  pool: ${name0}"
216  echo " state: ONLINE"
217  echo " scrub: none requested"
218  echo "config:"
219  echo "	NAME          STATE   READ WRITE CKSUM"
220  echo "	${name0}      ONLINE     0     0     0"
221  echo "	  mirror      ONLINE     0     0     0"
222  echo "	    ${file0}  ONLINE     0     0     0"
223  echo "	    ${file1}  ONLINE     0     0     0"
224  echo "errors: No known data errors"
225)`
226expect "${exp}" ${ZPOOL} status ${name0}
227expect_ok ${ZPOOL} destroy ${name0}
228expect_fl ${ZPOOL} status -x ${name0}
229
230files_destroy
231