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