xref: /freebsd/tools/regression/zfs/zpool/create/spare.t (revision 2e3507c25e42292b45a5482e116d278f5515d04d)
1#!/bin/sh
2
3dir=`dirname $0`
4. ${dir}/../../misc.sh
5
6echo "1..28"
7
8disks_create 6
9names_create 1
10
11expect_ok ${ZPOOL} create ${name0} ${disk0} spare ${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 "	spares"
23  echo "	  ${disk1}  AVAIL"
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} mirror ${disk0} ${disk1} spare ${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 "	  mirror      ONLINE     0     0     0"
42  echo "	    ${disk0}  ONLINE     0     0     0"
43  echo "	    ${disk1}  ONLINE     0     0     0"
44  echo "	spares"
45  echo "	  ${disk2}    AVAIL"
46  echo "	  ${disk3}    AVAIL"
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} raidz ${disk0} ${disk1} ${disk2} spare ${disk3} ${disk4}
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 "	  raidz1      ONLINE     0     0     0"
65  echo "	    ${disk0}  ONLINE     0     0     0"
66  echo "	    ${disk1}  ONLINE     0     0     0"
67  echo "	    ${disk2}  ONLINE     0     0     0"
68  echo "	spares"
69  echo "	  ${disk3}    AVAIL"
70  echo "	  ${disk4}    AVAIL"
71  echo "errors: No known data errors"
72)`
73expect "${exp}" ${ZPOOL} status ${name0}
74expect_ok ${ZPOOL} destroy ${name0}
75expect_fl ${ZPOOL} status -x ${name0}
76expect_fl ${ZPOOL} destroy ${name0}
77
78expect_ok ${ZPOOL} create ${name0} raidz2 ${disk0} ${disk1} ${disk2} ${disk3} spare ${disk4} ${disk5}
79expect_ok ${ZPOOL} status -x ${name0}
80expect "pool '${name0}' is healthy" ${ZPOOL} status -x ${name0}
81exp=`(
82  echo "  pool: ${name0}"
83  echo " state: ONLINE"
84  echo " scrub: none requested"
85  echo "config:"
86  echo "	NAME          STATE   READ WRITE CKSUM"
87  echo "	${name0}      ONLINE     0     0     0"
88  echo "	  raidz2      ONLINE     0     0     0"
89  echo "	    ${disk0}  ONLINE     0     0     0"
90  echo "	    ${disk1}  ONLINE     0     0     0"
91  echo "	    ${disk2}  ONLINE     0     0     0"
92  echo "	    ${disk3}  ONLINE     0     0     0"
93  echo "	spares"
94  echo "	  ${disk4}    AVAIL"
95  echo "	  ${disk5}    AVAIL"
96  echo "errors: No known data errors"
97)`
98expect "${exp}" ${ZPOOL} status ${name0}
99expect_ok ${ZPOOL} destroy ${name0}
100expect_fl ${ZPOOL} status -x ${name0}
101expect_fl ${ZPOOL} destroy ${name0}
102
103disks_destroy
104