1 #! /usr/bin/ksh -p
2 #
3 #
4 # This file and its contents are supplied under the terms of the
5 # Common Development and Distribution License ("CDDL"), version 1.0.
6 # You may only use this file in accordance with the terms of version
7 # 1.0 of the CDDL.
8 #
9 # A full copy of the text of the CDDL should have accompanied this
10 # source. A copy of the CDDL is also available via the Internet at
11 # http://www.illumos.org/license/CDDL.
12 #
13
14 #
15 # Copyright 2016 Nexenta Systems, Inc. All rights reserved.
16 #
17
18 . $STF_SUITE/tests/functional/wbc/wbc.cfg
19 . $STF_SUITE/tests/functional/wbc/wbc.kshlib
20
21 #
22 # DESCRIPTION:
23 # Remove special vdev succeeds
24 #
25 # STRATEGY:
26 # 1. Create pool
27 # 2. Display pool status, check 'enablespecial' and 'feature@meta_devices'
28 # 3. Add special vdev
29 # 2. Display pool status, check 'enablespecial' and 'feature@meta_devices'
30 # 3. Remove special vdev
31 # 4. Display pool status, check 'enablespecial' and 'feature@meta_devices'
32 # 5. Scrub pool and check status
33 #
34
35 function check_props_without_special
36 {
37 RESULT=$(get_pool_prop "enablespecial" $TESTPOOL)
38 if [[ $RESULT != "off" ]]
39 then
40 log_fail "Property 'enablespecial' must be 'off'"
41 fi
42
43 RESULT=$(get_pool_prop "feature@meta_devices" $TESTPOOL)
44 if [[ $RESULT != "enabled" ]]
45 then
46 log_fail "Feature flag 'meta_devices' must be 'enabled'"
47 fi
48 }
49
50 function check_props_with_special
51 {
52 RESULT=$(get_pool_prop "enablespecial" $TESTPOOL)
53 if [[ $RESULT != "on" ]]
54 then
55 log_fail "Property 'enablespecial' must be 'on'"
56 fi
57
58 RESULT=$(get_pool_prop "feature@meta_devices" $TESTPOOL)
59 if [[ $RESULT != "active" ]]
60 then
61 log_fail "Feature flag 'meta_devices' must be 'active'"
62 fi
63 }
64
65 verify_runnable "global"
66 log_assert "Removing special vdev succeeds."
67 log_onexit cleanup
68 log_must create_pool $TESTPOOL
69 log_must display_status $TESTPOOL
70 log_must check_props_without_special
71 log_must zpool add -f $TESTPOOL special $SSD_DISK1
72 log_must display_status $TESTPOOL
73 log_must check_props_with_special
74 log_must zpool remove $TESTPOOL $SSD_DISK1
75 log_must display_status $TESTPOOL
76 log_must check_props_without_special
77 log_must zpool scrub $TESTPOOL
78 while is_pool_scrubbing $TESTPOOL ; do
79 sleep 1
80 done
81 log_must check_pool_errors $TESTPOOL
82 log_must destroy_pool $TESTPOOL
83 log_pass "Removing special vdev succeeds."