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