|
25 | 25 | #
|
26 | 26 | # DESCRIPTION:
|
27 | 27 | # Testing Fault Management Agent ZED Logic - Physically removed device is
|
28 |
| -# offlined and onlined when reattached |
| 28 | +# made unavail and onlined when reattached |
29 | 29 | #
|
30 | 30 | # STRATEGY:
|
31 | 31 | # 1. Create a pool
|
32 | 32 | # 2. Simulate physical removal of one device
|
33 |
| -# 3. Verify the device is offlined |
| 33 | +# 3. Verify the device is unvailable |
34 | 34 | # 4. Reattach the device
|
35 | 35 | # 5. Verify the device is onlined
|
36 |
| -# 6. Repeat the same tests with a spare device: zed will use the spare to handle |
37 |
| -# the removed data device |
38 |
| -# 7. Repeat the same tests again with a faulted spare device: zed should offline |
39 |
| -# the removed data device if no spare is available |
| 36 | +# 6. Repeat the same tests with a spare device: |
| 37 | +# zed will use the spare to handle the removed data device |
| 38 | +# 7. Repeat the same tests again with a faulted spare device: |
| 39 | +# the removed data device should be unavailable |
40 | 40 | #
|
41 | 41 | # NOTE: the use of 'block_device_wait' throughout the test helps avoid race
|
42 | 42 | # conditions caused by mixing creation/removal events from partitioning the
|
43 | 43 | # disk (zpool create) and events from physically removing it (remove_disk).
|
44 | 44 | #
|
| 45 | +# NOTE: the test relies on 'zpool sync' to prompt the kmods to transition a |
| 46 | +# vdev to the unavailable state. The ZED does receive a removal notification |
| 47 | +# but only relies on it to activate a hot spare. Additional work is planned |
| 48 | +# to extend an existing ioctl interface to allow the ZED to transition the |
| 49 | +# vdev in to a removed state. |
| 50 | +# |
45 | 51 | verify_runnable "both"
|
46 | 52 |
|
47 | 53 | if is_linux; then
|
@@ -76,7 +82,6 @@ removedev=$(get_debug_device)
|
76 | 82 | typeset poolconfs=(
|
77 | 83 | "mirror $filedev1 $removedev"
|
78 | 84 | "raidz3 $filedev1 $filedev2 $filedev3 $removedev"
|
79 |
| - "$filedev1 cache $removedev" |
80 | 85 | "mirror $filedev1 $filedev2 special mirror $filedev3 $removedev"
|
81 | 86 | )
|
82 | 87 |
|
|
91 | 96 | log_must zpool create -f $TESTPOOL $conf
|
92 | 97 | block_device_wait ${DEV_DSKDIR}/${removedev}
|
93 | 98 |
|
| 99 | + mntpnt=$(get_prop mountpoint /$TESTPOOL) || |
| 100 | + log_fail "get_prop mountpoint /$TESTPOOL" |
| 101 | + |
94 | 102 | # 2. Simulate physical removal of one device
|
95 | 103 | remove_disk $removedev
|
| 104 | + log_must mkfile 1m $mntpnt/file |
| 105 | + log_must zpool sync $TESTPOOL |
96 | 106 |
|
97 |
| - # 3. Verify the device is offlined |
98 |
| - log_must wait_vdev_state $TESTPOOL $removedev "OFFLINE" |
| 107 | + # 3. Verify the device is unvailable. |
| 108 | + log_must wait_vdev_state $TESTPOOL $removedev "UNAVAIL" |
99 | 109 |
|
100 | 110 | # 4. Reattach the device
|
101 | 111 | insert_disk $removedev
|
|
118 | 128 | block_device_wait ${DEV_DSKDIR}/${removedev}
|
119 | 129 | log_must zpool add $TESTPOOL spare $sparedev
|
120 | 130 |
|
121 |
| - # 3. Simulate physical removal of one device |
| 131 | + mntpnt=$(get_prop mountpoint /$TESTPOOL) || |
| 132 | + log_fail "get_prop mountpoint /$TESTPOOL" |
| 133 | + |
| 134 | + # 2. Simulate physical removal of one device |
122 | 135 | remove_disk $removedev
|
| 136 | + log_must mkfile 1m $mntpnt/file |
| 137 | + log_must zpool sync $TESTPOOL |
123 | 138 |
|
124 |
| - # 4. Verify the device is handled by the spare unless is a l2arc disk |
125 |
| - # which can only be offlined |
126 |
| - if [[ $(echo "$conf" | grep -c 'cache') -eq 0 ]]; then |
127 |
| - log_must wait_hotspare_state $TESTPOOL $sparedev "INUSE" |
128 |
| - else |
129 |
| - log_must wait_vdev_state $TESTPOOL $removedev "OFFLINE" |
130 |
| - fi |
| 139 | + # 3. Verify the device is handled by the spare. |
| 140 | + log_must wait_hotspare_state $TESTPOOL $sparedev "INUSE" |
| 141 | + log_must wait_vdev_state $TESTPOOL $removedev "UNAVAIL" |
131 | 142 |
|
132 |
| - # 5. Reattach the device |
| 143 | + # 4. Reattach the device |
133 | 144 | insert_disk $removedev
|
134 | 145 |
|
135 |
| - # 6. Verify the device is onlined |
| 146 | + # 5. Verify the device is onlined |
136 | 147 | log_must wait_vdev_state $TESTPOOL $removedev "ONLINE"
|
137 | 148 |
|
138 | 149 | # cleanup
|
|
150 | 161 | block_device_wait ${DEV_DSKDIR}/${removedev}
|
151 | 162 | log_must zpool add $TESTPOOL spare $sparedev
|
152 | 163 |
|
| 164 | + mntpnt=$(get_prop mountpoint /$TESTPOOL) || |
| 165 | + log_fail "get_prop mountpoint /$TESTPOOL" |
| 166 | + |
153 | 167 | # 2. Fault the spare device making it unavailable
|
154 | 168 | log_must zpool offline -f $TESTPOOL $sparedev
|
155 | 169 | log_must wait_hotspare_state $TESTPOOL $sparedev "FAULTED"
|
156 | 170 |
|
157 | 171 | # 3. Simulate physical removal of one device
|
158 | 172 | remove_disk $removedev
|
| 173 | + log_must mkfile 1m $mntpnt/file |
| 174 | + log_must zpool sync $TESTPOOL |
159 | 175 |
|
160 |
| - # 4. Verify the device is offlined |
161 |
| - log_must wait_vdev_state $TESTPOOL $removedev "OFFLINE" |
| 176 | + # 4. Verify the device is unavailable |
| 177 | + log_must wait_vdev_state $TESTPOOL $removedev "UNAVAIL" |
162 | 178 |
|
163 | 179 | # 5. Reattach the device
|
164 | 180 | insert_disk $removedev
|
|
0 commit comments