xref: /freebsd/tools/regression/zfs/zpool/offline/log.t (revision d93a896ef95946b0bf1219866fcb324b78543444)
1#!/bin/sh
2# $FreeBSD$
3
4dir=`dirname $0`
5. ${dir}/../../misc.sh
6
7echo "1..67"
8
9disks_create 7
10names_create 1
11
12expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
13expect_ok ${ZPOOL} offline ${name0} ${disk1}
14exp=`(
15  echo "  pool: ${name0}"
16  echo " state: DEGRADED"
17  echo "status: One or more devices has been taken offline by the administrator."
18  echo "        Sufficient replicas exist for the pool to continue functioning in a"
19  echo "        degraded state."
20  echo "action: Online the device using 'zpool online' or replace the device with"
21  echo "        'zpool replace'."
22  echo " scrub: none requested"
23  echo "config:"
24  echo "	NAME          STATE     READ WRITE CKSUM"
25  echo "	${name0}      DEGRADED     0     0     0"
26  echo "	  ${disk0}    ONLINE       0     0     0"
27  echo "	logs          DEGRADED     0     0     0"
28  echo "	  mirror      DEGRADED     0     0     0"
29  echo "	    ${disk1}  OFFLINE      0     0     0"
30  echo "	    ${disk2}  ONLINE       0     0     0"
31  echo "errors: No known data errors"
32)`
33expect "${exp}" ${ZPOOL} status ${name0}
34expect_ok ${ZPOOL} online ${name0} ${disk1}
35expect_ok ${ZPOOL} destroy ${name0}
36expect_fl ${ZPOOL} status -x ${name0}
37
38expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
39expect_ok ${ZPOOL} offline ${name0} ${disk2}
40exp=`(
41  echo "  pool: ${name0}"
42  echo " state: DEGRADED"
43  echo "status: One or more devices has been taken offline by the administrator."
44  echo "        Sufficient replicas exist for the pool to continue functioning in a"
45  echo "        degraded state."
46  echo "action: Online the device using 'zpool online' or replace the device with"
47  echo "        'zpool replace'."
48  echo " scrub: none requested"
49  echo "config:"
50  echo "	NAME          STATE     READ WRITE CKSUM"
51  echo "	${name0}      DEGRADED     0     0     0"
52  echo "	  ${disk0}    ONLINE       0     0     0"
53  echo "	logs          DEGRADED     0     0     0"
54  echo "	  mirror      DEGRADED     0     0     0"
55  echo "	    ${disk1}  ONLINE       0     0     0"
56  echo "	    ${disk2}  OFFLINE      0     0     0"
57  echo "errors: No known data errors"
58)`
59expect "${exp}" ${ZPOOL} status ${name0}
60expect_ok ${ZPOOL} online ${name0} ${disk2}
61expect_ok ${ZPOOL} destroy ${name0}
62expect_fl ${ZPOOL} status -x ${name0}
63
64expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
65expect_ok ${ZPOOL} offline ${name0} ${disk1}
66expect_fl ${ZPOOL} offline ${name0} ${disk2}
67exp=`(
68  echo "  pool: ${name0}"
69  echo " state: DEGRADED"
70  echo "status: One or more devices has been taken offline by the administrator."
71  echo "        Sufficient replicas exist for the pool to continue functioning in a"
72  echo "        degraded state."
73  echo "action: Online the device using 'zpool online' or replace the device with"
74  echo "        'zpool replace'."
75  echo " scrub: none requested"
76  echo "config:"
77  echo "	NAME          STATE     READ WRITE CKSUM"
78  echo "	${name0}      DEGRADED     0     0     0"
79  echo "	  ${disk0}    ONLINE       0     0     0"
80  echo "	logs          DEGRADED     0     0     0"
81  echo "	  mirror      DEGRADED     0     0     0"
82  echo "	    ${disk1}  OFFLINE      0     0     0"
83  echo "	    ${disk2}  ONLINE       0     0     0"
84  echo "errors: No known data errors"
85)`
86expect "${exp}" ${ZPOOL} status ${name0}
87expect_ok ${ZPOOL} online ${name0} ${disk1}
88expect_ok ${ZPOOL} online ${name0} ${disk2}
89expect_ok ${ZPOOL} destroy ${name0}
90expect_fl ${ZPOOL} status -x ${name0}
91
92expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4}
93expect_ok ${ZPOOL} offline ${name0} ${disk1}
94expect_ok ${ZPOOL} offline ${name0} ${disk4}
95expect_fl ${ZPOOL} offline ${name0} ${disk2}
96expect_fl ${ZPOOL} offline ${name0} ${disk3}
97exp=`(
98  echo "  pool: ${name0}"
99  echo " state: DEGRADED"
100  echo "status: One or more devices has been taken offline by the administrator."
101  echo "        Sufficient replicas exist for the pool to continue functioning in a"
102  echo "        degraded state."
103  echo "action: Online the device using 'zpool online' or replace the device with"
104  echo "        'zpool replace'."
105  echo " scrub: none requested"
106  echo "config:"
107  echo "	NAME          STATE     READ WRITE CKSUM"
108  echo "	${name0}      DEGRADED     0     0     0"
109  echo "	  ${disk0}    ONLINE       0     0     0"
110  echo "	logs          DEGRADED     0     0     0"
111  echo "	  mirror      DEGRADED     0     0     0"
112  echo "	    ${disk1}  OFFLINE      0     0     0"
113  echo "	    ${disk2}  ONLINE       0     0     0"
114  echo "	  mirror      DEGRADED     0     0     0"
115  echo "	    ${disk3}  ONLINE       0     0     0"
116  echo "	    ${disk4}  OFFLINE      0     0     0"
117  echo "errors: No known data errors"
118)`
119expect "${exp}" ${ZPOOL} status ${name0}
120expect_ok ${ZPOOL} online ${name0} ${disk1}
121expect_ok ${ZPOOL} online ${name0} ${disk4}
122expect_ok ${ZPOOL} online ${name0} ${disk2}
123expect_ok ${ZPOOL} online ${name0} ${disk3}
124expect_ok ${ZPOOL} destroy ${name0}
125expect_fl ${ZPOOL} status -x ${name0}
126
127expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} mirror ${disk3} ${disk4}
128expect_ok ${ZPOOL} offline ${name0} ${disk2} ${disk3}
129exp=`(
130  echo "  pool: ${name0}"
131  echo " state: DEGRADED"
132  echo "status: One or more devices has been taken offline by the administrator."
133  echo "        Sufficient replicas exist for the pool to continue functioning in a"
134  echo "        degraded state."
135  echo "action: Online the device using 'zpool online' or replace the device with"
136  echo "        'zpool replace'."
137  echo " scrub: none requested"
138  echo "config:"
139  echo "	NAME          STATE     READ WRITE CKSUM"
140  echo "	${name0}      DEGRADED     0     0     0"
141  echo "	  ${disk0}    ONLINE       0     0     0"
142  echo "	logs          DEGRADED     0     0     0"
143  echo "	  mirror      DEGRADED     0     0     0"
144  echo "	    ${disk1}  ONLINE       0     0     0"
145  echo "	    ${disk2}  OFFLINE      0     0     0"
146  echo "	  mirror      DEGRADED     0     0     0"
147  echo "	    ${disk3}  OFFLINE      0     0     0"
148  echo "	    ${disk4}  ONLINE       0     0     0"
149  echo "errors: No known data errors"
150)`
151expect "${exp}" ${ZPOOL} status ${name0}
152expect_ok ${ZPOOL} online ${name0} ${disk2}
153expect_ok ${ZPOOL} online ${name0} ${disk3}
154expect_ok ${ZPOOL} destroy ${name0}
155expect_fl ${ZPOOL} status -x ${name0}
156
157expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3}
158expect_ok ${ZPOOL} offline ${name0} ${disk1}
159expect_ok ${ZPOOL} offline ${name0} ${disk2}
160exp=`(
161  echo "  pool: ${name0}"
162  echo " state: DEGRADED"
163  echo "status: One or more devices has been taken offline by the administrator."
164  echo "        Sufficient replicas exist for the pool to continue functioning in a"
165  echo "        degraded state."
166  echo "action: Online the device using 'zpool online' or replace the device with"
167  echo "        'zpool replace'."
168  echo " scrub: none requested"
169  echo "config:"
170  echo "	NAME          STATE     READ WRITE CKSUM"
171  echo "	${name0}      DEGRADED     0     0     0"
172  echo "	  ${disk0}    ONLINE       0     0     0"
173  echo "	logs          DEGRADED     0     0     0"
174  echo "	  mirror      DEGRADED     0     0     0"
175  echo "	    ${disk1}  OFFLINE      0     0     0"
176  echo "	    ${disk2}  OFFLINE      0     0     0"
177  echo "	    ${disk3}  ONLINE       0     0     0"
178  echo "errors: No known data errors"
179)`
180expect "${exp}" ${ZPOOL} status ${name0}
181expect_ok ${ZPOOL} online ${name0} ${disk1}
182expect_ok ${ZPOOL} online ${name0} ${disk2}
183expect_ok ${ZPOOL} destroy ${name0}
184expect_fl ${ZPOOL} status -x ${name0}
185
186expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3} mirror ${disk4} ${disk5} ${disk6}
187expect_ok ${ZPOOL} offline ${name0} ${disk1}
188expect_ok ${ZPOOL} offline ${name0} ${disk2}
189expect_ok ${ZPOOL} offline ${name0} ${disk4} ${disk6}
190exp=`(
191  echo "  pool: ${name0}"
192  echo " state: DEGRADED"
193  echo "status: One or more devices has been taken offline by the administrator."
194  echo "        Sufficient replicas exist for the pool to continue functioning in a"
195  echo "        degraded state."
196  echo "action: Online the device using 'zpool online' or replace the device with"
197  echo "        'zpool replace'."
198  echo " scrub: none requested"
199  echo "config:"
200  echo "	NAME          STATE     READ WRITE CKSUM"
201  echo "	${name0}      DEGRADED     0     0     0"
202  echo "	  ${disk0}    ONLINE       0     0     0"
203  echo "	logs          DEGRADED     0     0     0"
204  echo "	  mirror      DEGRADED     0     0     0"
205  echo "	    ${disk1}  OFFLINE      0     0     0"
206  echo "	    ${disk2}  OFFLINE      0     0     0"
207  echo "	    ${disk3}  ONLINE       0     0     0"
208  echo "	  mirror      DEGRADED     0     0     0"
209  echo "	    ${disk4}  OFFLINE      0     0     0"
210  echo "	    ${disk5}  ONLINE       0     0     0"
211  echo "	    ${disk6}  OFFLINE      0     0     0"
212  echo "errors: No known data errors"
213)`
214expect "${exp}" ${ZPOOL} status ${name0}
215expect_ok ${ZPOOL} online ${name0} ${disk1}
216expect_ok ${ZPOOL} online ${name0} ${disk2}
217expect_ok ${ZPOOL} online ${name0} ${disk4}
218expect_ok ${ZPOOL} online ${name0} ${disk6}
219expect_ok ${ZPOOL} destroy ${name0}
220expect_fl ${ZPOOL} status -x ${name0}
221
222expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} ${disk3} ${disk4} ${disk5}
223expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk3} ${disk4} ${disk5}
224exp=`(
225  echo "  pool: ${name0}"
226  echo " state: DEGRADED"
227  echo "status: One or more devices has been taken offline by the administrator."
228  echo "        Sufficient replicas exist for the pool to continue functioning in a"
229  echo "        degraded state."
230  echo "action: Online the device using 'zpool online' or replace the device with"
231  echo "        'zpool replace'."
232  echo " scrub: none requested"
233  echo "config:"
234  echo "	NAME          STATE     READ WRITE CKSUM"
235  echo "	${name0}      DEGRADED     0     0     0"
236  echo "	  ${disk0}    ONLINE       0     0     0"
237  echo "	logs          DEGRADED     0     0     0"
238  echo "	  mirror      DEGRADED     0     0     0"
239  echo "	    ${disk1}  OFFLINE      0     0     0"
240  echo "	    ${disk2}  ONLINE       0     0     0"
241  echo "	    ${disk3}  OFFLINE      0     0     0"
242  echo "	    ${disk4}  OFFLINE      0     0     0"
243  echo "	    ${disk5}  OFFLINE      0     0     0"
244  echo "errors: No known data errors"
245)`
246expect "${exp}" ${ZPOOL} status ${name0}
247expect_ok ${ZPOOL} online ${name0} ${disk1}
248expect_ok ${ZPOOL} online ${name0} ${disk3}
249expect_ok ${ZPOOL} online ${name0} ${disk4}
250expect_ok ${ZPOOL} online ${name0} ${disk5}
251expect_ok ${ZPOOL} destroy ${name0}
252expect_fl ${ZPOOL} status -x ${name0}
253
254disks_destroy
255