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