master - scripts: introduce blkdeactivate
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c698ee14bbb1310cf2383c8977d14a8e29139f8c Commit: c698ee14bbb1310cf2383c8977d14a8e29139f8c Parent: f8781ea6a0567940f3dd3de78870be3ae880d909 Author: Peter Rajnoha <[email protected]> AuthorDate: Fri Oct 12 14:37:57 2012 +0200 Committer: Peter Rajnoha <[email protected]> CommitterDate: Fri Oct 12 14:44:24 2012 +0200
scripts: introduce blkdeactivate
blkdeactivate - utility to deactivate block devices
Traverses the tree of block devices and tries to deactivate them. Currently, it supports device-mapper-based devices together with LVM. See man/blkdeactivate.8 for more info.
It is targeted for use during shutdown to properly deactivate the whole block device stack - systemd and init scripts are provided as well. However, it might be used directly on command line too.
Please, see the commentary at the top of the blkdeactivate script for dependencies and versions of other utilities required.
--- configure.in | 13 + man/Makefile.in | 10 +- man/blkdeactivate.8.in | 72 +++++ scripts/Makefile.in | 10 + scripts/blk_availability_init_red_hat.in | 58 ++++ .../blk_availability_systemd_red_hat.service.in | 14 + scripts/blkdeactivate.sh.in | 313 ++++++++++++++++++++ 7 files changed, 488 insertions(+), 2 deletions(-)
configure.in +13 -0
@@ -44,6 +44,7 @@ case "$host_os" in SELINUX=yes CLUSTER=internal FSADM=yes + BLKDEACTIVATE=yes ;; darwin*) CFLAGS="$CFLAGS -no-cpp-precomp -fno-common"
@@ -59,6 +60,7 @@ case "$host_os" in SELINUX=no CLUSTER=none FSADM=no + BLKDEACTIVATE=no ;; esac
@@ -1081,6 +1083,13 @@ AC_ARG_ENABLE(fsadm, AC_HELP_STRING([--disable-fsadm], [disable fsadm]), AC_MSG_RESULT($FSADM) ################################################################################ +dnl -- Enable blkdeactivate +AC_MSG_CHECKING(whether to install blkdeactivate) +AC_ARG_ENABLE(blkdeactivate, AC_HELP_STRING([--disable-blkdeactivate], [disable blkdeactivate]), + BLKDEACTIVATE=$enableval) +AC_MSG_RESULT($BLKDEACTIVATE) + +################################################################################ dnl -- enable dmeventd handling AC_MSG_CHECKING(whether to use dmeventd) AC_ARG_ENABLE(dmeventd, AC_HELP_STRING([--enable-dmeventd],
@@ -1531,6 +1540,7 @@ AC_SUBST(DM_LIB_VERSION) AC_SUBST(DM_LIB_PATCHLEVEL) AC_SUBST(ELDFLAGS) AC_SUBST(FSADM) +AC_SUBST(BLKDEACTIVATE) AC_SUBST(HAVE_LIBDL) AC_SUBST(HAVE_REALTIME) AC_SUBST(INTL)
@@ -1645,6 +1655,9 @@ man/Makefile po/Makefile python/Makefile python/setup.py +scripts/blkdeactivate.sh +scripts/blk_availability_init_red_hat +scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/lvm2_lvmetad_init_red_hat
man/Makefile.in +8 -2
@@ -22,6 +22,12 @@ else FSADMMAN = endif +ifeq ("@BLKDEACTIVATE@", "yes") +BLKDEACTIVATEMAN = blkdeactivate.8 +else +BLKDEACTIVATEMAN = +endif + ifeq ("@DMEVENTD@", "yes") DMEVENTDMAN = dmeventd.8 else
@@ -42,7 +48,7 @@ MAN8=lvchange.8 lvconvert.8 lvcreate.8 lvdisplay.8 lvextend.8 lvm.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) $(BLKDEACTIVATEMAN) $(LVMETAD) ifneq ("@CLVMD@", "none") MAN8CLUSTER=clvmd.8
@@ -57,7 +63,7 @@ MAN8DM=dmsetup.8 $(DMEVENTDMAN) MAN5DIR=$(mandir)/man5 MAN8DIR=$(mandir)/man8 -CLEAN_TARGETS=$(MAN5) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN) $(DMEVENTDMAN) $(MAN8DM) +CLEAN_TARGETS=$(MAN5) $(MAN8) $(MAN8CLUSTER) $(FSADMMAN) $(BLKDEACTIVATEMAN) $(DMEVENTDMAN) $(MAN8DM) DISTCLEAN_TARGETS=fsadm.8 clvmd.8 cmirrord.8 dmeventd.8 include $(top_builddir)/make.tmpl
man/blkdeactivate.8.in new file +72 -0
72 lines not on this page · raw message
scripts/Makefile.in +10 -0
@@ -38,6 +38,10 @@ ifeq ("@FSADM@", "yes") SCRIPTS += fsadm.sh endif +ifeq ("@BLKDEACTIVATE@", "yes") + SCRIPTS += blkdeactivate.sh +endif + OCF_SCRIPTS = ifeq ("@OCF@", "yes") OCF_SCRIPTS += VolumeGroup.ocf
@@ -74,6 +78,9 @@ endif ifeq ("@BUILD_CMIRRORD@", "yes") $(INSTALL_SCRIPT) cmirrord_init_red_hat $(initdir)/cmirrord endif +ifeq ("@BLKDEACTIVATE@", "yes") + $(INSTALL_SCRIPT) blk_availability_init_red_hat $(initdir)/blk-availability +endif lvm2_activation_generator_systemd_red_hat: $(OBJECTS) $(DEPLIBS) $(CC) -o $@ $(OBJECTS) $(LDFLAGS) $(LVMLIBS)
@@ -94,6 +101,9 @@ ifeq ("@BUILD_DMEVENTD@", "yes") $(INSTALL_DATA) dm_event_systemd_red_hat.service $(systemd_unit_dir)/dm-event.service $(INSTALL_DATA) lvm2_monitoring_systemd_red_hat.service $(systemd_unit_dir)/lvm2-monitor.service endif +ifeq ("@BLKDEACTIVATE@", "yes") + $(INSTALL_DATA) blk_availability_systemd_red_hat.service $(systemd_unit_dir)/blk-availability.service +endif ifeq ("@BUILD_LVMETAD@", "yes") $(INSTALL_DATA) lvm2_lvmetad_systemd_red_hat.socket $(systemd_unit_dir)/lvm2-lvmetad.socket $(INSTALL_DATA) lvm2_lvmetad_systemd_red_hat.service $(systemd_unit_dir)/lvm2-lvmetad.service
scripts/blk_availability_init_red_hat.in new file +58 -0
58 lines not on this page · raw message
scripts/blk_availability_systemd_red_hat.service.in new file +14 -0
@@ -0,0 +1,14 @@ +[Unit] +Description=Availability of block devices +After=lvm2-activation.service lvm2-lvmetad.service iscsi.service iscsid.service +DefaultDependencies=no +Conflicts=shutdown.target + +[Service] +Type=oneshot +ExecStart=/usr/bin/true +ExecStop=@sbindir@/blkdeactivate -u -l wholevg +RemainAfterExit=yes + +[Install] +WantedBy=sysinit.target
scripts/blkdeactivate.sh.in new file +313 -0
313 lines not on this page · raw message