forked from openzfs/zfs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable splitting mirrors with indirect vdevs
When a top-level vdev is removed from a pool it is converted to an indirect vdev. Until now splitting such mirrored pools was not possible with zpool split. This patch enables handling of indirect vdevs and splitting of those pools with zpool split. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed by: Brian Behlendorf <[email protected]> Signed-off-by: George Amanakis <[email protected]> Closes openzfs#10283
- Loading branch information
Showing
6 changed files
with
89 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
tests/zfs-tests/tests/functional/cli_root/zpool_split/zpool_split_indirect.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2020, George Amanakis. All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/removal/removal.kshlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# 'zpool split' should succeed on pools with indirect vdevs. | ||
# | ||
# STRATEGY: | ||
# Create a mirrored pool, add a single device, remove it. `zpool split` | ||
# should succeed. | ||
# | ||
|
||
verify_runnable "global" | ||
|
||
log_assert "'zpool split' works on pools with indirect VDEVs." | ||
|
||
function cleanup | ||
{ | ||
if poolexists $TESTPOOL ; then | ||
destroy_pool $TESTPOOL | ||
fi | ||
if poolexists $TESTPOOL2 ; then | ||
destroy_pool $TESTPOOL2 | ||
fi | ||
rm -f $VDEV_* | ||
} | ||
log_onexit cleanup | ||
|
||
typeset vdev_m12_mb=400 | ||
typeset vdev_temp_mb=$(( floor($vdev_m12_mb / 2) )) | ||
typeset VDEV_TEMP="$TEST_BASE_DIR/vdev_temp" | ||
typeset VDEV_M1="$TEST_BASE_DIR/vdev_m1" | ||
typeset VDEV_M2="$TEST_BASE_DIR/vdev_m2" | ||
typeset altroot="$TESTDIR/altroot-$TESTPOOL2" | ||
|
||
log_must truncate -s ${vdev_temp_mb}M $VDEV_TEMP | ||
log_must truncate -s ${vdev_m12_mb}M $VDEV_M1 | ||
log_must truncate -s ${vdev_m12_mb}M $VDEV_M2 | ||
|
||
log_must zpool create -f $TESTPOOL $VDEV_TEMP | ||
log_must zpool add -f $TESTPOOL mirror $VDEV_M1 $VDEV_M2 | ||
log_must zpool remove $TESTPOOL $VDEV_TEMP | ||
log_must wait_for_removal $TESTPOOL | ||
log_must zpool split -R $altroot $TESTPOOL $TESTPOOL2 | ||
log_must poolexists $TESTPOOL2 | ||
log_must test "$(get_pool_prop 'altroot' $TESTPOOL2)" == "$altroot" | ||
|
||
log_pass "'zpool split' works on pools with indirect VDEVs." |