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