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