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