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