]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/zfs/zpool/offline/raidz1.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 / raidz1.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 dir=`dirname $0`
5 . ${dir}/../../misc.sh
6
7 echo "1..35"
8
9 disks_create 5
10 names_create 1
11
12 expect_ok ${ZPOOL} create ${name0} raidz1 ${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 "          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 )`
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} raidz1 ${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 "          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 )`
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} raidz1 ${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 "          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 )`
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} raidz1 ${disk0} ${disk1} raidz1 ${disk2} ${disk3}
83 expect_ok ${ZPOOL} offline ${name0} ${disk0}
84 exp=`(
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 )`
104 expect_ok ${ZPOOL} offline ${name0} ${disk3}
105 expect_fl ${ZPOOL} offline ${name0} ${disk1}
106 expect_fl ${ZPOOL} offline ${name0} ${disk2}
107 exp=`(
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 )`
127 expect "${exp}" ${ZPOOL} status ${name0}
128 expect_ok ${ZPOOL} destroy ${name0}
129 expect_fl ${ZPOOL} status -x ${name0}
130
131 expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1} raidz1 ${disk2} ${disk3}
132 expect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2}
133 exp=`(
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 )`
153 expect "${exp}" ${ZPOOL} status ${name0}
154 expect_ok ${ZPOOL} destroy ${name0}
155 expect_fl ${ZPOOL} status -x ${name0}
156
157 expect_ok ${ZPOOL} create -f ${name0} raidz1 ${disk0} ${disk1} ${disk2} ${disk3} ${disk4}
158 expect_ok ${ZPOOL} offline ${name0} ${disk1}
159 expect_fl ${ZPOOL} offline ${name0} ${disk3}
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 "          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 )`
180 expect "${exp}" ${ZPOOL} status ${name0}
181 expect_ok ${ZPOOL} destroy ${name0}
182 expect_fl ${ZPOOL} status -x ${name0}
183
184 disks_destroy