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