mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
lvmdump: Add -l, to collect a state dump from lvmetad.
This commit is contained in:
parent
8557b412f6
commit
4022fd3e79
@ -33,11 +33,14 @@ BASENAME=basename
|
||||
UDEVADM=udevadm
|
||||
UNAME=uname
|
||||
TR=tr
|
||||
SOCAT=socat # either socat or nc is needed for dumping lvmetad state
|
||||
NC=nc
|
||||
|
||||
# user may override lvm and dmsetup location by setting LVM_BINARY
|
||||
# and DMSETUP_BINARY respectively
|
||||
LVM=${LVM_BINARY-lvm}
|
||||
DMSETUP=${DMSETUP_BINARY-dmsetup}
|
||||
LVMETAD_SOCKET=${LVM_LVMETAD_SOCKET-/var/run/lvm/lvmetad.socket}
|
||||
|
||||
die() {
|
||||
code=$1; shift
|
||||
@ -57,6 +60,7 @@ function usage {
|
||||
echo " -d <directory> dump into a directory instead of tarball"
|
||||
echo " -c if running clvmd, gather cluster data as well"
|
||||
echo " -u gather udev info and context"
|
||||
echo " -l gather lvmetad state if running"
|
||||
echo ""
|
||||
|
||||
exit 1
|
||||
@ -66,7 +70,7 @@ advanced=0
|
||||
clustered=0
|
||||
metadata=0
|
||||
udev=0
|
||||
while getopts :acd:hmu opt; do
|
||||
while getopts :acd:hmul opt; do
|
||||
case $opt in
|
||||
s) sysreport=1 ;;
|
||||
a) advanced=1 ;;
|
||||
@ -75,6 +79,7 @@ while getopts :acd:hmu opt; do
|
||||
h) usage ;;
|
||||
m) metadata=1 ;;
|
||||
u) udev=1 ;;
|
||||
l) lvmetad=1 ;;
|
||||
:) echo "$0: $OPTARG requires a value:"; usage ;;
|
||||
\?) echo "$0: unknown option $OPTARG"; usage ;;
|
||||
*) usage ;;
|
||||
@ -240,6 +245,22 @@ if (( $udev )); then
|
||||
log "$CP -aR /lib/udev/rules.d \"$udev_dir/rules_lib\" 2>> \"$log\""
|
||||
fi
|
||||
|
||||
if (( $lvmetad )); then
|
||||
(echo 'request="dump"'; echo '##') | {
|
||||
if type -p $SOCAT >& /dev/null; then
|
||||
echo "$SOCAT unix-connect:$LVMETAD_SOCKET -" >> "$log"
|
||||
$SOCAT "unix-connect:$LVMETAD_SOCKET" - 2>> "$log"
|
||||
elif echo | $NC -U "$LVMETAD_SOCKET"; then
|
||||
echo "$NC -U $LVMETAD_SOCKET" >> "$log"
|
||||
$NC -U "$LVMETAD_SOCKET" 2>> "$log"
|
||||
else
|
||||
myecho "WARNING: Neither socat nor nc -U seems to be available." 1>&2
|
||||
echo "# DUMP FAILED"
|
||||
return 1
|
||||
fi
|
||||
} > "$dir/lvmetad.txt"
|
||||
fi
|
||||
|
||||
if test -z "$userdir"; then
|
||||
lvm_dump="$dirbase.tgz"
|
||||
myecho "Creating report tarball in $HOME/$lvm_dump..."
|
||||
|
Loading…
Reference in New Issue
Block a user