xref: /freebsd/tools/regression/zfs/zpool/add/cache.t (revision e9ac41698b2f322d55ccf9da50a3596edb2c1800)
1#!/bin/sh
2
3dir=`dirname $0`
4. ${dir}/../../misc.sh
5
6echo "1..33"
7
8disks_create 6
9names_create 1
10
11expect_ok ${ZPOOL} create ${name0} ${disk0}
12expect_fl ${ZPOOL} add ${name0} cache ${disk0}
13expect_ok ${ZPOOL} destroy ${name0}
14expect_fl ${ZPOOL} status -x ${name0}
15
16expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
17expect_fl ${ZPOOL} add ${name0} cache ${disk1}
18expect_ok ${ZPOOL} destroy ${name0}
19expect_fl ${ZPOOL} status -x ${name0}
20
21expect_ok ${ZPOOL} create ${name0} ${disk0}
22expect_ok ${ZPOOL} add ${name0} cache ${disk1}
23exp=`(
24  echo "  pool: ${name0}"
25  echo " state: ONLINE"
26  echo " scrub: none requested"
27  echo "config:"
28  echo "	NAME        STATE   READ WRITE CKSUM"
29  echo "	${name0}    ONLINE     0     0     0"
30  echo "	  ${disk0}  ONLINE     0     0     0"
31  echo "	cache"
32  echo "	  ${disk1}  ONLINE     0     0     0"
33  echo "errors: No known data errors"
34)`
35expect "${exp}" ${ZPOOL} status ${name0}
36expect_ok ${ZPOOL} destroy ${name0}
37expect_fl ${ZPOOL} status -x ${name0}
38
39expect_ok ${ZPOOL} create ${name0} ${disk0} cache ${disk1}
40expect_ok ${ZPOOL} add ${name0} cache ${disk2}
41exp=`(
42  echo "  pool: ${name0}"
43  echo " state: ONLINE"
44  echo " scrub: none requested"
45  echo "config:"
46  echo "	NAME        STATE   READ WRITE CKSUM"
47  echo "	${name0}    ONLINE     0     0     0"
48  echo "	  ${disk0}  ONLINE     0     0     0"
49  echo "	cache"
50  echo "	  ${disk1}  ONLINE     0     0     0"
51  echo "	  ${disk2}  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
58expect_ok ${ZPOOL} create ${name0} mirror ${disk0} ${disk1} cache ${disk2} ${disk3}
59expect_ok ${ZPOOL} add ${name0} cache ${disk4}
60exp=`(
61  echo "  pool: ${name0}"
62  echo " state: ONLINE"
63  echo " scrub: none requested"
64  echo "config:"
65  echo "	NAME          STATE   READ WRITE CKSUM"
66  echo "	${name0}      ONLINE     0     0     0"
67  echo "	  mirror      ONLINE     0     0     0"
68  echo "	    ${disk0}  ONLINE     0     0     0"
69  echo "	    ${disk1}  ONLINE     0     0     0"
70  echo "	cache"
71  echo "	  ${disk2}    ONLINE     0     0     0"
72  echo "	  ${disk3}    ONLINE     0     0     0"
73  echo "	  ${disk4}    ONLINE     0     0     0"
74  echo "errors: No known data errors"
75)`
76expect "${exp}" ${ZPOOL} status ${name0}
77expect_ok ${ZPOOL} destroy ${name0}
78expect_fl ${ZPOOL} status -x ${name0}
79
80expect_ok ${ZPOOL} create ${name0} raidz1 ${disk0} ${disk1} ${disk2} cache ${disk3}
81expect_ok ${ZPOOL} add ${name0} cache ${disk4}
82exp=`(
83  echo "  pool: ${name0}"
84  echo " state: ONLINE"
85  echo " scrub: none requested"
86  echo "config:"
87  echo "	NAME          STATE   READ WRITE CKSUM"
88  echo "	${name0}      ONLINE     0     0     0"
89  echo "	  raidz1      ONLINE     0     0     0"
90  echo "	    ${disk0}  ONLINE     0     0     0"
91  echo "	    ${disk1}  ONLINE     0     0     0"
92  echo "	    ${disk2}  ONLINE     0     0     0"
93  echo "	cache"
94  echo "	  ${disk3}    ONLINE     0     0     0"
95  echo "	  ${disk4}    ONLINE     0     0     0"
96  echo "errors: No known data errors"
97)`
98expect "${exp}" ${ZPOOL} status ${name0}
99expect_ok ${ZPOOL} destroy ${name0}
100expect_fl ${ZPOOL} status -x ${name0}
101
102expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} cache ${disk4}
103expect_ok ${ZPOOL} add ${name0} cache ${disk5}
104exp=`(
105  echo "  pool: ${name0}"
106  echo " state: ONLINE"
107  echo " scrub: none requested"
108  echo "config:"
109  echo "	NAME          STATE   READ WRITE CKSUM"
110  echo "	${name0}      ONLINE     0     0     0"
111  echo "	  raidz2      ONLINE     0     0     0"
112  echo "	    ${disk0}  ONLINE     0     0     0"
113  echo "	    ${disk1}  ONLINE     0     0     0"
114  echo "	    ${disk2}  ONLINE     0     0     0"
115  echo "	    ${disk3}  ONLINE     0     0     0"
116  echo "	cache"
117  echo "	  ${disk4}    ONLINE     0     0     0"
118  echo "	  ${disk5}    ONLINE     0     0     0"
119  echo "errors: No known data errors"
120)`
121expect "${exp}" ${ZPOOL} status ${name0}
122expect_ok ${ZPOOL} destroy ${name0}
123expect_fl ${ZPOOL} status -x ${name0}
124
125disks_destroy
126