xref: /freebsd/tools/regression/zfs/zpool/replace/disk.t (revision 7aa383846770374466b1dcb2cefd71bde9acf463)
1#!/bin/sh
2# $FreeBSD$
3
4dir=`dirname $0`
5. ${dir}/../../misc.sh
6
7echo "1..10"
8
9disks_create 4
10names_create 1
11
12expect_ok ${ZPOOL} create ${name0} ${disk0}
13expect_ok ${ZPOOL} replace ${name0} ${disk0} ${disk1}
14wait_for_resilver ${name0}
15exp=`(
16  echo "  pool: ${name0}"
17  echo " state: ONLINE"
18  echo " scrub: (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 "	  ${disk1}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
23  echo "errors: No known data errors"
24)`
25expect "${exp}" ${ZPOOL} status ${name0}
26expect_ok ${ZPOOL} destroy ${name0}
27expect_fl ${ZPOOL} status -x ${name0}
28
29expect_ok ${ZPOOL} create ${name0} ${disk0} ${disk1} ${disk2}
30expect_ok ${ZPOOL} replace ${name0} ${disk1} ${disk3}
31wait_for_resilver ${name0}
32exp=`(
33  echo "  pool: ${name0}"
34  echo " state: ONLINE"
35  echo " scrub: (scrub|resilver) completed after [0-9]+h[0-9]+m with 0 errors on .*"
36  echo "config:"
37  echo "	NAME        STATE   READ WRITE CKSUM"
38  echo "	${name0}    ONLINE     0     0     0"
39  echo "	  ${disk0}  ONLINE     0     0     0"
40  echo "	  ${disk3}  ONLINE     0     0     0(  [0-9.]+[A-Z] resilvered)?"
41  echo "	  ${disk2}  ONLINE     0     0     0"
42  echo "errors: No known data errors"
43)`
44expect "${exp}" ${ZPOOL} status ${name0}
45expect_ok ${ZPOOL} destroy ${name0}
46expect_fl ${ZPOOL} status -x ${name0}
47
48disks_destroy
49