]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - tools/regression/zfs/zpool/replace/log.t
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / tools / regression / zfs / zpool / replace / log.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} ${disk0} log mirror ${disk1} ${disk2}
13 expect_ok ${ZPOOL} export ${name0}
14 dname1=${disk1}
15 fdname1=${fdisk1}
16 guid1=`get_guid ${fdisk1}`
17 disk_destroy 1
18 disk_create 1 ${dname1}
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 "          ${disk0}    ONLINE       0     0     0"
33   echo "        logs          DEGRADED     0     0     0"
34   echo "          mirror      DEGRADED     0     0     0"
35   echo "            ${guid1}  UNAVAIL      0     0     0 was ${fdname1}"
36   echo "            ${disk2}  ONLINE       0     0     0"
37   echo "errors: No known data errors"
38 )`
39 add_msg="# TODO Sun CR 6710376, Lustre bug 16912"
40 expect "${exp}" ${ZPOOL} status ${name0}
41 add_msg=""
42 expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
43 wait_for_resilver ${name0}
44 exp=`(
45   echo "  pool: ${name0}"
46   echo " state: ONLINE"
47   echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
48   echo "config:"
49   echo "        NAME          STATE   READ WRITE CKSUM"
50   echo "        ${name0}      ONLINE     0     0     0"
51   echo "          ${disk0}    ONLINE     0     0     0"
52   echo "        logs          ONLINE     0     0     0"
53   echo "          mirror      ONLINE     0     0     0"
54   echo "            ${disk3}  ONLINE     0     0     0"
55   echo "            ${disk2}  ONLINE     0     0     0"
56   echo "errors: No known data errors"
57 )`
58 expect "${exp}" ${ZPOOL} status ${name0}
59 expect_ok ${ZPOOL} destroy ${name0}
60 expect_fl ${ZPOOL} status -x ${name0}
61
62 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
63 expect_ok ${ZPOOL} replace ${name0} ${disk2} ${disk3}
64 wait_for_resilver ${name0}
65 exp=`(
66   echo "  pool: ${name0}"
67   echo " state: ONLINE"
68   echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
69   echo "config:"
70   echo "        NAME          STATE   READ WRITE CKSUM"
71   echo "        ${name0}      ONLINE     0     0     0"
72   echo "          ${disk0}    ONLINE     0     0     0"
73   echo "        logs          ONLINE     0     0     0"
74   echo "          mirror      ONLINE     0     0     0"
75   echo "            ${disk1}  ONLINE     0     0     0"
76   echo "            ${disk3}  ONLINE     0     0     0"
77   echo "errors: No known data errors"
78 )`
79 expect "${exp}" ${ZPOOL} status ${name0}
80 expect_ok ${ZPOOL} destroy ${name0}
81 expect_fl ${ZPOOL} status -x ${name0}
82
83 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
84 expect_ok ${ZPOOL} export ${name0}
85 dname1=${disk1}
86 fdname1=${fdisk1}
87 guid1=`get_guid ${fdisk1}`
88 disk_destroy 1
89 expect_ok ${ZPOOL} import ${import_flags} ${name0}
90 exp=`(
91   echo "  pool: ${name0}"
92   echo " state: DEGRADED"
93   echo "status: One or more devices could not be opened.  Sufficient replicas exist for"
94   echo "      the pool to continue functioning in a degraded state."
95   echo "action: Attach the missing device and online it using 'zpool online'."
96   echo "   see: http://www.sun.com/msg/ZFS-8000-2Q"
97   echo " scrub: none requested"
98   echo "config:"
99   echo "        NAME           STATE     READ WRITE CKSUM"
100   echo "        ${name0}       DEGRADED     0     0     0"
101   echo "          ${disk0}     ONLINE       0     0     0"
102   echo "        logs           DEGRADED     0     0     0"
103   echo "          mirror       DEGRADED     0     0     0"
104   echo "            ${guid1}   UNAVAIL      0     0     0  was ${fdname1}"
105   echo "            ${disk2}   ONLINE       0     0     0"
106   echo "errors: No known data errors"
107 )`
108 expect "${exp}" ${ZPOOL} status ${name0}
109 expect_ok ${ZPOOL} replace ${name0} ${dname1} ${disk3}
110 wait_for_resilver ${name0}
111 exp=`(
112   echo "  pool: ${name0}"
113   echo " state: ONLINE"
114   echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
115   echo "config:"
116   echo "        NAME          STATE   READ WRITE CKSUM"
117   echo "        ${name0}      ONLINE     0     0     0"
118   echo "          ${disk0}    ONLINE     0     0     0"
119   echo "        logs          ONLINE     0     0     0"
120   echo "          mirror      ONLINE     0     0     0"
121   echo "            ${disk3}  ONLINE     0     0     0"
122   echo "            ${disk2}  ONLINE     0     0     0"
123   echo "errors: No known data errors"
124 )`
125 expect "${exp}" ${ZPOOL} status ${name0}
126 expect_ok ${ZPOOL} destroy ${name0}
127 expect_fl ${ZPOOL} status -x ${name0}
128 disk_create 1 ${dname1}
129
130 expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2}
131 expect_ok ${ZPOOL} offline ${name0} ${disk1}
132 expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
133 wait_for_resilver ${name0}
134 exp=`(
135   echo "  pool: ${name0}"
136   echo " state: ONLINE"
137   echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*"
138   echo "config:"
139   echo "        NAME          STATE   READ WRITE CKSUM"
140   echo "        ${name0}      ONLINE     0     0     0"
141   echo "          ${disk0}    ONLINE     0     0     0"
142   echo "        logs          ONLINE     0     0     0"
143   echo "          mirror      ONLINE     0     0     0"
144   echo "            ${disk3}  ONLINE     0     0     0"
145   echo "            ${disk2}  ONLINE     0     0     0"
146   echo "errors: No known data errors"
147 )`
148 expect "${exp}" ${ZPOOL} status ${name0}
149 expect_ok ${ZPOOL} destroy ${name0}
150 expect_fl ${ZPOOL} status -x ${name0}
151
152 disks_destroy