xref: /freebsd/tools/regression/zfs/zpool/remove/cache.t (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1#!/bin/sh
2
3dir=`dirname $0`
4. ${dir}/../../misc.sh
5
6echo "1..9"
7
8disks_create 4
9names_create 1
10
11expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
12expect_ok ${ZPOOL} add ${name0} cache ${disk2} ${disk3}
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 "	cache"
22  echo "	  ${disk1}  ONLINE     0     0     0"
23  echo "	  ${disk2}  ONLINE     0     0     0"
24  echo "	  ${disk3}  ONLINE     0     0     0"
25  echo "errors: No known data errors"
26)`
27expect "${exp}" ${ZPOOL} status ${name0}
28expect_ok ${ZPOOL} remove ${name0} ${disk1} ${disk2}
29exp=`(
30  echo "  pool: ${name0}"
31  echo " state: ONLINE"
32  echo " scrub: none requested"
33  echo "config:"
34  echo "	NAME        STATE   READ WRITE CKSUM"
35  echo "	${name0}    ONLINE     0     0     0"
36  echo "	  ${disk0}  ONLINE     0     0     0"
37  echo "	cache"
38  echo "	  ${disk3}  ONLINE     0     0     0"
39  echo "errors: No known data errors"
40)`
41expect "${exp}" ${ZPOOL} status ${name0}
42expect_ok ${ZPOOL} remove ${name0} ${disk3}
43exp=`(
44  echo "  pool: ${name0}"
45  echo " state: ONLINE"
46  echo " scrub: none requested"
47  echo "config:"
48  echo "	NAME        STATE   READ WRITE CKSUM"
49  echo "	${name0}    ONLINE     0     0     0"
50  echo "	  ${disk0}  ONLINE     0     0     0"
51  echo "errors: No known data errors"
52)`
53expect "${exp}" ${ZPOOL} status ${name0}
54expect_ok ${ZPOOL} destroy ${name0}
55expect_fl ${ZPOOL} status -x ${name0}
56
57disks_destroy
58