mirror_zfs/include
Tony Hutter 8720e9e748 Add -c to zpool iostat & status to run command
This patch adds a command (-c) option to zpool status and zpool iostat.  The
-c option allows you to run an arbitrary command on each vdev and display
the first line of output in zpool status/iostat.  The environment vars
VDEV_PATH and VDEV_UPATH are set to the vdev's path and "underlying path"
before running the command.  For device mapper, multipath, or partitioned
vdevs, VDEV_UPATH is the actual underlying /dev/sd* disk.  This can be useful
if the command you're running requires a /dev/sd* device.

The patch also uses /sys/block/<dev>/slaves/ to lookup the underlying device
instead of using libdevmapper.  This not only removes the libdevmapper
requirement at build time, but also allows you to resolve device mapper
devices without being root.  This means that UDEV_UPATH get set correctly
when running zpool status/iostat as an unprivileged user.

Example:

$ zpool status -c 'echo I am $VDEV_PATH, $VDEV_UPATH'

NAME        STATE     READ WRITE CKSUM
mypool      ONLINE       0     0     0
  mirror-0  ONLINE       0     0     0
    mpatha  ONLINE       0     0     0  I am /dev/mapper/mpatha, /dev/sdc
    sdb     ONLINE       0     0     0  I am /dev/sdb1, /dev/sdb

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tony Hutter <hutter2@llnl.gov>
Closes #5368
2016-11-29 14:45:38 -07:00
..
linux Use set_cached_acl and forget_cached_acl when possible 2016-11-07 11:04:44 -08:00
sys Export symbol dmu_objset_userobjspace_upgradable 2016-11-09 13:51:12 -08:00
libnvpair.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
libuutil_common.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
libuutil_impl.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
libuutil.h Support custom build directories and move includes 2010-09-08 12:38:56 -07:00
libzfs_core.h DLPX-40252 integrate EP-476 compressed zfs send/receive 2016-09-13 09:58:58 -07:00
libzfs_impl.h OpenZFS 6314 - buffer overflow in dsl_dataset_name 2016-06-28 13:47:03 -07:00
libzfs.h Add -c to zpool iostat & status to run command 2016-11-29 14:45:38 -07:00
Makefile.am Kernel header installation should respect --prefix 2014-10-28 09:37:06 -07:00
zfeature_common.h Add support for user/group dnode accounting & quota 2016-10-07 09:45:13 -07:00
zfs_comutil.h Illumos #2882, #2883, #2900 2013-09-04 15:49:00 -07:00
zfs_deleg.h Add support for user/group dnode accounting & quota 2016-10-07 09:45:13 -07:00
zfs_fletcher.h Add superscalar fletcher4 2016-11-04 10:53:03 -07:00
zfs_namecheck.h Illumos 4368, 4369. 2014-07-29 10:55:29 -07:00
zfs_prop.h Check the dataset type more rigorously when fetching properties. 2014-05-06 10:41:46 -07:00
zpios-ctl.h Fix coverity defects: CID 147540, 147542 2016-11-09 17:35:26 -08:00
zpios-internal.h Add large block support to zpios(1) benchmark 2015-09-22 09:13:20 -07:00