diff options
author | Christian Zoffoli <xmerlin@gentoo.org> | 2008-03-17 19:15:53 +0000 |
---|---|---|
committer | Christian Zoffoli <xmerlin@gentoo.org> | 2008-03-17 19:15:53 +0000 |
commit | d97f5238eb1a805bdbd3fad783005e2fd02ce22a (patch) | |
tree | 824560a038b268d1f2eee6d002dbae3ea29f3588 /sys-fs | |
parent | e2fsprogs-1.40.4 also needs tls disabled on uClibc. (diff) | |
download | gentoo-2-d97f5238eb1a805bdbd3fad783005e2fd02ce22a.tar.gz gentoo-2-d97f5238eb1a805bdbd3fad783005e2fd02ce22a.tar.bz2 gentoo-2-d97f5238eb1a805bdbd3fad783005e2fd02ce22a.zip |
Version bump, clvm-2.02.33 will be the starting point to merge clvm in lvm, everything before 2.02.33 will be removed soon.
(Portage version: 2.1.4.4)
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/clvm/ChangeLog | 14 | ||||
-rw-r--r-- | sys-fs/clvm/clvm-2.01.15.ebuild | 10 | ||||
-rw-r--r-- | sys-fs/clvm/clvm-2.02.09.ebuild | 10 | ||||
-rw-r--r-- | sys-fs/clvm/clvm-2.02.33.ebuild | 117 | ||||
-rwxr-xr-x | sys-fs/clvm/files/clvmd.rc-2.02.33-xm | 146 | ||||
-rw-r--r-- | sys-fs/clvm/files/lvm.conf-2.02.33.patch | 89 | ||||
-rw-r--r-- | sys-fs/clvm/files/lvm.confd-2.02.28-r2 | 5 | ||||
-rw-r--r-- | sys-fs/clvm/files/lvm.rc-2.02.28-r2 | 29 | ||||
-rw-r--r-- | sys-fs/clvm/files/lvm2-start.sh-2.02.33-xm | 34 | ||||
-rwxr-xr-x | sys-fs/clvm/files/lvm2-stop.sh-2.02.33-xm | 61 |
10 files changed, 503 insertions, 12 deletions
diff --git a/sys-fs/clvm/ChangeLog b/sys-fs/clvm/ChangeLog index 9edb4192a62f..39199f116d66 100644 --- a/sys-fs/clvm/ChangeLog +++ b/sys-fs/clvm/ChangeLog @@ -1,6 +1,16 @@ # ChangeLog for sys-fs/clvm -# Copyright 1999-2007 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/ChangeLog,v 1.21 2007/04/26 07:37:23 dberkholz Exp $ +# Copyright 1999-2008 Gentoo Foundation; Distributed under the GPL v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/ChangeLog,v 1.22 2008/03/17 19:15:52 xmerlin Exp $ + +*clvm-2.02.33 (17 Mar 2008) + + 17 Mar 2008; Christian Zoffoli <xmerlin@gentoo.org> + +files/lvm.confd-2.02.28-r2, +files/lvm.rc-2.02.28-r2, + +files/clvmd.rc-2.02.33-xm, +files/lvm2-start.sh-2.02.33-xm, + +files/lvm2-stop.sh-2.02.33-xm, +files/lvm.conf-2.02.33.patch, + clvm-2.01.15.ebuild, clvm-2.02.09.ebuild, +clvm-2.02.33.ebuild: + Version bump, clvm-2.02.33 will be the starting point to merge clvm in lvm, + everything before 2.02.33 will be removed soon. 26 Apr 2007; Donnie Berkholz <dberkholz@gentoo.org>; metadata.xml: Update for cluster herd split to hp-cluster and ha-cluster. diff --git a/sys-fs/clvm/clvm-2.01.15.ebuild b/sys-fs/clvm/clvm-2.01.15.ebuild index 82aee1eff58a..e8954a0ce138 100644 --- a/sys-fs/clvm/clvm-2.01.15.ebuild +++ b/sys-fs/clvm/clvm-2.01.15.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/clvm-2.01.15.ebuild,v 1.6 2006/10/18 10:41:06 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/clvm-2.01.15.ebuild,v 1.7 2008/03/17 19:15:52 xmerlin Exp $ MY_P="${PN/clvm/LVM2}.${PV}" @@ -44,10 +44,10 @@ src_install() { dodoc COPYING* INSTALL README VERSION WHATS_NEW doc/*.{conf,c,txt} - newinitd ${FILESDIR}/clvmd.rc clvmd || die + newinitd "${FILESDIR}"/clvmd.rc clvmd || die insinto /lib/rcscripts/addons - newins ${FILESDIR}/lvm2-start.sh lvm-start.sh || die - newins ${FILESDIR}/lvm2-stop.sh lvm-stop.sh || die + newins "${FILESDIR}"/lvm2-start.sh lvm-start.sh || die + newins "${FILESDIR}"/lvm2-stop.sh lvm-stop.sh || die } diff --git a/sys-fs/clvm/clvm-2.02.09.ebuild b/sys-fs/clvm/clvm-2.02.09.ebuild index 5180361e11cf..cbef399c9fe4 100644 --- a/sys-fs/clvm/clvm-2.02.09.ebuild +++ b/sys-fs/clvm/clvm-2.02.09.ebuild @@ -1,6 +1,6 @@ -# Copyright 1999-2006 Gentoo Foundation +# Copyright 1999-2008 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/clvm-2.02.09.ebuild,v 1.3 2006/10/18 10:41:06 xmerlin Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/clvm-2.02.09.ebuild,v 1.4 2008/03/17 19:15:52 xmerlin Exp $ MY_P="${PN/clvm/LVM2}.${PV}" @@ -47,9 +47,9 @@ src_install() { dodoc COPYING* INSTALL README VERSION WHATS_NEW doc/*.{conf,c,txt} - newinitd ${FILESDIR}/clvmd.rc clvmd || die + newinitd "${FILESDIR}"/clvmd.rc clvmd || die insinto /lib/rcscripts/addons - newins ${FILESDIR}/lvm2-start.sh lvm-start.sh || die - newins ${FILESDIR}/lvm2-stop.sh lvm-stop.sh || die + newins "${FILESDIR}"/lvm2-start.sh lvm-start.sh || die + newins "${FILESDIR}"/lvm2-stop.sh lvm-stop.sh || die } diff --git a/sys-fs/clvm/clvm-2.02.33.ebuild b/sys-fs/clvm/clvm-2.02.33.ebuild new file mode 100644 index 000000000000..cc323f67ff5b --- /dev/null +++ b/sys-fs/clvm/clvm-2.02.33.ebuild @@ -0,0 +1,117 @@ +# Copyright 1999-2008 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/clvm-2.02.33.ebuild,v 1.1 2008/03/17 19:15:52 xmerlin Exp $ + +inherit eutils multilib + +MY_P="${PN/clvm/LVM2}.${PV}" + +DESCRIPTION="User-land utilities for LVM2 (device-mapper) software." +HOMEPAGE="http://sources.redhat.com/lvm2/" +SRC_URI="ftp://sources.redhat.com/pub/lvm2/${MY_P}.tgz" + +LICENSE="GPL-2" +SLOT="0" +KEYWORDS="~amd64 ~x86" + +IUSE="readline static selinux" + +DEPEND=">=sys-fs/device-mapper-1.02.24 + =sys-cluster/dlm-2* + =sys-cluster/cman-2* + " + +RDEPEND="${DEPEND} + !sys-fs/lvm-user + !sys-fs/lvm2" + +S="${WORKDIR}/${MY_P}" + +src_unpack() { + unpack ${A} + epatch "${FILESDIR}"/lvm.conf-2.02.33.patch || die +} + +src_compile() { + # Static compile of lvm2 so that the install described in the handbook works + # http://www.gentoo.org/doc/en/lvm2.xml + # fixes http://bugs.gentoo.org/show_bug.cgi?id=84463 + local myconf + local buildmode + + # fsadm is broken, don't include it (2.02.28) + myconf="${myconf} --enable-dmeventd --enable-cmdlib" + + # Most of this package does weird stuff. + # The build options are tristate, and --without is NOT supported + # options: 'none', 'internal', 'shared' + if use static ; then + einfo "Building static LVM, for usage inside genkernel" + myconf="${myconf} --enable-static_link" + buildmode="internal" + else + ewarn "Building shared LVM, it will not work inside genkernel!" + buildmode="shared" + fi + + # dmeventd requires mirrors to be internal, and snapshot available + # so we cannot disable them + myconf="${myconf} --with-mirrors=internal" + myconf="${myconf} --with-snapshots=internal" + + myconf="${myconf} --with-lvm1=none" + + # disable O_DIRECT support on hppa, breaks pv detection (#99532) + use hppa && myconf="${myconf} --disable-o_direct" + + myconf="${myconf} --with-cluster=${buildmode}" + # 4-state! + myconf="${myconf} --with-clvmd=cman" + myconf="${myconf} --with-pool=${buildmode}" + + myconf="${myconf} --sbindir=/sbin --with-staticdir=/sbin" + econf $(use_enable readline) \ + $(use_enable selinux) \ + --libdir=/usr/$(get_libdir) \ + ${myconf} \ + CLDFLAGS="${LDFLAGS}" || die + emake || die "compile problem" +} + +src_install() { + emake DESTDIR="${D}" install + # TODO: At some point in the future, we need to stop installing the static + # as the /sbin/lvm name, and have both variants seperate. + if use static; then + cp -f "${D}"/sbin/lvm.static "${D}"/sbin/lvm \ + || die "Failed to copy lvm.static" + fi + + dodir /$(get_libdir) + # Put these in root so we can reach before /usr is up + for i in libdevmapper-event-lvm2mirror liblvm2{format1,snapshot} ; do + b="${D}"/usr/$(get_libdir)/${i} + if [ -f "${b}".so ]; then + mv -f "${b}".so* "${D}"/$(get_libdir) || die + fi + done + + dodoc README VERSION WHATS_NEW doc/*.{conf,c,txt} + insinto /lib/rcscripts/addons + newins "${FILESDIR}"/lvm2-start.sh-2.02.33-xm lvm-start.sh || die + newins "${FILESDIR}"/lvm2-stop.sh-2.02.33-xm lvm-stop.sh || die + newinitd "${FILESDIR}"/lvm.rc-2.02.28-r2 lvm || die + newconfd "${FILESDIR}"/lvm.confd-2.02.28-r2 lvm || die + newinitd "${FILESDIR}"/clvmd.rc-2.02.33-xm clvmd || die + + elog "" + elog "Rebuild your genkernel initramfs if you are using lvm" + use nolvmstatic && \ + elog "USE=nolvmstatic has changed to USE=static via package.use" +} + +pkg_postinst() { + elog "lvm volumes are no longer automatically created for" + elog "baselayout-2 users. If you are using baselayout-2, be sure to" + elog "run: # rc-update add lvm boot" +} diff --git a/sys-fs/clvm/files/clvmd.rc-2.02.33-xm b/sys-fs/clvm/files/clvmd.rc-2.02.33-xm new file mode 100755 index 000000000000..6e97248c1ae5 --- /dev/null +++ b/sys-fs/clvm/files/clvmd.rc-2.02.33-xm @@ -0,0 +1,146 @@ +#!/sbin/runscript +# Copyright 1999-2005 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/files/clvmd.rc-2.02.33-xm,v 1.1 2008/03/17 19:15:53 xmerlin Exp $ + +CLVM_BIN="/sbin/clvmd" +VGCHANGE="/sbin/vgchange" +VGSCAN="/sbin/vgscan" +VGDISPLAY="/sbin/vgdisplay" + +depend() { + use dns logger + use net + need cman +} + +load_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Loading ${module} kernel module" + modprobe ${module} + eend $? "Failed to load ${module} kernel module" + done +} + +unload_modules() { + local module modules + modules=$1 + + for module in ${modules}; do + ebegin "Unloading ${module} kernel module" + modprobe -r ${module} + eend $? "Failed to unload ${module} kernel module" + done +} + +umount_gfs_filesystems() { + local sig retry + local remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)" + + if [ -n "${remaining}" ] + then + sig= + retry=3 + while [ -n "${remaining}" -a "${retry}" -gt 0 ] + do + if [ "${retry}" -lt 3 ] + then + ebegin "Unmounting GFS filesystems (retry)" + umount ${remaining} &>/dev/null + eend $? "Failed to unmount GFS filesystems this retry" + else + ebegin "Unmounting GFS filesystems" + umount ${remaining} &>/dev/null + eend $? "Failed to unmount GFS filesystems" + fi + remaining="$(awk '$3 == "gfs" { print $2 }' /proc/mounts | sort -r)" + [ -z "${remaining}" ] && break + /bin/fuser -k -m ${sig} ${remaining} &>/dev/null + sleep 5 + retry=$((${retry} -1)) + sig=-9 + done + fi +} + +start() { + + local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/{modules,devices}) + + if [ -z "${module}" ]; then + load_modules "dm-mod" + sleep 1s + fi + + ebegin "Starting clvmd" + start-stop-daemon --start --quiet --exec ${CLVM_BIN} + eend $? + + ebegin "Scanning LVM volumes" + ${VGSCAN} &>/dev/null + eend $? + + #if [ "$?" -eq 0 ] && [ -x /sbin/vgchange ] && [ -f /etc/lvmtab -o -d /etc/lvm ] + #then + # ebegin "Setting up the Logical Volume Manager" + # /sbin/vgchange -aly >/dev/null + # eend $? "Failed to setup the LVM" + #fi + + if [ -n "$LVM_VGS" ] + then + for vg in $LVM_VGS + do + ebegin " Activating VG: ${vg} " + $VGCHANGE -ayl ${vg} >/dev/null + eend $? + done + else + clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'` + for vg in $clustervgs; do + ebegin " Activating Clustered VG: ${vg} " + $VGCHANGE -ayl ${vg} >/dev/null + eend $? + done + fi +} + +stop() { + + # umount GFS filesystems + #umount_gfs_filesystems + + #for rtrn in 0 + #do + if [ -n "$LVM_VGS" ] + then + for vg in $LVM_VGS + do + ebegin " Shutting Down VG: ${vg} " + $VGCHANGE -anl ${vg} >/dev/null + eend $? + done + else + # Deactivate only clustered volumes + clustervgs=`$VGDISPLAY 2> /dev/null | awk 'BEGIN {RS="VG Name"} {if (/Clustered/) print $1;}'` + for vg in $clustervgs; do + ebegin " Shutting Down Clustered VG: ${vg} " + $VGCHANGE -anl ${vg} >/dev/null + eend $? + done + fi + + ebegin "Stopping clvmd" + #start-stop-daemon --stop -s 9 --quiet --exec ${CLVM_BIN} --name clvmd + killall -TERM ${CLVM_BIN} >/dev/null + eend $? + + local module=$(awk '$1 == "dm_mod" { print $1 }' /proc/modules) + + if [[ "$?" -eq 0 && ! -z "${module}" ]]; then + unload_modules "dm-mod" + fi +} diff --git a/sys-fs/clvm/files/lvm.conf-2.02.33.patch b/sys-fs/clvm/files/lvm.conf-2.02.33.patch new file mode 100644 index 000000000000..dd80f8b0fbb8 --- /dev/null +++ b/sys-fs/clvm/files/lvm.conf-2.02.33.patch @@ -0,0 +1,89 @@ +diff -Nuar --exclude '*.rej' --exclude '*.orig' LVM2.2.02.33.orig/doc/example.conf LVM2.2.02.33/doc/example.conf +--- LVM2.2.02.33.orig/doc/example.conf 2008-01-09 07:32:19.000000000 -0800 ++++ LVM2.2.02.33/doc/example.conf 2008-02-06 17:39:20.439958042 -0800 +@@ -49,7 +49,9 @@ + + + # By default we accept every block device: +- filter = [ "a/.*/" ] ++ # Gentoo: we exclude /dev/nbd by default, because it makes a lot of kernel ++ # noise when you probed while not available. ++ filter = [ "r|/dev/nbd.*|", "a/.*/" ] + + # Exclude the cdrom drive + # filter = [ "r|/dev/cdrom|" ] +@@ -85,7 +87,7 @@ + # If sysfs is mounted (2.6 kernels) restrict device scanning to + # the block devices it believes are valid. + # 1 enables; 0 disables. +- sysfs_scan = 1 ++ sysfs_scan = 1 + + # By default, LVM2 will ignore devices used as components of + # software RAID (md) devices by looking for md superblocks. +@@ -218,12 +220,14 @@ + # e.g. vgscan.lvm1 and they will stop working after you start using + # the new lvm2 on-disk metadata format. + # The default value is set when the tools are built. +- # fallback_to_lvm1 = 0 ++ # Gentoo: the LVM tools are a seperate package. ++ fallback_to_lvm1 = 0 + + # The default metadata format that commands should use - "lvm1" or "lvm2". + # The command line override is -M1 or -M2. + # Defaults to "lvm1" if compiled in, else "lvm2". +- # format = "lvm1" ++ # Gentoo: default to LVM2 format ++ format = "lvm2" + + # Location of proc filesystem + proc = "/proc" +@@ -350,12 +354,12 @@ + + # Metadata settings + # +-# metadata { ++metadata { + # Default number of copies of metadata to hold on each PV. 0, 1 or 2. + # You might want to override it from the command line with 0 + # when running pvcreate on new PVs which are to be added to large VGs. +- +- # pvmetadatacopies = 1 ++ # Gentoo: enabled for data safety ++ pvmetadatacopies = 2 + + # Approximate default size of on-disk metadata areas in sectors. + # You should increase this if you have large volume groups or +@@ -377,11 +381,11 @@ + # the supplied toolset to make changes (e.g. vgcfgrestore). + + # dirs = [ "/etc/lvm/metadata", "/mnt/disk2/lvm/metadata2" ] +-#} ++} + + # Event daemon +-# +-# dmeventd { ++# Gentoo: uncommented, since we provide the dmeventd init script ++dmeventd { + # mirror_library is the library used when monitoring a mirror device. + # + # "libdevmapper-event-lvm2mirror.so" attempts to recover from +@@ -389,7 +393,7 @@ + # reconfigures a mirror as necessary. If no mirror library is + # provided, mirrors are not monitored through dmeventd. + +- # mirror_library = "libdevmapper-event-lvm2mirror.so" ++ mirror_library = "libdevmapper-event-lvm2mirror.so" + + # snapshot_library is the library used when monitoring a snapshot device. + # +@@ -398,6 +402,6 @@ + # snapshot exceedes 80%. The warning is repeated when 85%, 90% and + # 95% of the snapshot are filled. + +- # snapshot_library = "libdevmapper-event-lvm2snapshot.so" +-#} ++ snapshot_library = "libdevmapper-event-lvm2snapshot.so" ++} + diff --git a/sys-fs/clvm/files/lvm.confd-2.02.28-r2 b/sys-fs/clvm/files/lvm.confd-2.02.28-r2 new file mode 100644 index 000000000000..2fbd8668c376 --- /dev/null +++ b/sys-fs/clvm/files/lvm.confd-2.02.28-r2 @@ -0,0 +1,5 @@ +# LVM should normally only be started after mdraid is available +# this is because LVM physical volumes are very often MD devices. +RC_AFTER="mdraid" + +# vim: ft=gentoo-conf-d diff --git a/sys-fs/clvm/files/lvm.rc-2.02.28-r2 b/sys-fs/clvm/files/lvm.rc-2.02.28-r2 new file mode 100644 index 000000000000..2f64a7f07b30 --- /dev/null +++ b/sys-fs/clvm/files/lvm.rc-2.02.28-r2 @@ -0,0 +1,29 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/files/lvm.rc-2.02.28-r2,v 1.1 2008/03/17 19:15:53 xmerlin Exp $ + +depend() { + if [ -e /lib/librc.so ]; then + # on baselayout-1 this causes + # dependency-cycles with checkroot (before *) + before checkfs fsck + after modules + fi +} + +start() { + if [ ! -e /lib/librc.so ]; then + eerror "The $SVCNAME init-script is written for baselayout-2!" + eerror "Please do not use it with baselayout-1!". + return 1 + fi + + start_addon lvm +} + +stop() { + stop_addon lvm +} + +# vim:ts=4 diff --git a/sys-fs/clvm/files/lvm2-start.sh-2.02.33-xm b/sys-fs/clvm/files/lvm2-start.sh-2.02.33-xm new file mode 100644 index 000000000000..df07fa74406d --- /dev/null +++ b/sys-fs/clvm/files/lvm2-start.sh-2.02.33-xm @@ -0,0 +1,34 @@ +# /lib/rcscripts/addons/lvm2-start.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/files/lvm2-start.sh-2.02.33-xm,v 1.1 2008/03/17 19:15:53 xmerlin Exp $ + +# LVM support for /usr, /home, /opt .... +# This should be done *before* checking local +# volumes, or they never get checked. + +# NOTE: Add needed modules for LVM or RAID, etc +# to /etc/modules.autoload if needed +if [[ -z ${CDBOOT} ]] && [[ -x /sbin/vgscan ]] ; then + if [[ -e /proc/modules ]] && \ + ! grep -qs 'device-mapper' /proc/{devices,misc} + then + modprobe dm-mod &>/dev/null + fi + + if [[ -d /proc/lvm ]] || grep -qs 'device-mapper' /proc/{devices,misc} ; then + ebegin "Setting up the Logical Volume Manager" + #still echo stderr for debugging + /sbin/vgscan --mknodes --ignorelockingfailure >/dev/null + if [[ $? == 0 ]] && [[ -x /sbin/vgchange ]] && \ + [[ -f /etc/lvmtab || -d /etc/lvm ]] + then + noclustervgs=`/sbin/vgdisplay 2> /dev/null | \ + awk 'BEGIN {RS="VG Name"} {if (!/Clustered/) { if ($1 != "---") print $1; } }'` + for vg in $noclustervgs; do + /sbin/vgchange --ignorelockingfailure -a y ${vg} >/dev/null + done + fi + eend $? "Failed to setup the LVM" + fi +fi + +# vim:ts=4 diff --git a/sys-fs/clvm/files/lvm2-stop.sh-2.02.33-xm b/sys-fs/clvm/files/lvm2-stop.sh-2.02.33-xm new file mode 100755 index 000000000000..fa69533d51ae --- /dev/null +++ b/sys-fs/clvm/files/lvm2-stop.sh-2.02.33-xm @@ -0,0 +1,61 @@ +# /lib/rcscripts/addons/lvm2-stop.sh +# $Header: /var/cvsroot/gentoo-x86/sys-fs/clvm/files/lvm2-stop.sh-2.02.33-xm,v 1.1 2008/03/17 19:15:53 xmerlin Exp $ + +# Stop LVM2 +if [ -x /sbin/vgchange ] && \ + [ -x /sbin/lvdisplay ] && \ + [ -x /sbin/vgdisplay ] && \ + [ -x /sbin/lvchange ] && \ + [ -f /etc/lvmtab -o -d /etc/lvm ] && \ + [ -d /proc/lvm -o "`grep device-mapper /proc/misc 2>/dev/null`" ] +then + einfo "Shutting down the Logical Volume Manager" + # If these commands fail it is not currently an issue + # as the system is going down anyway based on the current LVM + # functionality as described in this forum thread + #https://www.redhat.com/archives/linux-lvm/2001-May/msg00523.html + + LOGICAL_VOLUMES=`lvdisplay |grep "LV Name"|sed -e 's/.*LV Name\s*\(.*\)/\1/'|sort` + VOLUME_GROUPS=`vgdisplay |grep "VG Name"|sed -e 's/.*VG Name\s*\(.*\)/\1/'|sort` + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|awk '{print $3}'` + if [ "${LV_IS_ACTIVE}" = 0 ] + then + ebegin " Shutting Down logical volume: ${x} " + lvchange -an --ignorelockingfailure -P ${x} >/dev/null + eend $? + fi + done + + for x in ${VOLUME_GROUPS} + do + VG_HAS_ACTIVE_LV=`vgdisplay ${x}|grep "Open LV"|sed -e 's/.*Open LV\s*\(.*\)/\1/'` + if [ "${VG_HAS_ACTIVE_LV}" = 0 ] + then + ebegin " Shutting Down volume group: ${x} " + vgchange -an --ignorelockingfailure -P ${x} >/dev/null + eend + fi + done + + for x in ${LOGICAL_VOLUMES} + do + LV_IS_ACTIVE=`lvdisplay ${x}|grep "# open"|sed -e 's/.*# open\s*\(.*\)/\1/'` + if [ "${LV_IS_ACTIVE}" = 1 ] + then + + ROOT_DEVICE=`mount|grep " / "|awk '{print $1}'` + MOUNTED_DEVICE=${x} + [ -L ${ROOT_DEVICE} ] && ROOT_DEVICE="`/bin/readlink ${ROOT_DEVICE}`" + [ -L ${x} ] && MOUNTED_DEVICE="`/bin/readlink ${x}`" + if [ ! ${ROOT_DEVICE} = ${MOUNTED_DEVICE} ] + then + ewarn " Unable to shutdown: ${x} " + fi + fi + done + einfo "Finished Shutting down the Logical Volume Manager" +fi + +# vim:ts=4 |