3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright (c) 2018, Nexenta Systems, Inc. All rights reserved.
17 .
$STF_SUITE/include
/libtest.shlib
18 .
$STF_SUITE/tests
/functional
/cli_root
/zpool_split
/zpool_split.cfg
22 # 'zpool split' should fail if resilver in progress for a disk
26 # 1. Create a mirror pool
27 # 2. Offline the first VDEV
29 # 4. Online the first VDEV
30 # 5. Verify 'zpool split' must fail
32 # The second scenario:
33 # 1. Create a mirror pool
34 # 2. Offline the second VDEV
36 # 4. Online the second VDEV
37 # 5. Verify 'zpool split' must fail
40 verify_runnable
"both"
44 log_must zinject
-c all
45 destroy_pool
$TESTPOOL
46 destroy_pool
$TESTPOOL2
47 rm -f $DEVICE1 $DEVICE2
52 truncate
-s $DEVSIZE $DEVICE1
53 truncate
-s $DEVSIZE $DEVICE2
54 log_must zpool create
-f $TESTPOOL mirror
$DEVICE1 $DEVICE2
57 function zpool_split
#disk_to_be_offline/online
63 # offline a disk, so it will not be fully sync before split
64 log_must zpool offline
$TESTPOOL $disk
66 # Create 2G of additional data
67 mntpnt
=$
(get_prop mountpoint
$TESTPOOL)
68 log_must file_write
-b 2097152 -c 1024 -o create
-d 0 -f $mntpnt/biggerfile
71 # slow-down resilvering, so it will not finish too early
72 log_must set_tunable64 zfs_scan_vdev_limit
$ZFS_SCAN_VDEV_LIMIT_SLOW
73 log_must zinject
-d $DEVICE1 -D 50:1 $TESTPOOL
74 log_must zinject
-d $DEVICE2 -D 50:1 $TESTPOOL
76 log_must zpool online
$TESTPOOL $disk
79 while ! is_pool_resilvering
$TESTPOOL; do
81 log_fail
"resilvering is not started"
87 log_mustnot zpool
split $TESTPOOL $TESTPOOL2
89 log_must set_tunable64 zfs_scan_vdev_limit
$ZFS_SCAN_VDEV_LIMIT_DEFAULT
92 log_assert
"Verify 'zpool split' will fail if resilver in progress for a disk"
96 DEVICE1
="$TEST_BASE_DIR/device-1"
97 DEVICE2
="$TEST_BASE_DIR/device-2"
99 ZFS_SCAN_VDEV_LIMIT_SLOW
=$
((128*1024))
100 ZFS_SCAN_VDEV_LIMIT_DEFAULT
=$
(get_tunable zfs_scan_vdev_limit
)
102 log_note
"Verify ZFS prevents main pool curruption during 'split'"
107 log_note
"Verify ZFS prevents new pool curruption during 'split'"
110 log_pass
"'zpool split' failed as expected"