1#!/bin/sh 2# $FreeBSD$ 3 4dir=`dirname $0` 5. ${dir}/../../misc.sh 6 7echo "1..34" 8 9disks_create 5 10names_create 1 11 12expect_ok ${ZPOOL} create ${name0} ${disk0} 13expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk1} 14wait_for_resilver ${name0} 15exp=`( 16 echo " pool: ${name0}" 17 echo " state: ONLINE" 18 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 19 echo "config:" 20 echo " NAME STATE READ WRITE CKSUM" 21 echo " ${name0} ONLINE 0 0 0" 22 echo " mirror ONLINE 0 0 0" 23 echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 24 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 25 echo "errors: No known data errors" 26)` 27expect "${exp}" ${ZPOOL} status ${name0} 28expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk2} 29wait_for_resilver ${name0} 30exp=`( 31 echo " pool: ${name0}" 32 echo " state: ONLINE" 33 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 34 echo "config:" 35 echo " NAME STATE READ WRITE CKSUM" 36 echo " ${name0} ONLINE 0 0 0" 37 echo " mirror ONLINE 0 0 0" 38 echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 39 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 40 echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 41 echo "errors: No known data errors" 42)` 43expect "${exp}" ${ZPOOL} status ${name0} 44expect_ok ${ZPOOL} attach ${name0} ${disk2} ${disk3} 45wait_for_resilver ${name0} 46exp=`( 47 echo " pool: ${name0}" 48 echo " state: ONLINE" 49 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 50 echo "config:" 51 echo " NAME STATE READ WRITE CKSUM" 52 echo " ${name0} ONLINE 0 0 0" 53 echo " mirror ONLINE 0 0 0" 54 echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 55 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 56 echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 57 echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 58 echo "errors: No known data errors" 59)` 60expect "${exp}" ${ZPOOL} status ${name0} 61expect_ok ${ZPOOL} detach ${name0} ${disk0} 62exp=`( 63 echo " pool: ${name0}" 64 echo " state: ONLINE" 65 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 66 echo "config:" 67 echo " NAME STATE READ WRITE CKSUM" 68 echo " ${name0} ONLINE 0 0 0" 69 echo " mirror ONLINE 0 0 0" 70 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 71 echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 72 echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 73 echo "errors: No known data errors" 74)` 75expect "${exp}" ${ZPOOL} status ${name0} 76expect_ok ${ZPOOL} detach ${name0} ${disk2} 77exp=`( 78 echo " pool: ${name0}" 79 echo " state: ONLINE" 80 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 81 echo "config:" 82 echo " NAME STATE READ WRITE CKSUM" 83 echo " ${name0} ONLINE 0 0 0" 84 echo " mirror ONLINE 0 0 0" 85 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 86 echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 87 echo "errors: No known data errors" 88)` 89expect "${exp}" ${ZPOOL} status ${name0} 90expect_ok ${ZPOOL} detach ${name0} ${disk3} 91exp=`( 92 echo " pool: ${name0}" 93 echo " state: ONLINE" 94 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 95 echo "config:" 96 echo " NAME STATE READ WRITE CKSUM" 97 echo " ${name0} ONLINE 0 0 0" 98 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 99 echo "errors: No known data errors" 100)` 101expect "${exp}" ${ZPOOL} status ${name0} 102expect_fl ${ZPOOL} detach ${name0} ${disk1} 103exp=`( 104 echo " pool: ${name0}" 105 echo " state: ONLINE" 106 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 107 echo "config:" 108 echo " NAME STATE READ WRITE CKSUM" 109 echo " ${name0} ONLINE 0 0 0" 110 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 111 echo "errors: No known data errors" 112)` 113expect "${exp}" ${ZPOOL} status ${name0} 114expect_ok ${ZPOOL} destroy ${name0} 115expect_fl ${ZPOOL} status -x ${name0} 116 117expect_ok ${ZPOOL} create ${name0} ${disk0} 118expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk1} 119wait_for_resilver ${name0} 120exp=`( 121 echo " pool: ${name0}" 122 echo " state: ONLINE" 123 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 124 echo "config:" 125 echo " NAME STATE READ WRITE CKSUM" 126 echo " ${name0} ONLINE 0 0 0" 127 echo " mirror ONLINE 0 0 0" 128 echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 129 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 130 echo "errors: No known data errors" 131)` 132expect "${exp}" ${ZPOOL} status ${name0} 133expect_ok ${ZPOOL} export ${name0} 134expect_ok ${ZPOOL} import ${import_flags} ${name0} 135exp=`( 136 echo " pool: ${name0}" 137 echo " state: ONLINE" 138 echo " scrub: none requested" 139 echo "config:" 140 echo " NAME STATE READ WRITE CKSUM" 141 echo " ${name0} ONLINE 0 0 0" 142 echo " mirror ONLINE 0 0 0" 143 echo " ${disk0} ONLINE 0 0 0" 144 echo " ${disk1} ONLINE 0 0 0" 145 echo "errors: No known data errors" 146)` 147expect "${exp}" ${ZPOOL} status ${name0} 148expect_ok ${ZPOOL} destroy ${name0} 149expect_fl ${ZPOOL} status -x ${name0} 150 151expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1} 152expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk2} 153wait_for_resilver ${name0} 154exp=`( 155 echo " pool: ${name0}" 156 echo " state: ONLINE" 157 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 158 echo "config:" 159 echo " NAME STATE READ WRITE CKSUM" 160 echo " ${name0} ONLINE 0 0 0" 161 echo " mirror ONLINE 0 0 0" 162 echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 163 echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 164 echo " ${disk1} ONLINE 0 0 0" 165 echo "errors: No known data errors" 166)` 167expect "${exp}" ${ZPOOL} status ${name0} 168expect_ok ${ZPOOL} attach ${name0} ${disk1} ${disk3} 169wait_for_resilver ${name0} 170exp=`( 171 echo " pool: ${name0}" 172 echo " state: ONLINE" 173 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 174 echo "config:" 175 echo " NAME STATE READ WRITE CKSUM" 176 echo " ${name0} ONLINE 0 0 0" 177 echo " mirror ONLINE 0 0 0" 178 echo " ${disk0} ONLINE 0 0 0" 179 echo " ${disk2} ONLINE 0 0 0" 180 echo " mirror ONLINE 0 0 0" 181 echo " ${disk1} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 182 echo " ${disk3} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 183 echo "errors: No known data errors" 184)` 185expect "${exp}" ${ZPOOL} status ${name0} 186expect_ok ${ZPOOL} attach ${name0} ${disk0} ${disk4} 187wait_for_resilver ${name0} 188exp=`( 189 echo " pool: ${name0}" 190 echo " state: ONLINE" 191 echo " scrub: resilver completed after [0-9]+h[0-9]+m with 0 errors on .*" 192 echo "config:" 193 echo " NAME STATE READ WRITE CKSUM" 194 echo " ${name0} ONLINE 0 0 0" 195 echo " mirror ONLINE 0 0 0" 196 echo " ${disk0} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 197 echo " ${disk2} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 198 echo " ${disk4} ONLINE 0 0 0 [0-9.]+[A-Z] resilvered" 199 echo " mirror ONLINE 0 0 0" 200 echo " ${disk1} ONLINE 0 0 0" 201 echo " ${disk3} ONLINE 0 0 0" 202 echo "errors: No known data errors" 203)` 204expect "${exp}" ${ZPOOL} status ${name0} 205expect_ok ${ZPOOL} destroy ${name0} 206expect_fl ${ZPOOL} status -x ${name0} 207 208disks_destroy 209