1185029Spjd#!/bin/sh 2185029Spjd# $FreeBSD: releng/10.3/tools/regression/zfs/zpool/offline/mirror.t 185029 2008-11-17 20:49:29Z pjd $ 3185029Spjd 4185029Spjddir=`dirname $0` 5185029Spjd. ${dir}/../../misc.sh 6185029Spjd 7185029Spjdecho "1..47" 8185029Spjd 9185029Spjddisks_create 6 10185029Spjdnames_create 1 11185029Spjd 12185029Spjdexpect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} 13185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk0} 14185029Spjdexp=`( 15185029Spjd echo " pool: ${name0}" 16185029Spjd echo " state: DEGRADED" 17185029Spjd echo "status: One or more devices has been taken offline by the administrator." 18185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 19185029Spjd echo " degraded state." 20185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 21185029Spjd echo " 'zpool replace'." 22185029Spjd echo " scrub: none requested" 23185029Spjd echo "config:" 24185029Spjd echo " NAME STATE READ WRITE CKSUM" 25185029Spjd echo " ${name0} DEGRADED 0 0 0" 26185029Spjd echo " mirror DEGRADED 0 0 0" 27185029Spjd echo " ${disk0} OFFLINE 0 0 0" 28185029Spjd echo " ${disk1} ONLINE 0 0 0" 29185029Spjd echo "errors: No known data errors" 30185029Spjd)` 31185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 32185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 33185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 34185029Spjd 35185029Spjdexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} 36185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk1} 37185029Spjdexp=`( 38185029Spjd echo " pool: ${name0}" 39185029Spjd echo " state: DEGRADED" 40185029Spjd echo "status: One or more devices has been taken offline by the administrator." 41185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 42185029Spjd echo " degraded state." 43185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 44185029Spjd echo " 'zpool replace'." 45185029Spjd echo " scrub: none requested" 46185029Spjd echo "config:" 47185029Spjd echo " NAME STATE READ WRITE CKSUM" 48185029Spjd echo " ${name0} DEGRADED 0 0 0" 49185029Spjd echo " mirror DEGRADED 0 0 0" 50185029Spjd echo " ${disk0} ONLINE 0 0 0" 51185029Spjd echo " ${disk1} OFFLINE 0 0 0" 52185029Spjd echo "errors: No known data errors" 53185029Spjd)` 54185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 55185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 56185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 57185029Spjd 58185029Spjdexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} 59185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk0} 60185029Spjdexpect_fl ${ZPOOL} offline ${name0} ${disk1} 61185029Spjdexp=`( 62185029Spjd echo " pool: ${name0}" 63185029Spjd echo " state: DEGRADED" 64185029Spjd echo "status: One or more devices has been taken offline by the administrator." 65185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 66185029Spjd echo " degraded state." 67185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 68185029Spjd echo " 'zpool replace'." 69185029Spjd echo " scrub: none requested" 70185029Spjd echo "config:" 71185029Spjd echo " NAME STATE READ WRITE CKSUM" 72185029Spjd echo " ${name0} DEGRADED 0 0 0" 73185029Spjd echo " mirror DEGRADED 0 0 0" 74185029Spjd echo " ${disk0} OFFLINE 0 0 0" 75185029Spjd echo " ${disk1} ONLINE 0 0 0" 76185029Spjd echo "errors: No known data errors" 77185029Spjd)` 78185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 79185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 80185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 81185029Spjd 82185029Spjdexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3} 83185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk0} 84185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk3} 85185029Spjdexpect_fl ${ZPOOL} offline ${name0} ${disk1} 86185029Spjdexpect_fl ${ZPOOL} offline ${name0} ${disk2} 87185029Spjdexp=`( 88185029Spjd echo " pool: ${name0}" 89185029Spjd echo " state: DEGRADED" 90185029Spjd echo "status: One or more devices has been taken offline by the administrator." 91185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 92185029Spjd echo " degraded state." 93185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 94185029Spjd echo " 'zpool replace'." 95185029Spjd echo " scrub: none requested" 96185029Spjd echo "config:" 97185029Spjd echo " NAME STATE READ WRITE CKSUM" 98185029Spjd echo " ${name0} DEGRADED 0 0 0" 99185029Spjd echo " mirror DEGRADED 0 0 0" 100185029Spjd echo " ${disk0} OFFLINE 0 0 0" 101185029Spjd echo " ${disk1} ONLINE 0 0 0" 102185029Spjd echo " mirror DEGRADED 0 0 0" 103185029Spjd echo " ${disk2} ONLINE 0 0 0" 104185029Spjd echo " ${disk3} OFFLINE 0 0 0" 105185029Spjd echo "errors: No known data errors" 106185029Spjd)` 107185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 108185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 109185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 110185029Spjd 111185029Spjdexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} mirror ${disk2} ${disk3} 112185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk1} ${disk2} 113185029Spjdexp=`( 114185029Spjd echo " pool: ${name0}" 115185029Spjd echo " state: DEGRADED" 116185029Spjd echo "status: One or more devices has been taken offline by the administrator." 117185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 118185029Spjd echo " degraded state." 119185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 120185029Spjd echo " 'zpool replace'." 121185029Spjd echo " scrub: none requested" 122185029Spjd echo "config:" 123185029Spjd echo " NAME STATE READ WRITE CKSUM" 124185029Spjd echo " ${name0} DEGRADED 0 0 0" 125185029Spjd echo " mirror DEGRADED 0 0 0" 126185029Spjd echo " ${disk0} ONLINE 0 0 0" 127185029Spjd echo " ${disk1} OFFLINE 0 0 0" 128185029Spjd echo " mirror DEGRADED 0 0 0" 129185029Spjd echo " ${disk2} OFFLINE 0 0 0" 130185029Spjd echo " ${disk3} ONLINE 0 0 0" 131185029Spjd echo "errors: No known data errors" 132185029Spjd)` 133185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 134185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 135185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 136185029Spjd 137185029Spjdexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2} 138185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk0} 139185029Spjdadd_msg="# TODO Sun CR 6328632, Lustre bug 16878" 140185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk1} 141185029Spjdexp=`( 142185029Spjd echo " pool: ${name0}" 143185029Spjd echo " state: DEGRADED" 144185029Spjd echo "status: One or more devices has been taken offline by the administrator." 145185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 146185029Spjd echo " degraded state." 147185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 148185029Spjd echo " 'zpool replace'." 149185029Spjd echo " scrub: none requested" 150185029Spjd echo "config:" 151185029Spjd echo " NAME STATE READ WRITE CKSUM" 152185029Spjd echo " ${name0} DEGRADED 0 0 0" 153185029Spjd echo " mirror DEGRADED 0 0 0" 154185029Spjd echo " ${disk0} OFFLINE 0 0 0" 155185029Spjd echo " ${disk1} OFFLINE 0 0 0" 156185029Spjd echo " ${disk2} ONLINE 0 0 0" 157185029Spjd echo "errors: No known data errors" 158185029Spjd)` 159185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 160185029Spjdadd_msg="" 161185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 162185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 163185029Spjd 164185029Spjdexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2} mirror ${disk3} ${disk4} ${disk5} 165185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk0} 166185029Spjdadd_msg="# TODO Sun CR 6328632, Lustre bug 16878" 167185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk1} 168185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk3} ${disk5} 169185029Spjdexp=`( 170185029Spjd echo " pool: ${name0}" 171185029Spjd echo " state: DEGRADED" 172185029Spjd echo "status: One or more devices has been taken offline by the administrator." 173185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 174185029Spjd echo " degraded state." 175185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 176185029Spjd echo " 'zpool replace'." 177185029Spjd echo " scrub: none requested" 178185029Spjd echo "config:" 179185029Spjd echo " NAME STATE READ WRITE CKSUM" 180185029Spjd echo " ${name0} DEGRADED 0 0 0" 181185029Spjd echo " mirror DEGRADED 0 0 0" 182185029Spjd echo " ${disk0} OFFLINE 0 0 0" 183185029Spjd echo " ${disk1} OFFLINE 0 0 0" 184185029Spjd echo " ${disk2} ONLINE 0 0 0" 185185029Spjd echo " mirror DEGRADED 0 0 0" 186185029Spjd echo " ${disk3} OFFLINE 0 0 0" 187185029Spjd echo " ${disk4} ONLINE 0 0 0" 188185029Spjd echo " ${disk5} OFFLINE 0 0 0" 189185029Spjd echo "errors: No known data errors" 190185029Spjd)` 191185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 192185029Spjdadd_msg="" 193185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 194185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 195185029Spjd 196185029Spjdexpect_ok ${ZPOOL} create -f ${name0} mirror ${disk0} ${disk1} ${disk2} ${disk3} ${disk4} 197185029Spjdadd_msg="# TODO Sun CR 6328632, Lustre bug 16878" 198185029Spjdexpect_ok ${ZPOOL} offline ${name0} ${disk0} ${disk2} ${disk3} ${disk4} 199185029Spjdexp=`( 200185029Spjd echo " pool: ${name0}" 201185029Spjd echo " state: DEGRADED" 202185029Spjd echo "status: One or more devices has been taken offline by the administrator." 203185029Spjd echo " Sufficient replicas exist for the pool to continue functioning in a" 204185029Spjd echo " degraded state." 205185029Spjd echo "action: Online the device using 'zpool online' or replace the device with" 206185029Spjd echo " 'zpool replace'." 207185029Spjd echo " scrub: none requested" 208185029Spjd echo "config:" 209185029Spjd echo " NAME STATE READ WRITE CKSUM" 210185029Spjd echo " ${name0} DEGRADED 0 0 0" 211185029Spjd echo " mirror DEGRADED 0 0 0" 212185029Spjd echo " ${disk0} OFFLINE 0 0 0" 213185029Spjd echo " ${disk1} ONLINE 0 0 0" 214185029Spjd echo " ${disk2} OFFLINE 0 0 0" 215185029Spjd echo " ${disk3} OFFLINE 0 0 0" 216185029Spjd echo " ${disk4} OFFLINE 0 0 0" 217185029Spjd echo "errors: No known data errors" 218185029Spjd)` 219185029Spjdexpect "${exp}" ${ZPOOL} status ${name0} 220185029Spjdadd_msg="" 221185029Spjdexpect_ok ${ZPOOL} destroy ${name0} 222185029Spjdexpect_fl ${ZPOOL} status -x ${name0} 223185029Spjd 224185029Spjddisks_destroy 225