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