zpool iostat/status -c improvements

Users can now provide their own scripts to be run
with 'zpool iostat/status -c'. User scripts should be
placed in ~/.zpool.d to be included in zpool's
default search path.

Provide a script which can be used with
'zpool iostat|status -c' that will return the type of
device (hdd, sdd, file).

Provide a script to get various values from smartctl
when using 'zpool iostat/status -c'.

Allow users to define the ZPOOL_SCRIPTS_PATH
environment variable which can be used to override
the default 'zpool iostat/status -c' search path.

Allow the ZPOOL_SCRIPTS_ENABLED environment
variable to enable or disable 'zpool status/iostat -c'
functionality.

Use the new smart script to provide the serial command.

Install /etc/sudoers.d/zfs file which contains the sudoer
rule for smartctl as a sample.

Allow 'zpool iostat/status -c' tests to run in tree.

Reviewed-by: Tony Hutter <hutter2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Closes #6121 
Closes #6153
This commit is contained in:
Giuseppe Di Natale
2017-06-05 13:52:15 -04:00
committed by Brian Behlendorf
parent 92aceb2a7e
commit 099700d9df
43 changed files with 812 additions and 61 deletions
+6
View File
@@ -14,6 +14,7 @@
# --with-mounthelperdir=DIR install mount.zfs in dir [/sbin]
# --with-udevdir=DIR install udev helpers [default=check]
# --with-udevruledir=DIR install udev rules [default=UDEVDIR/rules.d]
# --sysconfdir=DIR install zfs configuration files [PREFIX/etc]
#
basedir="$(dirname $0)"
@@ -96,6 +97,7 @@ if [ "$VERBOSE" ]; then
echo "udevdir: $udevdir"
echo "udevruledir: $udevruledir"
echo "mounthelperdir: $mounthelperdir"
echo "sysconfdir: $sysconfdir"
echo "DRYRUN: $DRYRUN"
echo
fi
@@ -114,6 +116,7 @@ install() {
msg "ln -s $src $dst"
if [ ! "$DRYRUN" ]; then
mkdir -p $(dirname $dst) &>/dev/null
ln -s $src $dst
fi
fi
@@ -125,6 +128,7 @@ remove() {
if [ -h $dst ]; then
msg "rm $dst"
rm $dst
rmdir $(dirname $dst) &>/dev/null
fi
}
@@ -136,6 +140,7 @@ if [ ${INSTALL} ]; then
install $UDEVRULEDIR/60-zvol.rules $udevruledir/60-zvol.rules
install $UDEVRULEDIR/69-vdev.rules $udevruledir/69-vdev.rules
install $UDEVRULEDIR/90-zfs.rules $udevruledir/90-zfs.rules
install $CMDDIR/zpool/zpool.d $sysconfdir/zfs/zpool.d
else
remove $mounthelperdir/mount.zfs
remove $mounthelperdir/fsck.zfs
@@ -144,6 +149,7 @@ else
remove $udevruledir/60-zvol.rules
remove $udevruledir/69-vdev.rules
remove $udevruledir/90-zfs.rules
remove $sysconfdir/zfs/zpool.d
fi
exit 0