xref: /freebsd/tools/regression/zfs/zpool/offline/raidz1.t (revision 7fdf597e96a02165cfe22ff357b857d5fa15ed8a)
1#!/bin/sh
2
3dir=`dirname $0`
4. ${dir}/../../misc.sh
5
6echo "1..35"
7
8disks_create 5
9names_create 1
10
11expect_ok ${ZPOOL} create ${name0} raidz1 ${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 "	  raidz1      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} raidz1 ${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 "	  raidz1      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} raidz1 ${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 "	  raidz1      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} raidz1 ${disk0} ${disk1} raidz1 ${disk2} ${disk3}
82expect_ok ${ZPOOL} offline ${name0} ${disk0}
83exp=`(
84  echo "  pool: ${name0}"
85  echo " state: DEGRADED"
86  echo "status: One or more devices has been taken offline by the administrator."
87  echo "        Sufficient replicas exist for the pool to continue functioning in a"
88  echo "        degraded state."
89  echo "action: Online the device using 'zpool online' or replace the device with"
90  echo "        'zpool replace'."
91  echo " scrub: none requested"
92  echo "config:"
93  echo "	NAME          STATE     READ WRITE CKSUM"
94  echo "	${name0}      DEGRADED     0     0     0"
95  echo "	  raidz1      DEGRADED     0     0     0"
96  echo "	    ${disk0}  OFFLINE      0     0     0"
97  echo "	    ${disk1}  ONLINE       0     0     0"
98  echo "	  raidz1      ONLINE       0     0     0"
99  echo "	    ${disk2}  ONLINE       0     0     0"
100  echo "	    ${disk3}  ONLINE       0     0     0"
101  echo "errors: No known data errors"
102)`
103expect_ok ${ZPOOL} offline ${name0} ${disk3}
104expect_fl ${ZPOOL} offline ${name0} ${disk1}
105expect_fl ${ZPOOL} offline ${name0} ${disk2}
106exp=`(
107  echo "  pool: ${name0}"
108  echo " state: DEGRADED"
109  echo "status: One or more devices has been taken offline by the administrator."
110  echo "        Sufficient replicas exist for the pool to continue functioning in a"
111  echo "        degraded state."
112  echo "action: Online the device using 'zpool online' or replace the device with"
113  echo "        'zpool replace'."
114  echo " scrub: none requested"
115  echo "config:"
116  echo "	NAME          STATE     READ WRITE CKSUM"
117  echo "	${name0}      DEGRADED     0     0     0"
118  echo "	  raidz1      DEGRADED     0     0     0"
119  echo "	    ${disk0}  OFFLINE      0     0     0"
120  echo "	    ${disk1}  ONLINE       0     0     0"
121  echo "	  raidz1      DEGRADED     0     0     0"
122  echo "	    ${disk2}  ONLINE       0     0     0"
123  echo "	    ${disk3}  OFFLINE      0     0     0"
124  echo "errors: No known data errors"
125)`
126expect "${exp}" ${ZPOOL} status ${name0}
127expect_ok ${ZPOOL} destroy ${name0}
128expect_fl ${ZPOOL} status -x ${name0}
129
130expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1} raidz1 ${disk2} ${disk3}
131expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
132exp=`(
133  echo "  pool: ${name0}"
134  echo " state: DEGRADED"
135  echo "status: One or more devices has been taken offline by the administrator."
136  echo "        Sufficient replicas exist for the pool to continue functioning in a"
137  echo "        degraded state."
138  echo "action: Online the device using 'zpool online' or replace the device with"
139  echo "        'zpool replace'."
140  echo " scrub: none requested"
141  echo "config:"
142  echo "	NAME          STATE     READ WRITE CKSUM"
143  echo "	${name0}      DEGRADED     0     0     0"
144  echo "	  raidz1      DEGRADED     0     0     0"
145  echo "	    ${disk0}  ONLINE       0     0     0"
146  echo "	    ${disk1}  OFFLINE      0     0     0"
147  echo "	  raidz1      DEGRADED     0     0     0"
148  echo "	    ${disk2}  OFFLINE      0     0     0"
149  echo "	    ${disk3}  ONLINE       0     0     0"
150  echo "errors: No known data errors"
151)`
152expect "${exp}" ${ZPOOL} status ${name0}
153expect_ok ${ZPOOL} destroy ${name0}
154expect_fl ${ZPOOL} status -x ${name0}
155
156expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
157expect_ok ${ZPOOL} offline ${name0} ${disk1}
158expect_fl ${ZPOOL} offline ${name0} ${disk3}
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 "	  raidz1      DEGRADED     0     0     0"
172  echo "	    ${disk0}  ONLINE       0     0     0"
173  echo "	    ${disk1}  OFFLINE      0     0     0"
174  echo "	    ${disk2}  ONLINE       0     0     0"
175  echo "	    ${disk3}  ONLINE       0     0     0"
176  echo "	    ${disk4}  ONLINE       0     0     0"
177  echo "errors: No known data errors"
178)`
179expect "${exp}" ${ZPOOL} status ${name0}
180expect_ok ${ZPOOL} destroy ${name0}
181expect_fl ${ZPOOL} status -x ${name0}
182
183disks_destroy
184