X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;ds=sidebyside;f=cmd%2Fzpool_id%2Fzpool_id;h=9d2a845497ed452ce56df3ad92f370c72caec4f6;hb=5c03efc379693f992ebe39c6a00c7297c4a304ea;hp=f74504cfb4156878eeebc58cf816a74045fe5047;hpb=6ee44e32be259706aed9b1439b71971a165b198c;p=zfs.git diff --git a/cmd/zpool_id/zpool_id b/cmd/zpool_id/zpool_id index f74504c..9d2a845 100755 --- a/cmd/zpool_id/zpool_id +++ b/cmd/zpool_id/zpool_id @@ -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 .