xref: /freebsd/tools/regression/zfs/zpool/replace/spare.t (revision 02e9120893770924227138ba49df1edb3896112a)
1#!/bin/sh
2
3dir=`dirname $0`
4. ${dir}/../../misc.sh
5
6echo "1..6"
7
8disks_create 4
9names_create 1
10
11expect_ok ${ZPOOL} create ${name0} ${disk0} spare ${disk1}
12exp=`(
13  echo "  pool: ${name0}"
14  echo " state: ONLINE"
15  echo " scrub: none requested"
16  echo "config:"
17  echo "	NAME          STATE   READ WRITE CKSUM"
18  echo "	${name0}      ONLINE     0     0     0"
19  echo "	  ${disk0}    ONLINE     0     0     0"
20  echo "	spares"
21  echo "	    ${disk1}  AVAIL"
22  echo "errors: No known data errors"
23)`
24expect "${exp}" ${ZPOOL} status ${name0}
25expect_fl ${ZPOOL} replace ${name0} ${disk1} ${disk2}
26exp=`(
27  echo "  pool: ${name0}"
28  echo " state: ONLINE"
29  echo " scrub: none requested"
30  echo "config:"
31  echo "	NAME          STATE   READ WRITE CKSUM"
32  echo "	${name0}      ONLINE     0     0     0"
33  echo "	  ${disk0}    ONLINE     0     0     0"
34  echo "	spares"
35  echo "	    ${disk1}  AVAIL"
36  echo "errors: No known data errors"
37)`
38expect "${exp}" ${ZPOOL} status ${name0}
39expect_ok ${ZPOOL} destroy ${name0}
40expect_fl ${ZPOOL} status -x ${name0}
41
42disks_destroy
43