master - lvmpolld: Add standalone polldaemon.
Subsystems (2)
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=e587b0677b705786a78f21bac1966621f70b2752 Commit: e587b0677b705786a78f21bac1966621f70b2752 Parent: be23fae488b7df19147259d3e8505fc8301076cd Author: Ondrej Kozina <[email protected]> AuthorDate: Sat May 9 00:59:18 2015 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Sat May 9 00:59:18 2015 +0100
lvmpolld: Add standalone polldaemon.
See doc/lvmpolld_overview.txt
--- WHATS_NEW | 2 + conf/example.conf.in | 10 + configure | 49 ++- configure.in | 30 + daemons/Makefile.in | 10 +- daemons/lvmpolld/Makefile.in | 49 ++ daemons/lvmpolld/lvmpolld-cmd-utils.c | 140 ++++ daemons/lvmpolld/lvmpolld-cmd-utils.h | 25 + daemons/lvmpolld/lvmpolld-common.h | 36 + daemons/lvmpolld/lvmpolld-core.c | 817 +++++++++++++++++++++ daemons/lvmpolld/lvmpolld-data-utils.c | 388 ++++++++++ daemons/lvmpolld/lvmpolld-data-utils.h | 215 ++++++ daemons/lvmpolld/lvmpolld-protocol.h | 49 ++ daemons/lvmpolld/polling_ops.h | 25 + doc/lvmpolld_overview.txt | 81 ++ include/.symlinks.in | 4 + lib/Makefile.in | 5 + lib/commands/toolcontext.c | 11 + lib/config/config_settings.h | 9 + lib/lvmpolld/lvmpolld-client.c | 311 ++++++++ lib/lvmpolld/lvmpolld-client.h | 52 ++ lib/lvmpolld/polldaemon.h | 93 +++ lib/misc/configure.h.in | 6 + libdaemon/Makefile.in | 2 +- make.tmpl.in | 2 +- man/Makefile.in | 8 +- man/lvm.8.in | 6 + man/lvmpolld.8.in | 86 +++ scripts/.gitignore | 3 + scripts/Makefile.in | 9 + scripts/lvm2_lvmpolld_init_red_hat.in | 114 +++ scripts/lvm2_lvmpolld_systemd_red_hat.service.in | 17 + scripts/lvm2_lvmpolld_systemd_red_hat.socket.in | 12 + scripts/lvmdump.sh | 24 +- test/Makefile.in | 28 +- test/lib/aux.sh | 100 +++- test/lib/flavour-ndev-cluster-lvmpolld.sh | 2 + test/lib/flavour-ndev-lvmetad-lvmpolld.sh | 3 + test/lib/flavour-ndev-lvmpolld.sh | 2 + test/lib/flavour-udev-cluster-lvmpolld.sh | 3 + test/lib/flavour-udev-lvmetad-lvmpolld.sh | 4 + test/lib/flavour-udev-lvmpolld.sh | 3 + test/lib/inittest.sh | 7 + test/shell/000-basic.sh | 2 + test/shell/activate-minor.sh | 1 + test/shell/activate-missing-segment.sh | 2 + test/shell/activate-missing.sh | 2 + test/shell/activate-partial.sh | 2 + test/shell/activation-skip.sh | 2 + test/shell/clvmd-restart.sh | 1 + test/shell/covercmd.sh | 2 + test/shell/discards-thin.sh | 2 + test/shell/dmeventd-restart.sh | 2 + test/shell/dumpconfig.sh | 2 + test/shell/error-usage.sh | 2 + test/shell/fsadm.sh | 2 + test/shell/inconsistent-metadata.sh | 2 + test/shell/listings.sh | 2 + test/shell/lock-blocking.sh | 4 +- test/shell/lock-parallel.sh | 2 + test/shell/lvchange-cache.sh | 2 + test/shell/lvchange-mirror.sh | 2 + test/shell/lvchange-partial-raid10.sh | 2 + test/shell/lvchange-partial.sh | 1 + test/shell/lvchange-raid10.sh | 2 + test/shell/lvchange-raid456.sh | 2 + test/shell/lvchange-syncaction-raid.sh | 2 + test/shell/lvchange-thin.sh | 2 + test/shell/lvconvert-cache-raid.sh | 2 + test/shell/lvconvert-cache-thin.sh | 2 + test/shell/lvconvert-cache.sh | 2 + test/shell/lvconvert-raid-allocation.sh | 2 + test/shell/lvconvert-raid.sh | 2 + test/shell/lvconvert-raid10.sh | 2 + test/shell/lvconvert-raid456.sh | 2 + test/shell/lvconvert-repair-dmeventd.sh | 2 + test/shell/lvconvert-repair-raid-dmeventd.sh | 2 + test/shell/lvconvert-repair-raid.sh | 2 + test/shell/lvconvert-repair-snapshot.sh | 2 + test/shell/lvconvert-repair-thin.sh | 2 + test/shell/lvconvert-repair-transient-dmeventd.sh | 2 + test/shell/lvconvert-repair-transient.sh | 2 + test/shell/lvconvert-snapshot.sh | 2 + test/shell/lvconvert-thin-external.sh | 2 + test/shell/lvconvert-thin-raid.sh | 2 + test/shell/lvconvert-thin.sh | 2 + test/shell/lvcreate-cache.sh | 2 + test/shell/lvcreate-large-raid.sh | 2 + test/shell/lvcreate-large-raid10.sh | 2 + test/shell/lvcreate-large.sh | 2 + test/shell/lvcreate-mirror.sh | 3 + test/shell/lvcreate-missing.sh | 2 + test/shell/lvcreate-operation.sh | 2 + test/shell/lvcreate-pvtags.sh | 2 + test/shell/lvcreate-raid.sh | 2 + test/shell/lvcreate-raid10.sh | 2 + test/shell/lvcreate-repair.sh | 2 + test/shell/lvcreate-signature-wiping.sh | 2 + test/shell/lvcreate-small-snap.sh | 2 + test/shell/lvcreate-striped-mirror.sh | 2 + test/shell/lvcreate-thin-big.sh | 2 + test/shell/lvcreate-thin-external.sh | 2 + test/shell/lvcreate-thin-power2.sh | 2 + test/shell/lvcreate-thin-snap.sh | 2 + test/shell/lvcreate-thin.sh | 2 + test/shell/lvextend-percent-extents.sh | 2 + test/shell/lvextend-snapshot-dmeventd.sh | 2 + test/shell/lvextend-snapshot-policy.sh | 2 + test/shell/lvextend-thin-metadata-dmeventd.sh | 2 + test/shell/lvextend-thin.sh | 2 + test/shell/lvm-init.sh | 2 + test/shell/lvmcache-exercise.sh | 2 + test/shell/lvmetad-ambiguous.sh | 1 + test/shell/lvmetad-client-filter.sh | 2 + test/shell/lvmetad-disabled.sh | 2 + test/shell/lvmetad-dump.sh | 2 + test/shell/lvmetad-lvm1.sh | 2 + test/shell/lvmetad-lvscan-cache.sh | 1 + test/shell/lvmetad-no-cluster.sh | 2 + test/shell/lvmetad-override.sh | 2 + test/shell/lvmetad-pvs.sh | 2 + test/shell/lvmetad-pvscan-cache.sh | 1 + test/shell/lvmetad-pvscan-filter.sh | 1 + test/shell/lvmetad-pvscan-md.sh | 1 + test/shell/lvmetad-pvscan-nomda.sh | 2 + test/shell/lvmetad-restart.sh | 2 + test/shell/lvmetad-test.sh | 2 + test/shell/lvmetad-warning.sh | 2 + test/shell/lvresize-mirror.sh | 2 + test/shell/lvresize-raid.sh | 2 + test/shell/lvresize-raid10.sh | 2 + test/shell/lvresize-rounding.sh | 2 + test/shell/lvresize-thin-external-origin.sh | 2 + test/shell/lvresize-thin-metadata.sh | 2 + test/shell/lvresize-usage.sh | 2 + test/shell/lvs-cache.sh | 2 + test/shell/mda-rollback.sh | 2 + test/shell/mdata-strings.sh | 2 + test/shell/metadata-balance.sh | 2 + test/shell/metadata-dirs.sh | 2 + test/shell/metadata.sh | 2 + test/shell/mirror-names.sh | 18 + test/shell/mirror-vgreduce-removemissing.sh | 2 + test/shell/name-mangling.sh | 1 + test/shell/nomda-missing.sh | 2 + test/shell/nomda-restoremissing.sh | 2 + test/shell/orphan-ondisk.sh | 2 + test/shell/pool-labels.sh | 1 + test/shell/process-each-duplicate-vgnames.sh | 2 + test/shell/process-each-lv.sh | 2 + test/shell/process-each-pv-nomda-all.sh | 2 + test/shell/process-each-pv-nomda.sh | 2 + test/shell/process-each-pv.sh | 2 + test/shell/process-each-pvresize.sh | 2 + test/shell/process-each-vg.sh | 2 + test/shell/profiles-thin.sh | 2 + test/shell/profiles.sh | 2 + test/shell/pv-duplicate-uuid.sh | 2 + test/shell/pv-duplicate.sh | 2 + test/shell/pv-min-size.sh | 2 + test/shell/pvchange-usage.sh | 2 + test/shell/pvcreate-bootloaderarea.sh | 2 + test/shell/pvcreate-ff.sh | 2 + test/shell/pvcreate-metadata0.sh | 2 + test/shell/pvcreate-operation-md.sh | 2 + test/shell/pvcreate-operation.sh | 2 + test/shell/pvcreate-usage.sh | 2 + test/shell/pvmove-restart.sh | 8 +- test/shell/pvmove-resume-1.sh | 64 ++- test/shell/pvmove-resume-2.sh | 42 +- test/shell/pvmove-resume-multiseg.sh | 48 ++- test/shell/pvremove-thin.sh | 2 + test/shell/pvremove-usage.sh | 2 + test/shell/pvremove-warnings.sh | 2 + test/shell/read-ahead.sh | 2 + test/shell/select-report.sh | 2 + test/shell/select-tools-thin.sh | 2 + test/shell/select-tools.sh | 2 + test/shell/snapshot-autoumount-dmeventd.sh | 2 + test/shell/snapshot-cluster.sh | 2 + test/shell/snapshot-lvm1.sh | 2 + test/shell/snapshot-maxsize.sh | 2 + test/shell/snapshot-reactivate.sh | 2 + test/shell/snapshot-rename.sh | 2 + test/shell/snapshot-usage-exa.sh | 2 + test/shell/snapshot-usage.sh | 2 + test/shell/stray-device-node.sh | 2 + test/shell/system_id.sh | 2 + test/shell/tags.sh | 2 + test/shell/test-partition.sh | 2 + test/shell/thin-autoumount-dmeventd.sh | 2 + test/shell/thin-defaults.sh | 2 + test/shell/thin-restore.sh | 2 + test/shell/thin-volume-list.sh | 2 + test/shell/topology-support.sh | 2 + test/shell/unknown-segment.sh | 2 + test/shell/unlost-pv.sh | 2 + test/shell/vg-name-from-env.sh | 2 + test/shell/vgcfgbackup-usage.sh | 2 + test/shell/vgchange-many.sh | 2 + test/shell/vgchange-maxlv.sh | 2 + test/shell/vgchange-partial.sh | 2 + test/shell/vgchange-sysinit.sh | 1 + test/shell/vgchange-usage.sh | 2 + test/shell/vgck.sh | 2 + test/shell/vgcreate-many-pvs.sh | 2 + test/shell/vgcreate-usage.sh | 2 + test/shell/vgextend-restoremissing.sh | 2 + test/shell/vgextend-usage.sh | 2 + test/shell/vgimportclone.sh | 2 + test/shell/vgmerge-operation.sh | 2 + test/shell/vgmerge-usage.sh | 2 + test/shell/vgreduce-usage.sh | 2 + test/shell/vgremove-corrupt-vg.sh | 2 + test/shell/vgrename-usage.sh | 2 + test/shell/vgsplit-operation.sh | 2 + test/shell/vgsplit-raid.sh | 2 + test/shell/vgsplit-stacked.sh | 2 + test/shell/vgsplit-thin.sh | 2 + test/shell/vgsplit-usage.sh | 2 + test/shell/zero-usage.sh | 2 + tools/Makefile.in | 3 +- tools/args.h | 2 + tools/commands.h | 16 + tools/lvpoll.c | 115 +++ tools/polldaemon.c | 181 +++++- tools/polldaemon.h | 93 --- tools/pvmove.c | 2 +- 228 files changed, 3640 insertions(+), 142 deletions(-)
WHATS_NEW +2 -0
@@ -1,5 +1,7 @@ Version 2.02.120 - =============================== + Add lvpoll for cmdline communication with lvmpolld. + Add lvmpolld acting as a free-standing version of polldaemon. Properly validate PV size for pvcreate --restorefile. Fix check if pvcreate wiped device (2.02.117). Fix storing of vgid when caching metadata (2.02.118).
conf/example.conf.in +10 -0
@@ -938,6 +938,16 @@ global { # Comments starting with the character # are ignored. # This configuration option does not have a default value defined. # system_id_file = "" + + # Indicates whether to use lvmpolld instead of classical polldaemon (a process + # forked off an initiating lvm command) or not. When set to 1 and native systemd + # service is installed in the system lvm starts using lvmpolld. lvmpolld gets + # auto-activated by systemd when a message lands on the respective lvmpolld socket. + # All commands that would require polling of in-progress operation are therefore + # spawned in lvmpolld's service cgroup. + # + # When set to 0 lvm falls back to classical polling. + use_lvmpolld = 0 } # Configuration section activation.
configure +44 -1
94 lines not on this page · raw message
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -13857,6 +13900,7 @@ do
"daemons/dmeventd/plugins/snapshot/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/plugins/snapshot/Makefile" ;;
"daemons/dmeventd/plugins/thin/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/plugins/thin/Makefile" ;;
"daemons/lvmetad/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmetad/Makefile" ;;
+ "daemons/lvmpolld/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmpolld/Makefile" ;;
"conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;;
"conf/example.conf") CONFIG_FILES="$CONFIG_FILES conf/example.conf" ;;
"conf/lvmlocal.conf") CONFIG_FILES="$CONFIG_FILES conf/lvmlocal.conf" ;;
@@ -13900,6 +13944,9 @@ do
"scripts/lvm2_lvmetad_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmetad_init_red_hat" ;;
"scripts/lvm2_lvmetad_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmetad_systemd_red_hat.service" ;;
"scripts/lvm2_lvmetad_systemd_red_hat.socket") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmetad_systemd_red_hat.socket" ;;
+ "scripts/lvm2_lvmpolld_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_init_red_hat" ;;
+ "scripts/lvm2_lvmpolld_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.service" ;;
+ "scripts/lvm2_lvmpolld_systemd_red_hat.socket") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.socket" ;;
"scripts/lvm2_monitoring_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_init_red_hat" ;;
"scripts/lvm2_monitoring_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_systemd_red_hat.service" ;;
"scripts/lvm2_pvscan_systemd_red_hat at .service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_pvscan_systemd_red_hat at .service" ;;configure.in +30 -0
@@ -39,6 +39,7 @@ case "$host_os" in LIB_SUFFIX=so DEVMAPPER=yes LVMETAD=no + LVMPOLLD=no ODIRECT=yes DM_IOCTLS=yes SELINUX=yes
@@ -1078,6 +1079,29 @@ if test "$BUILD_LVMETAD" = yes; then fi ################################################################################ +dnl -- Build lvmpolld +AC_MSG_CHECKING(whether to build lvmpolld) +AC_ARG_ENABLE(lvmpolld, + AC_HELP_STRING([--enable-lvmpolld], + [enable the LVM Polling Daemon]), + LVMPOLLD=$enableval) +AC_MSG_RESULT($LVMPOLLD) + +BUILD_LVMPOLLD=$LVMPOLLD + +if test "$BUILD_LVMPOLLD" = yes; then + AC_DEFINE([LVMPOLLD_SUPPORT], 1, [Define to 1 to include code that uses lvmpolld.]) + + AC_ARG_WITH(lvmpolld-pidfile, + AC_HELP_STRING([--with-lvmpolld-pidfile=PATH], + [lvmpolld pidfile [PID_DIR/lvmpolld.pid]]), + LVMPOLLD_PIDFILE=$withval, + LVMPOLLD_PIDFILE="$DEFAULT_PID_DIR/lvmpolld.pid") + AC_DEFINE_UNQUOTED(LVMPOLLD_PIDFILE, ["$LVMPOLLD_PIDFILE"], + [Path to lvmpolld pidfile.]) +fi + +################################################################################ dnl -- Enable blkid wiping functionality AC_MSG_CHECKING(whether to enable libblkid detection of signatures when wiping) AC_ARG_ENABLE(blkid_wiping,
@@ -1687,6 +1711,7 @@ AC_SUBST(BLKID_WIPING) AC_SUBST(BUILD_CMIRRORD) AC_SUBST(BUILD_DMEVENTD) AC_SUBST(BUILD_LVMETAD) +AC_SUBST(BUILD_LVMPOLLD) AC_SUBST(CACHE) AC_SUBST(CFLAGS) AC_SUBST(CFLOW_CMD)
@@ -1805,6 +1830,7 @@ AC_SUBST(VALGRIND_POOL) AC_SUBST(WRITE_INSTALL) AC_SUBST(DMEVENTD_PIDFILE) AC_SUBST(LVMETAD_PIDFILE) +AC_SUBST(LVMPOLLD_PIDFILE) AC_SUBST(CLVMD_PIDFILE) AC_SUBST(CMIRRORD_PIDFILE) AC_SUBST(interface)
@@ -1838,6 +1864,7 @@ daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile +daemons/lvmpolld/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf
@@ -1881,6 +1908,9 @@ scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket +scripts/lvm2_lvmpolld_init_red_hat +scripts/lvm2_lvmpolld_systemd_red_hat.service +scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/[email protected]
daemons/Makefile.in +7 -3
@@ -1,5 +1,5 @@ # -# Copyright (C) 2004-2011 Red Hat, Inc. All rights reserved. +# Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved. # # This file is part of LVM2. #
@@ -15,7 +15,7 @@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ top_builddir = @top_builddir@ -.PHONY: dmeventd clvmd cmirrord lvmetad +.PHONY: dmeventd clvmd cmirrord lvmetad lvmpolld ifneq ("@CLVMD@", "none") SUBDIRS += clvmd
@@ -36,8 +36,12 @@ ifeq ("@BUILD_LVMETAD@", "yes") SUBDIRS += lvmetad endif +ifeq ("@BUILD_LVMPOLLD@", "yes") + SUBDIRS += lvmpolld +endif + ifeq ($(MAKECMDGOALS),distclean) - SUBDIRS = clvmd cmirrord dmeventd lvmetad + SUBDIRS = clvmd cmirrord dmeventd lvmetad lvmpolld endif include $(top_builddir)/make.tmpl
daemons/lvmpolld/Makefile.in new file +49 -0
49 lines not on this page · raw message
daemons/lvmpolld/lvmpolld-cmd-utils.c new file +140 -0
140 lines not on this page · raw message
daemons/lvmpolld/lvmpolld-cmd-utils.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2015 Red Hat, Inc. +* +* This file is part of LVM2. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU Lesser General Public License v.2.1. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _LVM_LVMPOLLD_CMD_UTILS_H +#define _LVM_LVMPOLLD_CMD_UTILS_H + +#include "lvmpolld-data-utils.h" + +const char **cmdargv_ctr (const struct lvmpolld_lv *pdlv,const char *lvm_binary,unsigned abort,unsigned handle_missing_pvs); +const char **cmdenvp_ctr (const struct lvmpolld_lv *pdlv); + +const char *polling_op (enum poll_type ); + +#endif /* _LVM_LVMPOLLD_CMD_UTILS_H */
daemons/lvmpolld/lvmpolld-common.h new file +36 -0
@@ -0,0 +1,36 @@ +/* +* Copyright (C) 2010-2015 Red Hat, Inc. All rights reserved. +* +* This file is part of LVM2. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU Lesser General Public License v.2.1. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +/* +* This file must be included first by every lvmpolld source file. +*/ +#ifndef _LVM_LVMPOLLD_COMMON_H +#define _LVM_LVMPOLLD_COMMON_H + +#include "configure.h" + +#define _REENTRANT +#define _GNU_SOURCE +#define _FILE_OFFSET_BITS 64 + +#include "libdevmapper.h" + +#include "lvmpolld-cmd-utils.h" +#include "lvmpolld-protocol.h" + +#include <assert.h> +#include <errno.h> +#include <unistd.h> + +#endif /* _LVM_LVMPOLLD_COMMON_H */
daemons/lvmpolld/lvmpolld-core.c new file +817 -0
817 lines not on this page · raw message
daemons/lvmpolld/lvmpolld-data-utils.c new file +388 -0
388 lines not on this page · raw message
daemons/lvmpolld/lvmpolld-data-utils.h new file +215 -0
215 lines not on this page · raw message
daemons/lvmpolld/lvmpolld-protocol.h new file +49 -0
49 lines not on this page · raw message
daemons/lvmpolld/polling_ops.h new file +25 -0
@@ -0,0 +1,25 @@ +/* +* Copyright (C) 2014-2015 Red Hat, Inc. All rights reserved. +* +* This file is part of LVM2. +* +* This copyrighted material is made available to anyone wishing to use, +* modify, copy, or redistribute it subject to the terms and conditions +* of the GNU Lesser General Public License v.2.1. +* +* You should have received a copy of the GNU Lesser General Public License +* along with this program; if not, write to the Free Software Foundation, +* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +*/ + +#ifndef _LVM_TOOL_POLLING_OPS_H +#define _LVM_TOOL_POLLING_OPS_H + +/* this file is also part of lvmpolld protocol */ + +#define PVMOVE_POLL "pvmove" +#define CONVERT_POLL "convert" +#define MERGE_POLL "merge" +#define MERGE_THIN_POLL "merge_thin" + +#endif /* _LVM_TOOL_POLLING_OPS_H */
doc/lvmpolld_overview.txt new file +81 -0
81 lines not on this page · raw message
include/.symlinks.in +4 -0
@@ -1,6 +1,8 @@ @top_srcdir@/daemons/clvmd/clvm.h @top_srcdir@/daemons/dmeventd/libdevmapper-event.h @top_srcdir@/daemons/lvmetad/lvmetad-client.h + at top_srcdir@/daemons/lvmpolld/lvmpolld-protocol.h + at top_srcdir@/daemons/lvmpolld/polling_ops.h @top_srcdir@/liblvm/lvm2app.h @top_srcdir@/lib/activate/activate.h @top_srcdir@/lib/activate/targets.h
@@ -29,6 +31,8 @@ @top_srcdir@/lib/locking/locking.h @top_srcdir@/lib/log/log.h @top_srcdir@/lib/log/lvm-logging.h + at top_srcdir@/lib/lvmpolld/lvmpolld-client.h + at top_srcdir@/lib/lvmpolld/polldaemon.h @top_srcdir@/lib/metadata/lv.h @top_srcdir@/lib/metadata/lv_alloc.h @top_srcdir@/lib/metadata/metadata.h
lib/Makefile.in +5 -0
@@ -196,6 +196,11 @@ ifeq ("@BUILD_LVMETAD@", "yes") cache/lvmetad.c endif +ifeq ("@BUILD_LVMPOLLD@", "yes") + SOURCES +=\ + lvmpolld/lvmpolld-client.c +endif + ifeq ("@DMEVENTD@", "yes") CLDFLAGS += -L$(top_builddir)/daemons/dmeventd LIBS += -ldevmapper-event
lib/commands/toolcontext.c +11 -0
@@ -30,6 +30,7 @@#include "lvmcache.h" #include "lvmetad.h" #include "archiver.h" +#include "lvmpolld-client.h" #ifdef HAVE_LIBDL #include "sharedlib.h"
@@ -475,6 +476,7 @@ static int _process_config(struct cmd_context *cmd)const struct dm_config_value *cv;int64_t pv_min_kb;const char *lvmetad_socket; +const char *lvmpolld_socket;int udev_disabled =0 ;char sysfs_dir[PATH_MAX ];
@@ -618,6 +620,7 @@ static int _process_config(struct cmd_context *cmd) (find_config_tree_bool (cmd, global_detect_internal_vg_cache_corruption_CFG,NULL ));lvmetad_disconnect (); +lvmpolld_disconnect (); lvmetad_socket =getenv ("LVM_LVMETAD_SOCKET" );if (!lvmetad_socket)
@@ -644,6 +647,13 @@ static int _process_config(struct cmd_context *cmd)if (!_init_system_id (cmd)) return_0; + lvmpolld_socket =getenv ("LVM_LVMPOLLD_SOCKET" ); +if (!lvmpolld_socket) + lvmpolld_socket =DEFAULT_RUN_DIR "/lvmpolld.socket" ; +lvmpolld_set_socket (lvmpolld_socket); + +lvmpolld_set_active (find_config_tree_bool (cmd, global_use_lvmpolld_CFG,NULL )); +return 1 ; }
@@ -2065,6 +2075,7 @@ void destroy_toolcontext(struct cmd_context *cmd)lvmetad_release_token ();lvmetad_disconnect (); +lvmpolld_disconnect ();release_log_memory ();activation_exit ();
lib/config/config_settings.h +9 -0
@@ -920,6 +920,15 @@ cfg(activation_checks_CFG, "checks", activation_CFG_SECTION, 0, CFG_TYPE_BOOL, D "Some of the checks may be expensive, so it's best to use\n" "this only when there seems to be a problem.\n") +cfg (global_use_lvmpolld_CFG,"use_lvmpolld" , global_CFG_SECTION,0 ,CFG_TYPE_BOOL ,0 ,vsn (2 ,2 ,120 ),NULL ,0 ,NULL , +"Indicates whether to use lvmpolld instead of classical polldaemon (a process\n" +"forked off an initiating lvm command) or not. When set to 1 and native systemd\n" +"service is installed in the system lvm starts using lvmpolld. lvmpolld gets\n" +"auto-activated by systemd when a message lands on the respective lvmpolld socket.\n" +"All commands that would require polling of in-progress operation are therefore\n" +"spawned in lvmpolld's service cgroup.\n" + "When set to 0 lvm falls back to classical polling.\n") +cfg (activation_udev_sync_CFG,"udev_sync" , activation_CFG_SECTION,0 ,CFG_TYPE_BOOL ,DEFAULT_UDEV_SYNC ,vsn (2 ,2 ,51 ),NULL ,0 ,NULL ,"Use udev notifications to synchronize udev and LVM.\n" "When disabled, LVM commands will not wait for notifications\n"
lib/lvmpolld/lvmpolld-client.c new file +311 -0
311 lines not on this page · raw message
lib/lvmpolld/lvmpolld-client.h new file +52 -0
52 lines not on this page · raw message
lib/lvmpolld/polldaemon.h new file +93 -0
93 lines not on this page · raw message
lib/misc/configure.h.in +6 -0
@@ -500,6 +500,12 @@ /* Define to 1 to include code that uses lvmetad. */ #undef LVMETAD_SUPPORT +/* Path to lvmpolld pidfile. */ +#undef LVMPOLLD_PIDFILE + +/* Define to 1 to include code that uses lvmpolld. */ +#undef LVMPOLLD_SUPPORT + /* Path to lvm binary. */ #undef LVM_PATH
libdaemon/Makefile.in +1 -1
@@ -19,7 +19,7 @@ top_builddir = @top_builddir@ SUBDIRS += client -ifeq ("@BUILD_LVMETAD@", "yes") +ifeq (yes, $(shell test @BUILD_LVMETAD@ == yes -o @BUILD_LVMPOLLD@ == yes && echo yes)) SUBDIRS += server server: client endif
make.tmpl.in +1 -1
@@ -491,7 +491,7 @@ distclean: cleandir $(SUBDIRS.distclean) echo " local:"; echo " *;"; echo "};") > $@ ifeq (,$(findstring $(MAKECMDGOALS),cscope.out cflow clean distclean lcov \ - help check check_local check_cluster check_lvmetad)) + help check check_local check_cluster check_lvmetad check_lvmpolld)) ifdef SOURCES -include $(SOURCES:.c=.d) $(CXXSOURCES:.cpp=.d) endif
man/Makefile.in +7 -1
@@ -40,6 +40,12 @@ else LVMETAD = endif +ifeq ("@BUILD_LVMPOLLD@", "yes") +LVMPOLLD = lvmpolld.8 +else +LVMPOLLD = +endif + MAN5=lvm.conf.5 MAN7=lvmsystemid.7 MAN8=lvm-config.8 lvm-dumpconfig.8 \
@@ -50,7 +56,7 @@ MAN8=lvm-config.8 lvm-dumpconfig.8 \ pvresize.8 pvs.8 pvscan.8 vgcfgbackup.8 vgcfgrestore.8 vgchange.8 \ vgck.8 vgcreate.8 vgconvert.8 vgdisplay.8 vgexport.8 vgextend.8 \ vgimport.8 vgimportclone.8 vgmerge.8 vgmknodes.8 vgreduce.8 vgremove.8 \ - vgrename.8 vgs.8 vgscan.8 vgsplit.8 $(FSADMMAN) $(LVMETAD) + vgrename.8 vgs.8 vgscan.8 vgsplit.8 $(FSADMMAN) $(LVMETAD) $(LVMPOLLD) ifneq ("@CLVMD@", "none") MAN8CLUSTER=clvmd.8
man/lvm.8.in +6 -0
@@ -525,6 +525,12 @@ Path for the lvmetad pid file. .TP .B LVM_LVMETAD_SOCKET Path for the lvmetad socket file. +.TP +.B LVM_LVMPOLLD_PIDFILE +Path for the lvmpolld pid file. +.TP +.B LVM_LVMPOLLD_SOCKET +Path for the lvmpolld socket file. .SH FILES .I #DEFAULT_SYS_DIR#/lvm.conf .br
man/lvmpolld.8.in new file +86 -0
86 lines not on this page · raw message
scripts/.gitignore +3 -0
@@ -4,6 +4,9 @@ dm_event_systemd_red_hat.service lvm2_lvmetad_init_red_hat lvm2_lvmetad_systemd_red_hat.service lvm2_lvmetad_systemd_red_hat.socket +lvm2_lvmpolld_init_red_hat +lvm2_lvmpolld_systemd_red_hat.service +lvm2_lvmpolld_systemd_red_hat.socket lvm2_monitoring_init_red_hat lvm2_monitoring_systemd_red_hat.service lvm2_tmpfiles_red_hat.conf
scripts/Makefile.in +9 -0
@@ -75,6 +75,9 @@ endif ifeq ("@BUILD_LVMETAD@", "yes") $(INSTALL_SCRIPT) lvm2_lvmetad_init_red_hat $(initdir)/lvm2-lvmetad endif +ifeq ("@BUILD_LVMPOLLD@", "yes") + $(INSTALL_SCRIPT) lvm2_lvmpolld_init_red_hat $(initdir)/lvm2-lvmpolld +endif ifneq ("@CLVMD@", "none") $(INSTALL_SCRIPT) clvmd_init_red_hat $(initdir)/clvmd endif
@@ -114,6 +117,10 @@ ifeq ("@BUILD_LVMETAD@", "yes") $(INSTALL_DATA) lvm2_lvmetad_systemd_red_hat.service $(systemd_unit_dir)/lvm2-lvmetad.service $(INSTALL_DATA) lvm2_pvscan_systemd_red_hat at .service $(systemd_unit_dir)/lvm2-pvscan at .service endif +ifeq ("@BUILD_LVMPOLLD@", "yes") + $(INSTALL_DATA) lvm2_lvmpolld_systemd_red_hat.socket $(systemd_unit_dir)/lvm2-lvmpolld.socket + $(INSTALL_DATA) lvm2_lvmpolld_systemd_red_hat.service $(systemd_unit_dir)/lvm2-lvmpolld.service +endif ifneq ("@CLVMD@", "none") $(INSTALL_DATA) lvm2_clvmd_systemd_red_hat.service $(systemd_unit_dir)/lvm2-clvmd.service $(INSTALL_DATA) lvm2_cluster_activation_systemd_red_hat.service $(systemd_unit_dir)/lvm2-cluster-activation.service
@@ -142,6 +149,8 @@ DISTCLEAN_TARGETS += \ lvm2_lvmetad_init_red_hat \ lvm2_lvmetad_systemd_red_hat.service \ lvm2_lvmetad_systemd_red_hat.socket \ + lvm2_lvmpolld_systemd_red_hat.service \ + lvm2_lvmpolld_systemd_red_hat.socket \ lvm2_monitoring_init_red_hat \ lvm2_monitoring_systemd_red_hat.service \ lvm2_pvscan_systemd_red_hat at .service \
scripts/lvm2_lvmpolld_init_red_hat.in new file +114 -0
114 lines not on this page · raw message
scripts/lvm2_lvmpolld_systemd_red_hat.service.in new file +17 -0
@@ -0,0 +1,17 @@ +[Unit] +Description=LVM2 poll daemon +Documentation=man:lvmpolld(8) +Requires=lvm2-lvmpolld.socket +After=lvm2-lvmpolld.socket +DefaultDependencies=no +Conflicts=shutdown.target + +[Service] +Type=simple +NonBlocking=true +ExecStart=@sbindir@/lvmpolld -t 60 -f +Environment=SD_ACTIVATION=1 +PIDFile=@LVMPOLLD_PIDFILE@ + +[Install] +WantedBy=sysinit.target
scripts/lvm2_lvmpolld_systemd_red_hat.socket.in new file +12 -0
@@ -0,0 +1,12 @@ +[Unit] +Description=LVM2 poll daemon socket +Documentation=man:lvmpolld(8) +DefaultDependencies=no + +[Socket] +ListenStream=@DEFAULT_RUN_DIR@/lvmpolld.socket +SocketMode=0600 +RemoveOnStop=true + +[Install] +WantedBy=sysinit.target
scripts/lvmdump.sh +22 -2
@@ -1,7 +1,7 @@ #!/bin/bash # We use some bash-isms (getopts?) -# Copyright (C) 2007-2010 Red Hat, Inc. All rights reserved. +# Copyright (C) 2007-2015 Red Hat, Inc. All rights reserved. # # This file is part of LVM2. #
@@ -41,6 +41,7 @@ NC=nc LVM=${LVM_BINARY-lvm} DMSETUP=${DMSETUP_BINARY-dmsetup} LVMETAD_SOCKET=${LVM_LVMETAD_SOCKET-/var/run/lvm/lvmetad.socket} +LVMPOLLD_SOCKET=${LVM_LVMPOLLD_SOCKET-/var/run/lvm/lvmpolld.socket} die() { code=$1; shift
@@ -59,6 +60,7 @@ function usage { echo " -c if running clvmd, gather cluster data as well" echo " -d <directory> dump into a directory instead of tarball" echo " -l gather lvmetad state if running" + echo " -p gather lvmpolld state if running" echo " -m gather LVM metadata from the PVs" echo " -s gather system info and context" echo " -u gather udev info and context"
@@ -72,13 +74,14 @@ clustered=0 metadata=0 sysreport=0 udev=0 -while getopts :acd:hlmus opt; do +while getopts :acd:hlpmus opt; do case $opt in a) advanced=1 ;; c) clustered=1 ;; d) userdir=$OPTARG ;; h) usage ;; l) lvmetad=1 ;; + p) lvmpolld=1 ;; m) metadata=1 ;; s) sysreport=1 ;; u) udev=1 ;;
@@ -236,6 +239,7 @@ if (( $metadata )); then done fi +# FIXME: add lvmpolld.service here if (( $sysreport )); then myecho "Gathering system info..."
@@ -296,6 +300,22 @@ if (( $lvmetad )); then } > "$dir/lvmetad.txt" fi +if (( $lvmpolld )); then + (echo 'request="dump"'; echo '##') | { + if type -p $SOCAT >& /dev/null; then + echo "$SOCAT unix-connect:$LVMPOLLD_SOCKET -" >> "$log" + $SOCAT "unix-connect:$LVMPOLLD_SOCKET" - 2>> "$log" + elif echo | $NC -U "$LVMPOLLD_SOCKET"; then + echo "$NC -U $LVMPOLLD_SOCKET" >> "$log" + $NC -U "$LVMPOLLD_SOCKET" 2>> "$log" + else + myecho "WARNING: Neither socat nor nc -U seems to be available." 1>&2 + echo "# DUMP FAILED" + return 1 + fi + } > "$dir/lvmpolld.txt" +fi + if test -z "$userdir"; then lvm_dump="$dirbase.tgz" myecho "Creating report tarball in $HOME/$lvm_dump..."
test/Makefile.in +24 -4
@@ -56,6 +56,11 @@ LVMETAD_NDEV_FLAVOUR = ,ndev-lvmetad LVMETAD_UDEV_FLAVOUR = ,udev-lvmetad endif +ifeq ("@BUILD_LVMPOLLD@", "yes") +LVMPOLLD_RUN_BASE = $(RUN_BASE) +LVMPOLLD_NDEV_FLAVOUR = ,ndev-lvmpolld,ndev-cluster-lvmpolld,ndev-lvmetad-lvmpolld +LVMPOLLD_UDEV_FLAVOUR = ,udev-lvmpolld,udev-cluster-lvmpolld,udev-lvmetad-lvmpolld +endif # Shell quote; SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
@@ -73,6 +78,7 @@ help: @echo " check_local Run tests without clvmd and lvmetad." @echo " check_cluster Run tests with cluster daemon." @echo " check_lvmetad Run tests with lvmetad daemon." + @echo " check_lvmpolld Run tests with lvmpolld daemon." @echo " clean Clean dir." @echo " help Display callable targets." @echo -e "\nSupported variables:"
@@ -83,6 +89,7 @@ help: @echo " LVM_TEST_LOCKING Normal (1), Cluster (3)." @echo " LVM_TEST_LVMETAD Start lvmetad (1)." @echo " LVM_TEST_LVMETAD_DEBUG_OPTS Allows to override debug opts [-l all]." + @echo " LVM_TEST_LVMPOLLD Start lvmpolld" @echo " LVM_TEST_NODEBUG Do not debug lvm commands." @echo " LVM_TEST_PARALLEL May skip agresive wipe of LVMTEST resources." @echo " LVM_TEST_RESULTS Where to create result files [results]."
@@ -109,12 +116,12 @@ help: check: .tests-stamp VERBOSE=$(VERBOSE) ./lib/runner \ --testdir . --outdir $(LVM_TEST_RESULTS) \ - --flavours ndev-vanilla,ndev-cluster$(LVMETAD_NDEV_FLAVOUR) --only $(T) --skip $(S) + --flavours ndev-vanilla,ndev-cluster$(LVMETAD_NDEV_FLAVOUR)$(LVMPOLLD_NDEV_FLAVOUR) --only $(T) --skip $(S) check_system: .tests-stamp VERBOSE=$(VERBOSE) ./lib/runner \ --testdir . --outdir $(LVM_TEST_RESULTS) \ - --flavours udev-vanilla,udev-cluster$(LVMETAD_UDEV_FLAVOUR) --only $(T) --skip $(S)
Lines of this file are not shown. View the raw message.
test/lib/aux.sh +93 -7
100 lines not on this page · raw message
test/lib/flavour-ndev-cluster-lvmpolld.sh new file +2 -0
Lines of this file are not shown. View the raw message.
test/lib/flavour-ndev-lvmetad-lvmpolld.sh new file +3 -0
Lines of this file are not shown. View the raw message.
test/lib/flavour-ndev-lvmpolld.sh new file +2 -0
Lines of this file are not shown. View the raw message.
test/lib/flavour-udev-cluster-lvmpolld.sh new file +3 -0
Lines of this file are not shown. View the raw message.
test/lib/flavour-udev-lvmetad-lvmpolld.sh new file +4 -0
Lines of this file are not shown. View the raw message.
test/lib/flavour-udev-lvmpolld.sh new file +3 -0
Lines of this file are not shown. View the raw message.
test/shell/lvconvert-raid-allocation.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvconvert-repair-dmeventd.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvconvert-repair-raid-dmeventd.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvconvert-repair-snapshot.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvconvert-repair-transient-dmeventd.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvconvert-repair-transient.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvcreate-signature-wiping.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvextend-snapshot-dmeventd.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvextend-thin-metadata-dmeventd.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/lvresize-thin-external-origin.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/mirror-vgreduce-removemissing.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/process-each-duplicate-vgnames.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/process-each-pv-nomda-all.sh +2 -0
Lines of this file are not shown. View the raw message.
test/shell/pvmove-resume-1.sh +56 -8
64 lines not on this page · raw message
test/shell/pvmove-resume-2.sh +36 -6
42 lines not on this page · raw message
test/shell/pvmove-resume-multiseg.sh +42 -6
48 lines not on this page · raw message
test/shell/snapshot-autoumount-dmeventd.sh +2 -0
Lines of this file are not shown. View the raw message.
tools/lvpoll.c new file +115 -0
115 lines not on this page · raw message
tools/polldaemon.c +177 -4
181 lines not on this page · raw message
tools/polldaemon.h deleted +0 -93
93 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Part of the diff is not shown here. View the raw message.