freebsd-dev/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
libuutil_common.h
libuutil_impl.h
libuutil.h
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
zfeature_common.h Add support for user/group dnode accounting & quota 2016-10-07 09:45:13 -07:00
zfs_comutil.h
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
zfs_prop.h
zpios-ctl.h Fix coverity defects: CID 147540, 147542 2016-11-09 17:35:26 -08:00
zpios-internal.h