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