-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zpool import -d to specify device path
When we know which devices have the pool we are looking for, sometime it's better if we can directly pass those device paths to zpool import instead of letting it to search through all unrelated stuff, which might take a lot of time if you have hundreds of disks. This patch allows option -d <dev_path> to zpool import. You can have multiple pairs of -d <dev_path>, and zpool import will only search through those devices. For example: zpool import -d /dev/sda -d /dev/sdb Reviewed-by: Tony Hutter <hutter2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Chunwei Chen <david.chen@nutanix.com> Closes #7077
- Loading branch information
1 parent
f55a875
commit 522db29
Showing
6 changed files
with
205 additions
and
48 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
54 changes: 54 additions & 0 deletions
54
tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_015_pos.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,54 @@ | ||
#!/bin/ksh -p | ||
# | ||
# 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. | ||
# | ||
|
||
# | ||
# Copyright (c) 2018 by Nutanix. All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/cli_root/zpool_import/zpool_import.cfg | ||
|
||
# | ||
# DESCRIPTION: | ||
# Make sure zpool import -d <device> works. | ||
# | ||
# STRATEGY: | ||
# 1. Create test pool A. | ||
# 2. Export pool A. | ||
# 3. Verify 'import -d <device>' works | ||
# | ||
|
||
verify_runnable "global" | ||
|
||
function cleanup | ||
{ | ||
destroy_pool $TESTPOOL1 | ||
|
||
log_must rm $VDEV0 $VDEV1 | ||
log_must truncate -s $FILE_SIZE $VDEV0 $VDEV1 | ||
} | ||
|
||
log_assert "Pool can be imported with '-d <device>'" | ||
log_onexit cleanup | ||
|
||
log_must zpool create $TESTPOOL1 $VDEV0 $VDEV1 | ||
log_must zpool export $TESTPOOL1 | ||
|
||
log_must zpool import -d $VDEV0 -d $VDEV1 $TESTPOOL1 | ||
log_must zpool export $TESTPOOL1 | ||
|
||
# mix -d <dir> and -d <device> | ||
log_must mkdir $DEVICE_DIR/test_dir | ||
log_must ln -s $VDEV0 $DEVICE_DIR/test_dir/disk | ||
log_must zpool import -d $DEVICE_DIR/test_dir -d $VDEV1 $TESTPOOL1 | ||
|
||
log_pass "Pool can be imported with '-d <device>'" |