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