From: Brian Behlendorf Date: Tue, 29 Jan 2013 18:53:19 +0000 (-0800) Subject: Retire zpool_id infrastructure X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=commitdiff_plain;h=dbf763b39b232996f0d6bb0022e4446643c18e05;p=zfs.git Retire zpool_id infrastructure In the interest of maintaining only one udev helper to give vdevs user friendly names, the zpool_id and zpool_layout infrastructure is being retired. They are superseded by vdev_id which incorporates all the previous functionality. Documentation for the new vdev_id(8) helper and its configuration file, vdev_id.conf(5), can be found in their respective man pages. Several useful example files are installed under /etc/zfs/. /etc/zfs/vdev_id.conf.alias.example /etc/zfs/vdev_id.conf.multipath.example /etc/zfs/vdev_id.conf.sas_direct.example /etc/zfs/vdev_id.conf.sas_switch.example Signed-off-by: Brian Behlendorf Closes #981 --- diff --git a/PKGBUILD-zfs.in b/PKGBUILD-zfs.in index 6e7dcb6..e37a251 100644 --- a/PKGBUILD-zfs.in +++ b/PKGBUILD-zfs.in @@ -7,7 +7,6 @@ arch=(x86_64) url="git://github.com/zfsonlinux/zfs.git" license=(@ZFS_META_LICENSE@) depends=('spl' 'zlib' 'e2fsprogs') -backup=('etc/zfs/zdev.conf') source=(@ZFS_META_NAME@-@ZFS_META_VERSION@.tar.gz) build() { diff --git a/cmd/Makefile.am b/cmd/Makefile.am index 22f3ee0..1a51ddc 100644 --- a/cmd/Makefile.am +++ b/cmd/Makefile.am @@ -1,2 +1,2 @@ SUBDIRS = zfs zpool zdb zhack zinject zstreamdump ztest zpios -SUBDIRS += mount_zfs fsck_zfs zpool_layout zvol_id zpool_id vdev_id +SUBDIRS += mount_zfs fsck_zfs zvol_id vdev_id diff --git a/cmd/zpool_id/Makefile.am b/cmd/zpool_id/Makefile.am deleted file mode 100644 index 5f492cf..0000000 --- a/cmd/zpool_id/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -dist_udev_SCRIPTS = zpool_id diff --git a/cmd/zpool_id/zpool_id b/cmd/zpool_id/zpool_id deleted file mode 100755 index bf15dc9..0000000 --- a/cmd/zpool_id/zpool_id +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh - -CONFIG="${CONFIG:-/etc/zfs/zdev.conf}" - -if [ -z "${PATH_ID}" ]; then - # The path_id helper became a builtin command in udev 174. - if [ -x '/lib/udev/path_id' ]; then - PATH_ID='/lib/udev/path_id' - else - PATH_ID='udevadm test-builtin path_id' - fi -fi - -die() { - echo "Error: $*" - exit 1 -} - -usage() { - cat << EOF -Usage: zpool_id [-h] [-c configfile] - -c Alternate config file [default /etc/zfs/zdev.conf] - -d Use path_id from device as the mapping key - -h Show this message -EOF - exit 1 -} - -while getopts 'c:d:h' OPTION; do - case ${OPTION} in - c) - CONFIG="${OPTARG}" - ;; - d) - DEVICE="${OPTARG}" - ;; - h) - usage - ;; - esac -done - -# Check that a device was requested -[ -z "${DEVICE}" ] && usage - -# Check for the existence of a configuration file -[ ! -f "${CONFIG}" ] && die "Missing config file: ${CONFIG}" - -# 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}" | grep -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 . -# Lines starting with #'s are treated as comments and ignored. -# Exact matches are required, wild cards are not supported, -# and only the first match is returned. -ID_ZPOOL='' -while read CONFIG_ZPOOL CONFIG_PATH REPLY; do - if [ "${CONFIG_ZPOOL}" != "${CONFIG_ZPOOL#\#}" ]; then - # Skip comment lines. - continue - fi - if [ "${CONFIG_PATH}" = "${ID_PATH}" ]; then - ID_ZPOOL="${CONFIG_ZPOOL}" - break - fi -done <"${CONFIG}" - -[ -z "${ID_ZPOOL}" ] && die "Missing ID_ZPOOL for ID_PATH: ${ID_PATH}" - -if [ -n "${ID_ZPOOL}" ]; then - echo "ID_PATH=${ID_PATH}" - echo "ID_ZPOOL=${ID_ZPOOL}" - echo "ID_ZPOOL_PATH=disk/zpool/${ID_ZPOOL}" -fi - -exit 0 diff --git a/cmd/zpool_layout/Makefile.am b/cmd/zpool_layout/Makefile.am deleted file mode 100644 index b17e6a3..0000000 --- a/cmd/zpool_layout/Makefile.am +++ /dev/null @@ -1 +0,0 @@ -dist_bin_SCRIPTS = zpool_layout diff --git a/cmd/zpool_layout/zpool_layout b/cmd/zpool_layout/zpool_layout deleted file mode 100755 index 8fc6bad..0000000 --- a/cmd/zpool_layout/zpool_layout +++ /dev/null @@ -1,281 +0,0 @@ -#!/bin/bash -# -# 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 convention -# to change and still keep the simple 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 -#