From 52c8537513652a9d424009cde03299e83a8c4467 Mon Sep 17 00:00:00 2001 From: Pavel Snajdr Date: Sat, 28 Nov 2020 20:15:57 +0100 Subject: [PATCH] zpool_influxdb: move to libexec dir Move the zpool_influxdb command to /usr/libexec/zfs, and include the /usr/libexec/zfs path in the system search directory when running the test suite. Reviewed-by: Richard Elling Reviewed-by: Brian Behlendorf Signed-off-by: Pavel Snajdr Closes #11156 Closes #11160 Closes #11224 --- cmd/zpool_influxdb/Makefile.am | 2 +- cmd/zpool_influxdb/README.md | 4 ++-- cmd/zpool_influxdb/telegraf.d/exec_zpool_influxdb.conf | 2 +- cmd/zpool_influxdb/telegraf.d/execd_zpool_influxdb.conf | 2 +- rpm/generic/zfs.spec.in | 1 - scripts/Makefile.am | 2 ++ scripts/common.sh.in | 1 + scripts/zfs-tests.sh | 2 +- 8 files changed, 9 insertions(+), 7 deletions(-) diff --git a/cmd/zpool_influxdb/Makefile.am b/cmd/zpool_influxdb/Makefile.am index d87afc48f..28e94d616 100644 --- a/cmd/zpool_influxdb/Makefile.am +++ b/cmd/zpool_influxdb/Makefile.am @@ -1,6 +1,6 @@ include $(top_srcdir)/config/Rules.am -bin_PROGRAMS = zpool_influxdb +zfsexec_PROGRAMS = zpool_influxdb zpool_influxdb_SOURCES = \ zpool_influxdb.c diff --git a/cmd/zpool_influxdb/README.md b/cmd/zpool_influxdb/README.md index 7d6c253d7..864d67498 100644 --- a/cmd/zpool_influxdb/README.md +++ b/cmd/zpool_influxdb/README.md @@ -237,7 +237,7 @@ be restarted to read the config-directory files. # # Read metrics from zpool_influxdb [[inputs.execd]] # ## default installation location for zpool_influxdb command - command = ["/usr/bin/zpool_influxdb", "--execd"] + command = ["/usr/libexec/zfs/zpool_influxdb", "--execd"] ## Define how the process is signaled on each collection interval. ## Valid values are: @@ -264,7 +264,7 @@ be restarted to read the config-directory files. # # Read metrics from zpool_influxdb [[inputs.exec]] # ## default installation location for zpool_influxdb command - commands = ["/usr/bin/zpool_influxdb"] + commands = ["/usr/libexec/zfs/zpool_influxdb"] data_format = "influx" ``` diff --git a/cmd/zpool_influxdb/telegraf.d/exec_zpool_influxdb.conf b/cmd/zpool_influxdb/telegraf.d/exec_zpool_influxdb.conf index e934b4e88..a2efa6189 100644 --- a/cmd/zpool_influxdb/telegraf.d/exec_zpool_influxdb.conf +++ b/cmd/zpool_influxdb/telegraf.d/exec_zpool_influxdb.conf @@ -1,7 +1,7 @@ # # Read metrics from zpool_influxdb [[inputs.exec]] # ## default installation location for zpool_influxdb command - commands = ["/usr/local/bin/zpool_influxdb"] + commands = ["/usr/local/libexec/zfs/zpool_influxdb"] # ## Timeout for each command to complete. # timeout = "5s" # diff --git a/cmd/zpool_influxdb/telegraf.d/execd_zpool_influxdb.conf b/cmd/zpool_influxdb/telegraf.d/execd_zpool_influxdb.conf index e56c51fc1..90737b8cb 100644 --- a/cmd/zpool_influxdb/telegraf.d/execd_zpool_influxdb.conf +++ b/cmd/zpool_influxdb/telegraf.d/execd_zpool_influxdb.conf @@ -1,7 +1,7 @@ # # Read metrics from zpool_influxdb [[inputs.execd]] # ## default installation location for zpool_influxdb command - command = ["/usr/local/bin/zpool_influxdb", "--execd"] + command = ["/usr/local/libexec/zfs/zpool_influxdb", "--execd"] ## Define how the process is signaled on each collection interval. ## Valid values are: diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index f34c4a443..ef0699d36 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -444,7 +444,6 @@ systemctl --system daemon-reload >/dev/null || true %{_bindir}/raidz_test %{_bindir}/zgenhostid %{_bindir}/zvol_wait -%{_bindir}/zpool_influxdb # Optional Python 2/3 scripts %{_bindir}/arc_summary %{_bindir}/arcstat diff --git a/scripts/Makefile.am b/scripts/Makefile.am index af7c36c8f..2deece7f4 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -61,6 +61,7 @@ export EXTRA_ENVIRONMENT all-local: -$(SED) -e '\|^export BIN_DIR=|s|$$|@abs_top_builddir@/bin|' \ -e '\|^export SBIN_DIR=|s|$$|@abs_top_builddir@/bin|' \ + -e '\|^export LIBEXEC_DIR=|s|$$|@abs_top_builddir@/bin|' \ -e '\|^export ZTS_DIR=|s|$$|@abs_top_srcdir@/tests|' \ -e '\|^export SCRIPT_DIR=|s|$$|@abs_top_srcdir@/scripts|' \ $(abs_top_srcdir)/scripts/common.sh.in >common.sh @@ -72,6 +73,7 @@ clean-local: install-data-hook: -$(SED) -e '\|^export BIN_DIR=|s|$$|@bindir@|' \ -e '\|^export SBIN_DIR=|s|$$|@sbindir@|' \ + -e '\|^export LIBEXEC_DIR=|s|$$|@zfsexecdir@|' \ -e '\|^export ZTS_DIR=|s|$$|@datadir@/@PACKAGE@|' \ -e '\|^export SCRIPT_DIR=|s|$$|@datadir@/@PACKAGE@|' \ $(abs_top_srcdir)/scripts/common.sh.in \ diff --git a/scripts/common.sh.in b/scripts/common.sh.in index 2d9d9c786..8268315b3 100644 --- a/scripts/common.sh.in +++ b/scripts/common.sh.in @@ -3,6 +3,7 @@ # Directories export BIN_DIR= export SBIN_DIR= +export LIBEXEC_DIR= export ZTS_DIR= export SCRIPT_DIR= diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index ea6dc7eb2..f986edf76 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -242,7 +242,7 @@ constrain_path() { # install to /usr/local/sbin. To avoid testing the wrong utils we # need /usr/local to come before / in the path search order. SYSTEM_DIRS="/usr/local/bin /usr/local/sbin" - SYSTEM_DIRS="$SYSTEM_DIRS /usr/bin /usr/sbin /bin /sbin" + SYSTEM_DIRS="$SYSTEM_DIRS /usr/bin /usr/sbin /bin /sbin $LIBEXEC_DIR" if [ "$INTREE" = "yes" ]; then # Constrained path set to ./zfs/bin/