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