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