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