]> CyberLeo.Net >> Repos - FreeBSD/releng/9.2.git/blob - tools/regression/zfs/zpool/replace/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 / replace / raidz1.t
1 #!/bin/sh
2 # $FreeBSD$
3
4 dir=`dirname $0`
5 . ${dir}/../../misc.sh
6
7 echo "1..27"
8
9 disks_create 4
10 names_create 1
11
12 expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
13 expect_ok ${ZPOOL} export ${name0}
14 dname0=${disk0}
15 fdname0=${fdisk0}
16 guid0=`get_guid ${fdisk0}`
17 disk_destroy 0
18 disk_create 0 ${dname0}
19 expect_ok ${ZPOOL} import ${import_flags} ${name0}
20 exp=`(
21   echo "  pool: ${name0}"
22   echo " state: DEGRADED"
23   echo "status: One or more devices could not be used because the label is missing or"
24   echo "      invalid.  Sufficient replicas exist for the pool to continue"
25   echo "      functioning in a degraded state."
26   echo "action: Replace the device using 'zpool replace'."
27   echo "   see: http://www.sun.com/msg/ZFS-8000-4J"
28   echo " scrub: none requested"
29   echo "config:"
30   echo "        NAME          STATE     READ WRITE CKSUM"
31   echo "        ${name0}      DEGRADED     0     0     0"
32   echo "          raidz1      DEGRADED     0     0     0"
33   echo "            ${guid0}  UNAVAIL      0     0     0 was ${fdname0}"
34   echo "            ${disk1}  ONLINE       0     0     0"
35   echo "            ${disk2}  ONLINE       0     0     0"
36   echo "errors: No known data errors"
37 )`
38 expect "${exp}" ${ZPOOL} status ${name0}
39 expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk3}
40 wait_for_resilver ${name0}
41 exp=`(
42   echo "  pool: ${name0}"
43   echo " state: ONLINE"
44   echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
45   echo "config:"
46   echo "        NAME          STATE   READ WRITE CKSUM"
47   echo "        ${name0}      ONLINE     0     0     0"
48   echo "          raidz1      ONLINE     0     0     0"
49   echo "            ${disk3}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
50   echo "            ${disk1}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
51   echo "            ${disk2}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
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 ${name0} raidz1 ${disk0} ${disk1} ${disk2}
59 expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
60 wait_for_resilver ${name0}
61 exp=`(
62   echo "  pool: ${name0}"
63   echo " state: ONLINE"
64   echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
65   echo "config:"
66   echo "        NAME          STATE   READ WRITE CKSUM"
67   echo "        ${name0}      ONLINE     0     0     0"
68   echo "          raidz1      ONLINE     0     0     0"
69   echo "            ${disk0}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
70   echo "            ${disk3}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
71   echo "            ${disk2}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
72   echo "errors: No known data errors"
73 )`
74 expect "${exp}" ${ZPOOL} status ${name0}
75 expect_ok ${ZPOOL} destroy ${name0}
76 expect_fl ${ZPOOL} status -x ${name0}
77
78 expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
79 expect_ok ${ZPOOL} export ${name0}
80 dname0=${disk0}
81 fdname0=${fdisk0}
82 guid0=`get_guid ${fdisk0}`
83 disk_destroy 0
84 expect_ok ${ZPOOL} import ${import_flags} ${name0}
85 exp=`(
86   echo "  pool: ${name0}"
87   echo " state: DEGRADED"
88   echo " scrub: none requested"
89   echo "config:"
90   echo "        NAME           STATE     READ WRITE CKSUM"
91   echo "        ${name0}       DEGRADED     0     0     0"
92   echo "          raidz1       DEGRADED     0     0     0"
93   echo "            ${guid0}   REMOVED      0     0     0  was ${fdname0}"
94   echo "            ${disk1}   ONLINE       0     0     0"
95   echo "            ${disk2}   ONLINE       0     0     0"
96   echo "errors: No known data errors"
97 )`
98 expect "${exp}" ${ZPOOL} status ${name0}
99 expect_ok ${ZPOOL} replace ${name0} ${dname0} ${disk3}
100 wait_for_resilver ${name0}
101 exp=`(
102   echo "  pool: ${name0}"
103   echo " state: ONLINE"
104   echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
105   echo "config:"
106   echo "        NAME          STATE   READ WRITE CKSUM"
107   echo "        ${name0}      ONLINE     0     0     0"
108   echo "          raidz1      ONLINE     0     0     0"
109   echo "            ${disk3}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
110   echo "            ${disk1}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
111   echo "            ${disk2}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
112   echo "errors: No known data errors"
113 )`
114 expect "${exp}" ${ZPOOL} status ${name0}
115 expect_ok ${ZPOOL} destroy ${name0}
116 expect_fl ${ZPOOL} status -x ${name0}
117 disk_create 0 ${dname0}
118
119 expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2}
120 expect_ok ${ZPOOL} offline ${name0} ${disk1}
121 expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
122 wait_for_resilver ${name0}
123 exp=`(
124   echo "  pool: ${name0}"
125   echo " state: ONLINE"
126   echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
127   echo "config:"
128   echo "        NAME          STATE   READ WRITE CKSUM"
129   echo "        ${name0}      ONLINE     0     0     0"
130   echo "          raidz1      ONLINE     0     0     0"
131   echo "            ${disk0}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
132   echo "            ${disk3}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
133   echo "            ${disk2}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
134   echo "errors: No known data errors"
135 )`
136 expect "${exp}" ${ZPOOL} status ${name0}
137 expect_ok ${ZPOOL} destroy ${name0}
138 expect_fl ${ZPOOL} status -x ${name0}
139
140 disks_destroy