1#!/bin/sh 2# $FreeBSD$ 3 4dir=`dirname $0` 5. ${dir}/../../misc.sh 6 7echo "1..27" 8 9disks_create 4 10names_create 1 11 12expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} 13expect_ok ${ZPOOL} export ${name0} 14dname1=${disk1} 15fdname1=${fdisk1} 16guid1=`get_guid ${fdisk1}` 17disk_destroy 1 18disk_create 1 ${dname1} 19expect_ok ${ZPOOL} import ${import_flags} ${name0} 20exp=`( 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)` 39add_msg="# TODO Sun CR 6710376, Lustre bug 16912" 40expect "${exp}" ${ZPOOL} status ${name0} 41add_msg="" 42expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3} 43wait_for_resilver ${name0} 44exp=`( 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)` 58expect "${exp}" ${ZPOOL} status ${name0} 59expect_ok ${ZPOOL} destroy ${name0} 60expect_fl ${ZPOOL} status -x ${name0} 61 62expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} 63expect_ok ${ZPOOL} replace ${name0} ${disk2} ${disk3} 64wait_for_resilver ${name0} 65exp=`( 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)` 79expect "${exp}" ${ZPOOL} status ${name0} 80expect_ok ${ZPOOL} destroy ${name0} 81expect_fl ${ZPOOL} status -x ${name0} 82 83expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} 84expect_ok ${ZPOOL} export ${name0} 85dname1=${disk1} 86fdname1=${fdisk1} 87guid1=`get_guid ${fdisk1}` 88disk_destroy 1 89expect_ok ${ZPOOL} import ${import_flags} ${name0} 90exp=`( 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)` 108expect "${exp}" ${ZPOOL} status ${name0} 109expect_ok ${ZPOOL} replace ${name0} ${dname1} ${disk3} 110wait_for_resilver ${name0} 111exp=`( 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)` 125expect "${exp}" ${ZPOOL} status ${name0} 126expect_ok ${ZPOOL} destroy ${name0} 127expect_fl ${ZPOOL} status -x ${name0} 128disk_create 1 ${dname1} 129 130expect_ok ${ZPOOL} create ${name0} ${disk0} log mirror ${disk1} ${disk2} 131expect_ok ${ZPOOL} offline ${name0} ${disk1} 132expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3} 133wait_for_resilver ${name0} 134exp=`( 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)` 148expect "${exp}" ${ZPOOL} status ${name0} 149expect_ok ${ZPOOL} destroy ${name0} 150expect_fl ${ZPOOL} status -x ${name0} 151 152disks_destroy 153