xref: /freebsd/tools/regression/zfs/zpool/offline/raidz2.t (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
1#!/bin/sh
2
3dir=`dirname $0`
4. ${dir}/../../misc.sh
5
6echo "1..33"
7
8disks_create 8
9names_create 1
10
11expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2}
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 "	  raidz2      DEGRADED     0     0     0"
26  echo "	    ${disk0}  OFFLINE      0     0     0"
27  echo "	    ${disk1}  ONLINE       0     0     0"
28  echo "	    ${disk2}  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} raidz2 ${disk0} ${disk1} ${disk2}
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 "	  raidz2      DEGRADED     0     0     0"
50  echo "	    ${disk0}  ONLINE       0     0     0"
51  echo "	    ${disk1}  OFFLINE      0     0     0"
52  echo "	    ${disk2}  ONLINE       0     0     0"
53  echo "errors: No known data errors"
54)`
55expect "${exp}" ${ZPOOL} status ${name0}
56expect_ok ${ZPOOL} destroy ${name0}
57expect_fl ${ZPOOL} status -x ${name0}
58
59expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
60expect_ok ${ZPOOL} offline ${name0} ${disk2}
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 "	  raidz2      DEGRADED     0     0     0"
74  echo "	    ${disk0}  ONLINE       0     0     0"
75  echo "	    ${disk1}  ONLINE       0     0     0"
76  echo "	    ${disk2}  OFFLINE      0     0     0"
77  echo "errors: No known data errors"
78)`
79expect "${exp}" ${ZPOOL} status ${name0}
80expect_ok ${ZPOOL} destroy ${name0}
81expect_fl ${ZPOOL} status -x ${name0}
82
83expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2}
84add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
85expect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk1}
86add_msg=""
87expect_fl ${ZPOOL} offline ${name0} ${disk2}
88exp=`(
89  echo "  pool: ${name0}"
90  echo " state: DEGRADED"
91  echo "status: One or more devices has been taken offline by the administrator."
92  echo "        Sufficient replicas exist for the pool to continue functioning in a"
93  echo "        degraded state."
94  echo "action: Online the device using 'zpool online' or replace the device with"
95  echo "        'zpool replace'."
96  echo " scrub: none requested"
97  echo "config:"
98  echo "	NAME          STATE     READ WRITE CKSUM"
99  echo "	${name0}      DEGRADED     0     0     0"
100  echo "	  raidz2      DEGRADED     0     0     0"
101  echo "	    ${disk0}  OFFLINE      0     0     0"
102  echo "	    ${disk1}  OFFLINE      0     0     0"
103  echo "	    ${disk2}  ONLINE       0     0     0"
104  echo "errors: No known data errors"
105)`
106add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
107expect "${exp}" ${ZPOOL} status ${name0}
108add_msg=""
109expect_ok ${ZPOOL} destroy ${name0}
110expect_fl ${ZPOOL} status -x ${name0}
111
112expect_ok ${ZPOOL} create -f ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} raidz2 ${disk4} ${disk5} ${disk6} ${disk7}
113expect_ok ${ZPOOL} offline ${name0} ${disk1}
114exp=`(
115  echo "  pool: ${name0}"
116  echo " state: DEGRADED"
117  echo "status: One or more devices has been taken offline by the administrator."
118  echo "        Sufficient replicas exist for the pool to continue functioning in a"
119  echo "        degraded state."
120  echo "action: Online the device using 'zpool online' or replace the device with"
121  echo "        'zpool replace'."
122  echo " scrub: none requested"
123  echo "config:"
124  echo "	NAME          STATE     READ WRITE CKSUM"
125  echo "	${name0}      DEGRADED     0     0     0"
126  echo "	  raidz2      DEGRADED     0     0     0"
127  echo "	    ${disk0}  ONLINE       0     0     0"
128  echo "	    ${disk1}  OFFLINE      0     0     0"
129  echo "	    ${disk2}  ONLINE       0     0     0"
130  echo "	    ${disk3}  ONLINE       0     0     0"
131  echo "	  raidz2      ONLINE       0     0     0"
132  echo "	    ${disk4}  ONLINE       0     0     0"
133  echo "	    ${disk5}  ONLINE       0     0     0"
134  echo "	    ${disk6}  ONLINE       0     0     0"
135  echo "	    ${disk7}  ONLINE       0     0     0"
136  echo "errors: No known data errors"
137)`
138expect "${exp}" ${ZPOOL} status ${name0}
139add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
140expect_ok ${ZPOOL} offline ${name0} ${disk3}
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 "	  raidz2      DEGRADED     0     0     0"
154  echo "	    ${disk0}  ONLINE       0     0     0"
155  echo "	    ${disk1}  OFFLINE      0     0     0"
156  echo "	    ${disk2}  ONLINE       0     0     0"
157  echo "	    ${disk3}  OFFLINE      0     0     0"
158  echo "	  raidz2      ONLINE       0     0     0"
159  echo "	    ${disk4}  ONLINE       0     0     0"
160  echo "	    ${disk5}  ONLINE       0     0     0"
161  echo "	    ${disk6}  ONLINE       0     0     0"
162  echo "	    ${disk7}  ONLINE       0     0     0"
163  echo "errors: No known data errors"
164)`
165expect "${exp}" ${ZPOOL} status ${name0}
166expect_ok ${ZPOOL} offline ${name0} ${disk4} ${disk7}
167add_msg=""
168expect_fl ${ZPOOL} offline ${name0} ${disk0}
169expect_fl ${ZPOOL} offline ${name0} ${disk2}
170expect_fl ${ZPOOL} offline ${name0} ${disk5} ${disk6}
171exp=`(
172  echo "  pool: ${name0}"
173  echo " state: DEGRADED"
174  echo "status: One or more devices has been taken offline by the administrator."
175  echo "        Sufficient replicas exist for the pool to continue functioning in a"
176  echo "        degraded state."
177  echo "action: Online the device using 'zpool online' or replace the device with"
178  echo "        'zpool replace'."
179  echo " scrub: none requested"
180  echo "config:"
181  echo "	NAME          STATE     READ WRITE CKSUM"
182  echo "	${name0}      DEGRADED     0     0     0"
183  echo "	  raidz2      DEGRADED     0     0     0"
184  echo "	    ${disk0}  ONLINE       0     0     0"
185  echo "	    ${disk1}  OFFLINE      0     0     0"
186  echo "	    ${disk2}  ONLINE       0     0     0"
187  echo "	    ${disk3}  OFFLINE      0     0     0"
188  echo "	  raidz2      DEGRADED     0     0     0"
189  echo "	    ${disk4}  OFFLINE      0     0     0"
190  echo "	    ${disk5}  ONLINE       0     0     0"
191  echo "	    ${disk6}  ONLINE       0     0     0"
192  echo "	    ${disk7}  OFFLINE      0     0     0"
193  echo "errors: No known data errors"
194)`
195add_msg="# TODO Sun CR 6328632, Lustre bug 16878"
196expect "${exp}" ${ZPOOL} status ${name0}
197add_msg=""
198expect_ok ${ZPOOL} destroy ${name0}
199expect_fl ${ZPOOL} status -x ${name0}
200
201disks_destroy
202