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