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