Multipath device manageability improvements
Update udev helper scripts to deal with device-mapper devices created by multipathd. These enhancements are targeted at a particular storage network topology under evaluation at LLNL consisting of two SAS switches providing redundant connectivity between multiple server nodes and disk enclosures. The key to making these systems manageable is to create shortnames for each disk that conveys its physical location in a drawer. In a direct-attached topology we infer a disk's enclosure from the PCI bus number and HBA port number in the by-path name provided by udev. In a switched topology, however, multiple drawers are accessed via a single HBA port. We therefore resort to assigning drawer identifiers based on which switch port a drive's enclosure is connected to. This information is available from sysfs. Add options to zpool_layout to generate an /etc/zfs/zdev.conf using symbolic links in /dev/disk/by-id of the form <label>-<UUID>-switch-port:<X>-slot:<Y>. <label> is a string that depends on the subsystem that created the link and defaults to "dm-uuid-mpath" (this prefix is used by multipathd). <UUID> is a unique identifier for the disk typically obtained from the scsi_id program, and <X> and <Y> denote the switch port and disk slot numbers, respectively. Add a callout script sas_switch_id for use by multipathd to help create symlinks of the form described above. Update zpool_id and the udev zpool rules file to handle both multipath devices and conventional drives.
This commit is contained in:
parent
7e7baecaa3
commit
560bcf9d14
|
@ -1,2 +1,2 @@
|
|||
SUBDIRS = zfs zpool zdb zinject ztest zpios mount_zfs
|
||||
SUBDIRS += zpool_layout zvol_id zpool_id
|
||||
SUBDIRS += zpool_layout zvol_id zpool_id sas_switch_id
|
||||
|
|
|
@ -299,7 +299,7 @@ top_build_prefix = @top_build_prefix@
|
|||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
SUBDIRS = zfs zpool zdb zinject ztest zpios mount_zfs zpool_layout \
|
||||
zvol_id zpool_id
|
||||
zvol_id zpool_id sas_switch_id
|
||||
all: all-recursive
|
||||
|
||||
.SUFFIXES:
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
dist_bin_SCRIPTS = sas_switch_id
|
|
@ -0,0 +1,512 @@
|
|||
# Makefile.in generated by automake 1.11.1 from Makefile.am.
|
||||
# @configure_input@
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
|
||||
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
|
||||
# Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
# PARTICULAR PURPOSE.
|
||||
|
||||
@SET_MAKE@
|
||||
|
||||
VPATH = @srcdir@
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
||||
install_sh_DATA = $(install_sh) -c -m 644
|
||||
install_sh_PROGRAM = $(install_sh) -c
|
||||
install_sh_SCRIPT = $(install_sh) -c
|
||||
INSTALL_HEADER = $(INSTALL_DATA)
|
||||
transform = $(program_transform_name)
|
||||
NORMAL_INSTALL = :
|
||||
PRE_INSTALL = :
|
||||
POST_INSTALL = :
|
||||
NORMAL_UNINSTALL = :
|
||||
PRE_UNINSTALL = :
|
||||
POST_UNINSTALL = :
|
||||
build_triplet = @build@
|
||||
host_triplet = @host@
|
||||
target_triplet = @target@
|
||||
subdir = cmd/sas_switch_id
|
||||
DIST_COMMON = $(dist_bin_SCRIPTS) $(srcdir)/Makefile.am \
|
||||
$(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = \
|
||||
$(top_srcdir)/config/always-no-unused-but-set-variable.m4 \
|
||||
$(top_srcdir)/config/kernel-bdev-block-device-operations.m4 \
|
||||
$(top_srcdir)/config/kernel-bdev-logical-size.m4 \
|
||||
$(top_srcdir)/config/kernel-bio-empty-barrier.m4 \
|
||||
$(top_srcdir)/config/kernel-bio-end-io-t-args.m4 \
|
||||
$(top_srcdir)/config/kernel-bio-failfast.m4 \
|
||||
$(top_srcdir)/config/kernel-bio-rw-syncio.m4 \
|
||||
$(top_srcdir)/config/kernel-blk-end-request.m4 \
|
||||
$(top_srcdir)/config/kernel-blk-fetch-request.m4 \
|
||||
$(top_srcdir)/config/kernel-blk-requeue-request.m4 \
|
||||
$(top_srcdir)/config/kernel-blk-rq-bytes.m4 \
|
||||
$(top_srcdir)/config/kernel-blk-rq-pos.m4 \
|
||||
$(top_srcdir)/config/kernel-blk-rq-sectors.m4 \
|
||||
$(top_srcdir)/config/kernel-blkdev-get-by-path.m4 \
|
||||
$(top_srcdir)/config/kernel-check-disk-size-change.m4 \
|
||||
$(top_srcdir)/config/kernel-d-obtain-alias.m4 \
|
||||
$(top_srcdir)/config/kernel-evict-inode.m4 \
|
||||
$(top_srcdir)/config/kernel-fmode-t.m4 \
|
||||
$(top_srcdir)/config/kernel-fsync.m4 \
|
||||
$(top_srcdir)/config/kernel-get-disk-ro.m4 \
|
||||
$(top_srcdir)/config/kernel-insert-inode-locked.m4 \
|
||||
$(top_srcdir)/config/kernel-invalidate-bdev-args.m4 \
|
||||
$(top_srcdir)/config/kernel-kobj-name-len.m4 \
|
||||
$(top_srcdir)/config/kernel-open-bdev-exclusive.m4 \
|
||||
$(top_srcdir)/config/kernel-rq-for-each_segment.m4 \
|
||||
$(top_srcdir)/config/kernel-rq-is_sync.m4 \
|
||||
$(top_srcdir)/config/kernel-xattr-handler.m4 \
|
||||
$(top_srcdir)/config/kernel.m4 \
|
||||
$(top_srcdir)/config/user-arch.m4 \
|
||||
$(top_srcdir)/config/user-frame-larger-than.m4 \
|
||||
$(top_srcdir)/config/user-ioctl.m4 \
|
||||
$(top_srcdir)/config/user-libblkid.m4 \
|
||||
$(top_srcdir)/config/user-libuuid.m4 \
|
||||
$(top_srcdir)/config/user-nptl_guard_within_stack.m4 \
|
||||
$(top_srcdir)/config/user-selinux.m4 \
|
||||
$(top_srcdir)/config/user-zlib.m4 $(top_srcdir)/config/user.m4 \
|
||||
$(top_srcdir)/config/zfs-build.m4 \
|
||||
$(top_srcdir)/config/zfs-meta.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
CONFIG_HEADER = $(top_builddir)/zfs_config.h
|
||||
CONFIG_CLEAN_FILES =
|
||||
CONFIG_CLEAN_VPATH_FILES =
|
||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
||||
am__vpath_adj = case $$p in \
|
||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
||||
*) f=$$p;; \
|
||||
esac;
|
||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
||||
am__install_max = 40
|
||||
am__nobase_strip_setup = \
|
||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
||||
am__nobase_strip = \
|
||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
||||
am__nobase_list = $(am__nobase_strip_setup); \
|
||||
for p in $$list; do echo "$$p $$p"; done | \
|
||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
||||
if (++n[$$2] == $(am__install_max)) \
|
||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
||||
END { for (dir in files) print dir, files[dir] }'
|
||||
am__base_list = \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
||||
am__installdirs = "$(DESTDIR)$(bindir)"
|
||||
SCRIPTS = $(dist_bin_SCRIPTS)
|
||||
AM_V_GEN = $(am__v_GEN_$(V))
|
||||
am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_GEN_0 = @echo " GEN " $@;
|
||||
AM_V_at = $(am__v_at_$(V))
|
||||
am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY))
|
||||
am__v_at_0 = @
|
||||
SOURCES =
|
||||
DIST_SOURCES =
|
||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
||||
ACLOCAL = @ACLOCAL@
|
||||
ALIEN = @ALIEN@
|
||||
ALIEN_VERSION = @ALIEN_VERSION@
|
||||
AMTAR = @AMTAR@
|
||||
AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@
|
||||
AR = @AR@
|
||||
AUTOCONF = @AUTOCONF@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
AUTOMAKE = @AUTOMAKE@
|
||||
AWK = @AWK@
|
||||
CC = @CC@
|
||||
CCAS = @CCAS@
|
||||
CCASDEPMODE = @CCASDEPMODE@
|
||||
CCASFLAGS = @CCASFLAGS@
|
||||
CCDEPMODE = @CCDEPMODE@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPP = @CPP@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
CYGPATH_W = @CYGPATH_W@
|
||||
DEBUG_CFLAGS = @DEBUG_CFLAGS@
|
||||
DEBUG_STACKFLAGS = @DEBUG_STACKFLAGS@
|
||||
DEFAULT_INIT_SCRIPT = @DEFAULT_INIT_SCRIPT@
|
||||
DEFAULT_PACKAGE = @DEFAULT_PACKAGE@
|
||||
DEFS = @DEFS@
|
||||
DEPDIR = @DEPDIR@
|
||||
DPKG = @DPKG@
|
||||
DPKGBUILD = @DPKGBUILD@
|
||||
DPKGBUILD_VERSION = @DPKGBUILD_VERSION@
|
||||
DPKG_VERSION = @DPKG_VERSION@
|
||||
DSYMUTIL = @DSYMUTIL@
|
||||
DUMPBIN = @DUMPBIN@
|
||||
ECHO_C = @ECHO_C@
|
||||
ECHO_N = @ECHO_N@
|
||||
ECHO_T = @ECHO_T@
|
||||
EGREP = @EGREP@
|
||||
EXEEXT = @EXEEXT@
|
||||
FGREP = @FGREP@
|
||||
FRAME_LARGER_THAN = @FRAME_LARGER_THAN@
|
||||
GREP = @GREP@
|
||||
HAVE_ALIEN = @HAVE_ALIEN@
|
||||
HAVE_DPKG = @HAVE_DPKG@
|
||||
HAVE_DPKGBUILD = @HAVE_DPKGBUILD@
|
||||
HAVE_RPM = @HAVE_RPM@
|
||||
HAVE_RPMBUILD = @HAVE_RPMBUILD@
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
||||
KERNELCPPFLAGS = @KERNELCPPFLAGS@
|
||||
KERNELMAKE_PARAMS = @KERNELMAKE_PARAMS@
|
||||
LD = @LD@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBBLKID = @LIBBLKID@
|
||||
LIBOBJS = @LIBOBJS@
|
||||
LIBS = @LIBS@
|
||||
LIBSELINUX = @LIBSELINUX@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LIBUUID = @LIBUUID@
|
||||
LINUX = @LINUX@
|
||||
LINUX_OBJ = @LINUX_OBJ@
|
||||
LINUX_SYMBOLS = @LINUX_SYMBOLS@
|
||||
LINUX_VERSION = @LINUX_VERSION@
|
||||
LIPO = @LIPO@
|
||||
LN_S = @LN_S@
|
||||
LTLIBOBJS = @LTLIBOBJS@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
MKDIR_P = @MKDIR_P@
|
||||
NM = @NM@
|
||||
NMEDIT = @NMEDIT@
|
||||
NO_UNUSED_BUT_SET_VARIABLE = @NO_UNUSED_BUT_SET_VARIABLE@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
OBJEXT = @OBJEXT@
|
||||
OTOOL = @OTOOL@
|
||||
OTOOL64 = @OTOOL64@
|
||||
PACKAGE = @PACKAGE@
|
||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
||||
PACKAGE_NAME = @PACKAGE_NAME@
|
||||
PACKAGE_STRING = @PACKAGE_STRING@
|
||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
||||
RANLIB = @RANLIB@
|
||||
RPM = @RPM@
|
||||
RPMBUILD = @RPMBUILD@
|
||||
RPMBUILD_VERSION = @RPMBUILD_VERSION@
|
||||
RPM_VERSION = @RPM_VERSION@
|
||||
SED = @SED@
|
||||
SET_MAKE = @SET_MAKE@
|
||||
SHELL = @SHELL@
|
||||
SPL = @SPL@
|
||||
SPL_OBJ = @SPL_OBJ@
|
||||
SPL_SYMBOLS = @SPL_SYMBOLS@
|
||||
SPL_VERSION = @SPL_VERSION@
|
||||
STRIP = @STRIP@
|
||||
TARGET_ASM_DIR = @TARGET_ASM_DIR@
|
||||
VENDOR = @VENDOR@
|
||||
VERSION = @VERSION@
|
||||
ZFS_CONFIG = @ZFS_CONFIG@
|
||||
ZFS_META_ALIAS = @ZFS_META_ALIAS@
|
||||
ZFS_META_AUTHOR = @ZFS_META_AUTHOR@
|
||||
ZFS_META_DATA = @ZFS_META_DATA@
|
||||
ZFS_META_LICENSE = @ZFS_META_LICENSE@
|
||||
ZFS_META_LT_AGE = @ZFS_META_LT_AGE@
|
||||
ZFS_META_LT_CURRENT = @ZFS_META_LT_CURRENT@
|
||||
ZFS_META_LT_REVISION = @ZFS_META_LT_REVISION@
|
||||
ZFS_META_NAME = @ZFS_META_NAME@
|
||||
ZFS_META_RELEASE = @ZFS_META_RELEASE@
|
||||
ZFS_META_VERSION = @ZFS_META_VERSION@
|
||||
ZLIB = @ZLIB@
|
||||
abs_builddir = @abs_builddir@
|
||||
abs_srcdir = @abs_srcdir@
|
||||
abs_top_builddir = @abs_top_builddir@
|
||||
abs_top_srcdir = @abs_top_srcdir@
|
||||
ac_ct_CC = @ac_ct_CC@
|
||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
||||
am__include = @am__include@
|
||||
am__leading_dot = @am__leading_dot@
|
||||
am__quote = @am__quote@
|
||||
am__tar = @am__tar@
|
||||
am__untar = @am__untar@
|
||||
bindir = @bindir@
|
||||
build = @build@
|
||||
build_alias = @build_alias@
|
||||
build_cpu = @build_cpu@
|
||||
build_os = @build_os@
|
||||
build_vendor = @build_vendor@
|
||||
builddir = @builddir@
|
||||
datadir = @datadir@
|
||||
datarootdir = @datarootdir@
|
||||
docdir = @docdir@
|
||||
dvidir = @dvidir@
|
||||
exec_prefix = @exec_prefix@
|
||||
host = @host@
|
||||
host_alias = @host_alias@
|
||||
host_cpu = @host_cpu@
|
||||
host_os = @host_os@
|
||||
host_vendor = @host_vendor@
|
||||
htmldir = @htmldir@
|
||||
includedir = @includedir@
|
||||
infodir = @infodir@
|
||||
install_sh = @install_sh@
|
||||
libdir = @libdir@
|
||||
libexecdir = @libexecdir@
|
||||
localedir = @localedir@
|
||||
localstatedir = @localstatedir@
|
||||
lt_ECHO = @lt_ECHO@
|
||||
mandir = @mandir@
|
||||
mkdir_p = @mkdir_p@
|
||||
oldincludedir = @oldincludedir@
|
||||
pdfdir = @pdfdir@
|
||||
prefix = @prefix@
|
||||
program_transform_name = @program_transform_name@
|
||||
psdir = @psdir@
|
||||
sbindir = @sbindir@
|
||||
sharedstatedir = @sharedstatedir@
|
||||
srcdir = @srcdir@
|
||||
sysconfdir = @sysconfdir@
|
||||
target = @target@
|
||||
target_alias = @target_alias@
|
||||
target_cpu = @target_cpu@
|
||||
target_os = @target_os@
|
||||
target_vendor = @target_vendor@
|
||||
top_build_prefix = @top_build_prefix@
|
||||
top_builddir = @top_builddir@
|
||||
top_srcdir = @top_srcdir@
|
||||
dist_bin_SCRIPTS = sas_switch_id
|
||||
all: all-am
|
||||
|
||||
.SUFFIXES:
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
|
||||
@for dep in $?; do \
|
||||
case '$(am__configure_deps)' in \
|
||||
*$$dep*) \
|
||||
( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
|
||||
&& { if test -f $@; then exit 0; else break; fi; }; \
|
||||
exit 1;; \
|
||||
esac; \
|
||||
done; \
|
||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu cmd/sas_switch_id/Makefile'; \
|
||||
$(am__cd) $(top_srcdir) && \
|
||||
$(AUTOMAKE) --gnu cmd/sas_switch_id/Makefile
|
||||
.PRECIOUS: Makefile
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
@case '$?' in \
|
||||
*config.status*) \
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
|
||||
*) \
|
||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
|
||||
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
|
||||
esac;
|
||||
|
||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
|
||||
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
|
||||
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
|
||||
$(am__aclocal_m4_deps):
|
||||
install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
|
||||
@$(NORMAL_INSTALL)
|
||||
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
|
||||
@list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
|
||||
for p in $$list; do \
|
||||
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
|
||||
if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
|
||||
done | \
|
||||
sed -e 'p;s,.*/,,;n' \
|
||||
-e 'h;s|.*|.|' \
|
||||
-e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
|
||||
$(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
|
||||
{ d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
|
||||
if ($$2 == $$4) { files[d] = files[d] " " $$1; \
|
||||
if (++n[d] == $(am__install_max)) { \
|
||||
print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
|
||||
else { print "f", d "/" $$4, $$1 } } \
|
||||
END { for (d in files) print "f", d, files[d] }' | \
|
||||
while read type dir files; do \
|
||||
if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
|
||||
test -z "$$files" || { \
|
||||
echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
|
||||
$(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
|
||||
} \
|
||||
; done
|
||||
|
||||
uninstall-dist_binSCRIPTS:
|
||||
@$(NORMAL_UNINSTALL)
|
||||
@list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
|
||||
files=`for p in $$list; do echo "$$p"; done | \
|
||||
sed -e 's,.*/,,;$(transform)'`; \
|
||||
test -n "$$list" || exit 0; \
|
||||
echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
|
||||
cd "$(DESTDIR)$(bindir)" && rm -f $$files
|
||||
|
||||
mostlyclean-libtool:
|
||||
-rm -f *.lo
|
||||
|
||||
clean-libtool:
|
||||
-rm -rf .libs _libs
|
||||
tags: TAGS
|
||||
TAGS:
|
||||
|
||||
ctags: CTAGS
|
||||
CTAGS:
|
||||
|
||||
|
||||
distdir: $(DISTFILES)
|
||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
||||
list='$(DISTFILES)'; \
|
||||
dist_files=`for file in $$list; do echo $$file; done | \
|
||||
sed -e "s|^$$srcdirstrip/||;t" \
|
||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
||||
case $$dist_files in \
|
||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
||||
sort -u` ;; \
|
||||
esac; \
|
||||
for file in $$dist_files; do \
|
||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
||||
if test -d $$d/$$file; then \
|
||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
||||
if test -d "$(distdir)/$$file"; then \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
||||
fi; \
|
||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
||||
else \
|
||||
test -f "$(distdir)/$$file" \
|
||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
||||
|| exit 1; \
|
||||
fi; \
|
||||
done
|
||||
check-am: all-am
|
||||
check: check-am
|
||||
all-am: Makefile $(SCRIPTS)
|
||||
installdirs:
|
||||
for dir in "$(DESTDIR)$(bindir)"; do \
|
||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
||||
done
|
||||
install: install-am
|
||||
install-exec: install-exec-am
|
||||
install-data: install-data-am
|
||||
uninstall: uninstall-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
|
||||
installcheck: installcheck-am
|
||||
install-strip:
|
||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
||||
`test -z '$(STRIP)' || \
|
||||
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
|
||||
mostlyclean-generic:
|
||||
|
||||
clean-generic:
|
||||
|
||||
distclean-generic:
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
@echo "This command is intended for maintainers to use"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
clean: clean-am
|
||||
|
||||
clean-am: clean-generic clean-libtool mostlyclean-am
|
||||
|
||||
distclean: distclean-am
|
||||
-rm -f Makefile
|
||||
distclean-am: clean-am distclean-generic
|
||||
|
||||
dvi: dvi-am
|
||||
|
||||
dvi-am:
|
||||
|
||||
html: html-am
|
||||
|
||||
html-am:
|
||||
|
||||
info: info-am
|
||||
|
||||
info-am:
|
||||
|
||||
install-data-am:
|
||||
|
||||
install-dvi: install-dvi-am
|
||||
|
||||
install-dvi-am:
|
||||
|
||||
install-exec-am: install-dist_binSCRIPTS
|
||||
|
||||
install-html: install-html-am
|
||||
|
||||
install-html-am:
|
||||
|
||||
install-info: install-info-am
|
||||
|
||||
install-info-am:
|
||||
|
||||
install-man:
|
||||
|
||||
install-pdf: install-pdf-am
|
||||
|
||||
install-pdf-am:
|
||||
|
||||
install-ps: install-ps-am
|
||||
|
||||
install-ps-am:
|
||||
|
||||
installcheck-am:
|
||||
|
||||
maintainer-clean: maintainer-clean-am
|
||||
-rm -f Makefile
|
||||
maintainer-clean-am: distclean-am maintainer-clean-generic
|
||||
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
mostlyclean-am: mostlyclean-generic mostlyclean-libtool
|
||||
|
||||
pdf: pdf-am
|
||||
|
||||
pdf-am:
|
||||
|
||||
ps: ps-am
|
||||
|
||||
ps-am:
|
||||
|
||||
uninstall-am: uninstall-dist_binSCRIPTS
|
||||
|
||||
.MAKE: install-am install-strip
|
||||
|
||||
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
|
||||
distclean distclean-generic distclean-libtool distdir dvi \
|
||||
dvi-am html html-am info info-am install install-am \
|
||||
install-data install-data-am install-dist_binSCRIPTS \
|
||||
install-dvi install-dvi-am install-exec install-exec-am \
|
||||
install-html install-html-am install-info install-info-am \
|
||||
install-man install-pdf install-pdf-am install-ps \
|
||||
install-ps-am install-strip installcheck installcheck-am \
|
||||
installdirs maintainer-clean maintainer-clean-generic \
|
||||
mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \
|
||||
ps ps-am uninstall uninstall-am uninstall-dist_binSCRIPTS
|
||||
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
.NOEXPORT:
|
|
@ -0,0 +1,96 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# sas_switch_id
|
||||
#
|
||||
# Callout script for multipathd to obtain disk UUIDs. Combine the UUID
|
||||
# from the scsi_id program with the SAS switch port number and enclosure
|
||||
# bay number, if available. This naming convention enables easier
|
||||
# identification of the physical drive location when multiple disk
|
||||
# enclosures are accessed via a SAS switch. For other storage
|
||||
# topologies just return the undecorated UUID of the drive.
|
||||
|
||||
PHYS_PER_PORT=4
|
||||
DEV=
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: sas_switch_id [-d disk] [-p phys_per_port]
|
||||
-d Basename of the disk device [default=none]
|
||||
-p Number of PHYs per switch port [default=${PHYS_PER_PORT}]
|
||||
-h Show this message
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
while getopts 'd:p:h' OPTION; do
|
||||
case ${OPTION} in
|
||||
d)
|
||||
DEV=${OPTARG}
|
||||
;;
|
||||
p)
|
||||
PHYS_PER_PORT=${OPTARG}
|
||||
;;
|
||||
h)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z "$DEV" ] ; then
|
||||
echo "Error: missing required option -d"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
UUID=`/lib/udev/scsi_id --whitelisted --device=/dev/$DEV`
|
||||
if [ $? != 0 -o -z "$UUID" ] ; then
|
||||
exit 1
|
||||
fi
|
||||
sys_path=`udevadm info -q path -p /sys/block/$DEV`
|
||||
dirs=(`echo "$sys_path" | tr / ' '`)
|
||||
switch_port_dir="/sys"
|
||||
|
||||
# Get path up to /sys/.../hostX
|
||||
for (( i=0; i<${#dirs[*]}; i++ )); do
|
||||
d=${dirs[$i]}
|
||||
switch_port_dir=$switch_port_dir/$d
|
||||
echo $d | egrep -q -e '^host[0-9]+$' && break
|
||||
done
|
||||
|
||||
if [ $i = ${#dirs[*]} ] ; then
|
||||
echo $UUID
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# The directory three levels beneath /sys/.../hostX contains
|
||||
# symlinks to phy devices that reveal the switch port number.
|
||||
# Lowest phy number is $PHYS_PER_PORT*switch_port_number.
|
||||
for (( j=(($i+1)) ; j<(($i+4)); j++ )); do
|
||||
switch_port_dir=$switch_port_dir/${dirs[$j]}
|
||||
done
|
||||
pushd $switch_port_dir > /dev/null
|
||||
PHY=`ls -d phy* 2>/dev/null | head -1 | awk -F: '{print $NF}'`
|
||||
PORT=$(( $PHY / $PHYS_PER_PORT ))
|
||||
popd > /dev/null
|
||||
if [ -z "$PHY" ] ; then
|
||||
echo $UUID
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Look in /sys/.../sas_device/end_device-X for the bay_identifier
|
||||
# attribute.
|
||||
end_device_dir=$switch_port_dir
|
||||
for (( k=$j ; k<${#dirs[*]} ; k++ )); do
|
||||
d=${dirs[$k]}
|
||||
end_device_dir=$end_device_dir/$d
|
||||
if echo $d | egrep -q -e '^end_device' ; then
|
||||
end_device_dir=$end_device_dir/sas_device/$d
|
||||
break
|
||||
fi
|
||||
done
|
||||
SLOT=`cat $end_device_dir/bay_identifier 2>/dev/null`
|
||||
if [ -z "$SLOT" ] ; then
|
||||
echo $UUID
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "$UUID-switch-port:$PORT-slot:$SLOT"
|
|
@ -39,9 +39,17 @@ done
|
|||
# Check for the existence of a configuration file
|
||||
[ ! -f ${CONFIG} ] && die "Missing config file: ${CONFIG}"
|
||||
|
||||
# Use udev's path_id to generate a unique persistent key
|
||||
eval `${PATH_ID} ${DEVICE}`
|
||||
[ -z ${ID_PATH} ] && die "Missing ID_PATH for ${DEVICE}"
|
||||
# If we are handling a multipath device then $DM_UUID will be
|
||||
# exported and we'll use its value (prefixed with dm-uuid per
|
||||
# multipathd's naming convention) as our unique persistent key.
|
||||
# For traditional devices we'll obtain the key from udev's
|
||||
# path_id.
|
||||
if [ -n "${DM_UUID}" ] && echo ${DM_UUID} | egrep -q -e '^mpath' ; then
|
||||
ID_PATH="dm-uuid-${DM_UUID}"
|
||||
else
|
||||
eval `${PATH_ID} ${DEVICE}`
|
||||
[ -z ${ID_PATH} ] && die "Missing ID_PATH for ${DEVICE}"
|
||||
fi
|
||||
|
||||
# Use the persistent key to lookup the zpool device id in the
|
||||
# configuration file which is of the format <device id> <key>.
|
||||
|
|
|
@ -1,41 +1,74 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Set BUSES and PORTS to match the topology of your system. As each
|
||||
# port is enumerated it will be assigned the next channel name. The
|
||||
# current script enumerates each port on a bus before moving on to
|
||||
# enumerate the next bus.
|
||||
# Direct-Attached Mode
|
||||
# --------------------
|
||||
# Set BUSES and HOST_PORTS to match the topology of your system. As
|
||||
# each port is enumerated it will be assigned the next channel name.
|
||||
# The current script enumerates each port on a bus before moving on
|
||||
# to enumerate the next bus.
|
||||
#
|
||||
# Every distribution, version of udev, and type of attached storage
|
||||
# seems to result in slightly different formatting of the by-path
|
||||
# name. For this reason you may need to adjust the parsing below
|
||||
# to suit your needs. This is one of the reasons to use a custom
|
||||
# /etc/zfs/zdev.conf file, it allows the by-path naming convertion
|
||||
# /etc/zfs/zdev.conf file, it allows the by-path naming convention
|
||||
# to change and still keep the simple <channel><rank> naming.
|
||||
#
|
||||
# SAS-Switch Mode
|
||||
# -------------------------
|
||||
# When the host accesses disk via SAS switches the combination of
|
||||
# bus and port number does not necessarily uniquely identify a
|
||||
# channel or disk drawer. In this case we must resort to other
|
||||
# means to infer the physical topology. For a single-level network
|
||||
# (i.e. no switch cascading) we can assign alphabetic channel labels
|
||||
# based on the switch port number that the drawer is connected to.
|
||||
# If support for more complex topologies is needed this script will
|
||||
# need to be customized or replaced.
|
||||
#
|
||||
# In SAS-Switch mode (enabled with "-g switch" ) we require that
|
||||
# udev has been configured to create per-disk symbolic links in
|
||||
# /dev/disk/by-id of the form
|
||||
# <label>-<UUID>-switch-port:<X>-slot:<Y>. <label> is a string that
|
||||
# depends on the subsystem that created the link and defaults to
|
||||
# "dm-uuid-mpath" (this prefix is used by multipathd). <UUID> is a
|
||||
# unique identifier for the disk typically obtained from the scsi_id
|
||||
# program. <X> and <Y> denote the switch port and disk slot
|
||||
# numbers, respectively, and are typically obtained from sysfs.
|
||||
|
||||
AWK=${AWK:-/usr/bin/awk}
|
||||
CONFIG=${CONFIG:-/etc/zfs/zdev.conf}
|
||||
BUSES=( 01 02 03 )
|
||||
PORTS=( 4 0 )
|
||||
HOST_PORTS=( 4 0 )
|
||||
SWITCH_PORTS=( 0 1 2 3 4 5 6 7 8 9 )
|
||||
CHANNELS=( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z )
|
||||
TOPOLOGY="direct"
|
||||
TRIGGER="no"
|
||||
MAPPING=linux
|
||||
LABEL=${LABEL:-"dm-uuid-mpath"}
|
||||
DEV_DISK_DIR="/dev/disk/by-path"
|
||||
|
||||
shopt -s extglob
|
||||
|
||||
usage() {
|
||||
cat << EOF
|
||||
Usage: zpool_layout [-th] [-c file] [-b buses] [-p ports] [-n channels] [-m map]
|
||||
Usage: zpool_layout [-th] [-c file] [-b buses] [-o switch_ports]
|
||||
[-p host_ports] [-n channels] [-m map] [-l label]
|
||||
[-g direct|switch]
|
||||
-c Alternate config file [default=${CONFIG}]
|
||||
-b Enumerate buses [default="${BUSES[*]}"]
|
||||
-p Enumerate ports [default="${PORTS[*]}"]
|
||||
-o Enumerate switch ports [default="${SWITCH_PORTS[*]}"]
|
||||
-p Enumerate host ports [default="${HOST_PORTS[*]}"]
|
||||
-n Channel names [default="A..Z"]
|
||||
-g Storage network topology [default="${TOPOLOGY}"]
|
||||
-t Trigger and wait for udev to settle [default=${TRIGGER}]
|
||||
-l Prefix of SAS-switch-mode device links [default=${LABEL}]
|
||||
-m Slot mapping [default=${MAPPING}]
|
||||
-h Show this message
|
||||
EOF
|
||||
exit 0
|
||||
}
|
||||
|
||||
while getopts 'c:b:p:n:m:th' OPTION; do
|
||||
while getopts 'c:b:o:p:n:l:m:g:th' OPTION; do
|
||||
case ${OPTION} in
|
||||
c)
|
||||
CONFIG=${OPTARG}
|
||||
|
@ -43,15 +76,24 @@ while getopts 'c:b:p:n:m:th' OPTION; do
|
|||
b)
|
||||
BUSES=(${OPTARG})
|
||||
;;
|
||||
o)
|
||||
SWITCH_PORTS=(${OPTARG})
|
||||
;;
|
||||
p)
|
||||
PORTS=(${OPTARG})
|
||||
HOST_PORTS=(${OPTARG})
|
||||
;;
|
||||
n)
|
||||
CHANNELS=(${OPTARG})
|
||||
;;
|
||||
l)
|
||||
LABEL=${OPTARG}
|
||||
;;
|
||||
m)
|
||||
MAPPING=`readlink -e ${OPTARG}`
|
||||
;;
|
||||
g)
|
||||
TOPOLOGY=${OPTARG}
|
||||
;;
|
||||
t)
|
||||
TRIGGER=yes
|
||||
;;
|
||||
|
@ -71,7 +113,6 @@ fi
|
|||
# Save stdout as fd #8, then redirect stdout to the config file.
|
||||
exec 8>&1
|
||||
exec >${CONFIG}
|
||||
pushd /dev/disk/by-path >/dev/null
|
||||
|
||||
map_slot() {
|
||||
local LINUX_SLOT=$1
|
||||
|
@ -86,71 +127,151 @@ map_slot() {
|
|||
printf "%d" ${MAPPED_SLOT}
|
||||
}
|
||||
|
||||
# Generate comment header.
|
||||
echo "#"
|
||||
echo "# Custom /dev/disk/by-path to /dev/disk/zpool mapping, "
|
||||
echo "# based of the following physical cable layout."
|
||||
echo "#"
|
||||
|
||||
# Generate host port layout table for comment header.
|
||||
echo "# ------------------ Host Port Layout ---------------------"
|
||||
echo -n "# "
|
||||
for (( i=0; i<${#BUSES[*]}; i++ )); do
|
||||
printf "%-8d" ${BUSES[$i]}
|
||||
done
|
||||
echo
|
||||
|
||||
for (( i=0, k=0; i<${#PORTS[*]}; i++ )); do
|
||||
printf "# Port %-2d " ${PORTS[$i]}
|
||||
|
||||
for (( j=0; j<${#BUSES[*]}; j++, k++ )); do
|
||||
let k=$j*${#PORTS[*]}+$i
|
||||
printf "%-8s" ${CHANNELS[$k]}
|
||||
print_host_port_layout() {
|
||||
echo "# ------------------ Host Port Layout ---------------------"
|
||||
echo -n "# "
|
||||
for (( i=0; i<${#BUSES[*]}; i++ )); do
|
||||
printf "%-8d" ${BUSES[$i]}
|
||||
done
|
||||
echo
|
||||
done
|
||||
echo "#"
|
||||
|
||||
# Generate channel/disk layout table for comment header.
|
||||
echo "# ----------------- Channel/Disk Layout -------------------"
|
||||
echo "# Channel Disks"
|
||||
for (( i=0, k=0; i<${#BUSES[*]}; i++ )); do
|
||||
for (( j=0; j<${#PORTS[*]}; j++, k++ )); do
|
||||
printf "# %-9s" ${CHANNELS[$k]}
|
||||
ls *:${BUSES[$i]}:*:${PORTS[$j]}* 2>/dev/null | \
|
||||
cut -f7 -d'-' | sort -u -n | tr '\n' ','
|
||||
for (( i=0, k=0; i<${#HOST_PORTS[*]}; i++ )); do
|
||||
printf "# Port %-2d " ${HOST_PORTS[$i]}
|
||||
|
||||
for (( j=0; j<${#BUSES[*]}; j++, k++ )); do
|
||||
let k=$j*${#HOST_PORTS[*]}+$i
|
||||
printf "%-8s" ${CHANNELS[$k]}
|
||||
done
|
||||
echo
|
||||
done
|
||||
done
|
||||
echo "#"
|
||||
echo "#"
|
||||
}
|
||||
|
||||
# Generate SAS switch port layout table for comment header.
|
||||
print_switch_port_layout() {
|
||||
echo "# --------------- SAS Switch Port Layout ------------------"
|
||||
echo -n "# Switch Port "
|
||||
for (( i=0; i<${#SWITCH_PORTS[*]}; i++ )); do
|
||||
printf "%3d" ${SWITCH_PORTS[$i]}
|
||||
done
|
||||
echo
|
||||
echo -n "# Channel "
|
||||
for (( i=0; i<${#SWITCH_PORTS[*]}; i++ )); do
|
||||
printf "%3s" ${CHANNELS[$i]}
|
||||
done
|
||||
echo
|
||||
echo "#"
|
||||
}
|
||||
|
||||
# Generate channel/disk layout table for comment header.
|
||||
print_channel_layout() {
|
||||
pushd ${DEV_DISK_DIR} >/dev/null
|
||||
echo "# ----------------- Channel/Disk Layout -------------------"
|
||||
echo "# Channel Disks"
|
||||
if [ ${TOPOLOGY} = "switch" ] ; then
|
||||
for (( i=0; i<${#SWITCH_PORTS[*]}; i++ )); do
|
||||
printf "# %-9s" ${CHANNELS[$i]}
|
||||
p=${SWITCH_PORTS[$i]}
|
||||
ls ${LABEL}-+([0-9a-f])-switch-port:${p}-slot:+([0-9]) \
|
||||
2>/dev/null | cut -f3 -d':' | sort -u -n | \
|
||||
xargs | tr ' ' ','
|
||||
done
|
||||
else
|
||||
for (( i=0, k=0; i<${#BUSES[*]}; i++ )); do
|
||||
for (( j=0; j<${#HOST_PORTS[*]}; j++, k++ )); do
|
||||
printf "# %-9s" ${CHANNELS[$k]}
|
||||
ls *:${BUSES[$i]}:*:${HOST_PORTS[$j]}* \
|
||||
2>/dev/null | cut -f7 -d'-' | \
|
||||
sort -u -n | xargs | tr ' ' ','
|
||||
done
|
||||
done
|
||||
fi
|
||||
echo "#"
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
# Generate mapping from <channel><rank> to by-path name.
|
||||
for (( i=0, k=0; i<${#BUSES[*]}; i++ )); do
|
||||
for (( j=0; j<${#PORTS[*]}; j++, k++ )); do
|
||||
BYPATH=(`ls *:${BUSES[$i]}:*:${PORTS[$j]}* 2>/dev/null | \
|
||||
grep -v part | sort -n -k7 -t'-' | cut -f1-6 -d'-'`)
|
||||
SLOTS=(`ls *:${BUSES[$i]}:*:${PORTS[$j]}* 2>/dev/null | \
|
||||
grep -v part | sort -n -k7 -t'-' | cut -f7 -d'-'`)
|
||||
map_shortname_to_by_path() {
|
||||
pushd ${DEV_DISK_DIR} >/dev/null
|
||||
for (( i=0, k=0; i<${#BUSES[*]}; i++ )); do
|
||||
for (( j=0; j<${#HOST_PORTS[*]}; j++, k++ )); do
|
||||
BYPATH=(`ls *:${BUSES[$i]}:*:${HOST_PORTS[$j]}* \
|
||||
2>/dev/null | grep -v part | \
|
||||
sort -n -k7 -t'-' | cut -f1-6 -d'-'`)
|
||||
SLOTS=(`ls *:${BUSES[$i]}:*:${HOST_PORTS[$j]}* \
|
||||
2>/dev/null | grep -v part | \
|
||||
sort -n -k7 -t'-' | cut -f7 -d'-'`)
|
||||
TMP_FILE=`mktemp`
|
||||
|
||||
for (( l=0; l<${#SLOTS[*]}; l++ )); do
|
||||
MAPPED_SLOT=`map_slot ${SLOTS[$l]}`
|
||||
printf "%s%d\t%s-%d\n" \
|
||||
${CHANNELS[$k]} ${MAPPED_SLOT} \
|
||||
${BYPATH[$l]} ${SLOTS[$l]} >>${TMP_FILE}
|
||||
done
|
||||
|
||||
echo
|
||||
echo -n "# Channel ${CHANNELS[$k]}, "
|
||||
echo "Bus ${BUSES[$i]}, Port ${HOST_PORTS[$j]}"
|
||||
cat ${TMP_FILE} | sort -n -k2 -t${CHANNELS[$k]}
|
||||
rm -f ${TMP_FILE}
|
||||
done
|
||||
done
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
# Generate mapping from <channel><rank> to by-id name.
|
||||
map_shortname_to_by_id() {
|
||||
pushd ${DEV_DISK_DIR} >/dev/null
|
||||
for (( i=0; i<${#SWITCH_PORTS[*]}; i++ )); do
|
||||
p=${SWITCH_PORTS[$i]}
|
||||
BYID=(`ls ${LABEL}-+([0-9a-f])-switch-port:${p}-slot:+([0-9]) \
|
||||
2>/dev/null | grep -v part | sort -k3n -t':' | \
|
||||
cut -f1-2 -d':'`)
|
||||
SLOTS=(`ls ${LABEL}-+([0-9a-f])-switch-port:${p}-slot:+([0-9]) \
|
||||
2>/dev/null | grep -v part | sort -k3n -t':' | \
|
||||
cut -f3 -d':'`)
|
||||
TMP_FILE=`mktemp`
|
||||
|
||||
for (( l=0; l<${#SLOTS[*]}; l++ )); do
|
||||
MAPPED_SLOT=`map_slot ${SLOTS[$l]}`
|
||||
printf "%s%d\t%s-%d\n" \
|
||||
${CHANNELS[$k]} ${MAPPED_SLOT} \
|
||||
${BYPATH[$l]} ${SLOTS[$l]} >>${TMP_FILE}
|
||||
printf "%s%d\t%s:%d\n" \
|
||||
${CHANNELS[$i]} ${MAPPED_SLOT} ${BYID[$l]} \
|
||||
${SLOTS[$l]} >>${TMP_FILE}
|
||||
done
|
||||
|
||||
echo
|
||||
echo -n "# Channel ${CHANNELS[$k]}, "
|
||||
echo "Bus ${BUSES[$i]}, Port ${PORTS[$j]}"
|
||||
cat ${TMP_FILE} | sort -n -k2 -t${CHANNELS[$k]}
|
||||
echo -n "# Channel ${CHANNELS[$i]}, "
|
||||
echo "SAS Switch Port ${SWITCH_PORTS[$i]}"
|
||||
cat ${TMP_FILE} | sort -n -k2 -t${CHANNELS[$i]}
|
||||
rm -f ${TMP_FILE}
|
||||
done
|
||||
done
|
||||
popd > /dev/null
|
||||
}
|
||||
|
||||
# Generate comment header.
|
||||
echo "#"
|
||||
echo "# Custom ${DEV_DISK_DIR} to /dev/disk/zpool mapping, "
|
||||
echo "# based of the following physical cable layout."
|
||||
echo "#"
|
||||
|
||||
case ${TOPOLOGY} in
|
||||
direct)
|
||||
print_host_port_layout
|
||||
print_channel_layout
|
||||
map_shortname_to_by_path
|
||||
;;
|
||||
switch)
|
||||
DEV_DISK_DIR="/dev/disk/by-id"
|
||||
print_switch_port_layout
|
||||
print_channel_layout
|
||||
map_shortname_to_by_id
|
||||
;;
|
||||
esac
|
||||
|
||||
# Restore stdout from fd #8 and close fd #8.
|
||||
exec 1>&8 8>&-
|
||||
popd >/dev/null
|
||||
|
||||
if [ ${TRIGGER} = "yes" ]; then
|
||||
udevadm trigger --action=change --subsystem-match=block
|
||||
|
|
|
@ -20259,7 +20259,7 @@ fi
|
|||
$as_echo "$enable_debug" >&6; }
|
||||
|
||||
|
||||
ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
|
||||
ac_config_files="$ac_config_files Makefile dracut/Makefile dracut/90zfs/Makefile etc/Makefile etc/udev/Makefile etc/udev/rules.d/Makefile etc/init.d/Makefile etc/zfs/Makefile man/Makefile man/man8/Makefile lib/Makefile lib/libspl/Makefile lib/libspl/asm-generic/Makefile lib/libspl/asm-i386/Makefile lib/libspl/asm-x86_64/Makefile lib/libspl/include/Makefile lib/libspl/include/ia32/Makefile lib/libspl/include/ia32/sys/Makefile lib/libspl/include/rpc/Makefile lib/libspl/include/sys/Makefile lib/libspl/include/sys/sysevent/Makefile lib/libspl/include/sys/dktp/Makefile lib/libspl/include/util/Makefile lib/libavl/Makefile lib/libefi/Makefile lib/libnvpair/Makefile lib/libunicode/Makefile lib/libuutil/Makefile lib/libzpool/Makefile lib/libzfs/Makefile cmd/Makefile cmd/zdb/Makefile cmd/zfs/Makefile cmd/zinject/Makefile cmd/zpool/Makefile cmd/ztest/Makefile cmd/zpios/Makefile cmd/mount_zfs/Makefile cmd/zpool_layout/Makefile cmd/zvol_id/Makefile cmd/zpool_id/Makefile cmd/sas_switch_id/Makefile module/Makefile module/avl/Makefile module/nvpair/Makefile module/unicode/Makefile module/zcommon/Makefile module/zfs/Makefile module/zpios/Makefile include/Makefile include/linux/Makefile include/sys/Makefile include/sys/fs/Makefile include/sys/fm/Makefile include/sys/fm/fs/Makefile scripts/Makefile scripts/zpios-profile/Makefile scripts/zpios-test/Makefile scripts/zpool-config/Makefile scripts/zpool-layout/Makefile scripts/common.sh zfs.spec zfs-modules.spec zfs-script-config.sh"
|
||||
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
|
@ -21216,6 +21216,7 @@ do
|
|||
"cmd/zpool_layout/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/zpool_layout/Makefile" ;;
|
||||
"cmd/zvol_id/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/zvol_id/Makefile" ;;
|
||||
"cmd/zpool_id/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/zpool_id/Makefile" ;;
|
||||
"cmd/sas_switch_id/Makefile") CONFIG_FILES="$CONFIG_FILES cmd/sas_switch_id/Makefile" ;;
|
||||
"module/Makefile") CONFIG_FILES="$CONFIG_FILES module/Makefile" ;;
|
||||
"module/avl/Makefile") CONFIG_FILES="$CONFIG_FILES module/avl/Makefile" ;;
|
||||
"module/nvpair/Makefile") CONFIG_FILES="$CONFIG_FILES module/nvpair/Makefile" ;;
|
||||
|
|
|
@ -95,6 +95,7 @@ AC_CONFIG_FILES([
|
|||
cmd/zpool_layout/Makefile
|
||||
cmd/zvol_id/Makefile
|
||||
cmd/zpool_id/Makefile
|
||||
cmd/sas_switch_id/Makefile
|
||||
module/Makefile
|
||||
module/avl/Makefile
|
||||
module/nvpair/Makefile
|
||||
|
|
|
@ -5,4 +5,5 @@
|
|||
ENV{DEVTYPE}=="disk", IMPORT{program}="@bindir@/zpool_id -d %p"
|
||||
|
||||
KERNEL=="*[!0-9]", ENV{SUBSYSTEM}=="block", ENV{ID_ZPOOL}=="?*", SYMLINK+="$env{ID_ZPOOL_PATH}"
|
||||
KERNEL=="*[0-9]", ENV{SUBSYSTEM}=="block", ENV{ID_ZPOOL}=="?*", SYMLINK+="$env{ID_ZPOOL_PATH}-part%n"
|
||||
KERNEL=="*[0-9]", ENV{SUBSYSTEM}=="block", ENV{DEVTYPE}=="partition", ENV{ID_ZPOOL}=="?*", SYMLINK+="$env{ID_ZPOOL_PATH}-part%n"
|
||||
KERNEL=="dm-[0-9]*", ENV{SUBSYSTEM}=="block", ENV{ID_ZPOOL}=="?*", SYMLINK+="$env{ID_ZPOOL_PATH}"
|
||||
|
|
Loading…
Reference in New Issue