From e9a8683eacd71a7f11f157b39c616e6f1169d685 Mon Sep 17 00:00:00 2001 From: Ned Bass Date: Tue, 27 Nov 2012 11:06:43 -0800 Subject: [PATCH] LU-2337 scripts: init script to not use -d with zpool import The zpool import command shipped with ZFS on Linux now searches the following directories for devices (in order), eliminating the need for the zpool import -d option in the lustre init script. /dev/disk/by-vdev - Custom rules, use first if they exist /dev/disk/zpool - Custom rules, use first if they exist /dev/mapper - Use multipath devices before components /dev/disk/by-uuid - Single unique entry and persistent /dev/disk/by-id - May be multiple entries and persistent /dev/disk/by-path - Encodes physical location and persistent /dev/disk/by-label - Custom persistent labels /dev - UNSAFE device names will change The command formerly only searched /dev by default, so the init script used the -d option to give precedence to preferred locations such as /dev/mapper. However this approach is error-prone on systems where /dev/mapper exists but doesn't contain the zpool member devices. With this change the default script behavior should work on systems using any of the above directories. Also print an error message if zpool import fails, and remove an unused variable from an unrelated function. Signed-off-by: Ned Bass Change-Id: I257da17328bec84aa568a61a40cdb374535aa935 Reviewed-on: http://review.whamcloud.com/4686 Tested-by: Hudson Reviewed-by: Prakash Surya Tested-by: Maloo Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin --- lustre/scripts/lustre | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/lustre/scripts/lustre b/lustre/scripts/lustre index 55c6601..b97951f 100644 --- a/lustre/scripts/lustre +++ b/lustre/scripts/lustre @@ -75,7 +75,6 @@ start_zfs_services () stop_devices () { local labels=$* - local result=0 local label devtype for label in $labels; do devtype=`$LDEV -t $label` @@ -102,10 +101,6 @@ import_zpool () args="$args -c $cache" elif [ -n "$ZPOOL_IMPORT_DIR" ] ; then args="$args -d $ZPOOL_IMPORT_DIR" - elif [ -d "/dev/disk/by-vdev" ] ; then - args="$args -d /dev/disk/by-vdev" - elif [ -d "/dev/mapper" ] ; then - args="$args -d /dev/mapper" fi if zpool status $pool >/dev/null 2>&1 ; then @@ -114,6 +109,9 @@ import_zpool () zpool import $pool $args 2>/dev/null result=$? fi + if [ $result -ne 0 ] ; then + echo "Unexpected return code from import of pool $pool: $result" + fi return $result } -- 1.8.3.1