1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

lvmdump: use lsblk -s and lsblk -O in lvmdump only if these options are supported

The lsblk is just a nice helper here - it's not crucial for lvmdump so
do best effort here and use the most we can from current version of
lsblk that is installed on system. The lsblk -s option was added a bit
later after lsblk introduction and lsblk -O support even more later -
so if these are not available, use only pure lsblk output without any
extras.
This commit is contained in:
Peter Rajnoha 2016-08-30 15:33:50 +02:00
parent 52d1ddd601
commit 16ed726610
2 changed files with 11 additions and 3 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.165 - Version 2.02.165 -
=================================== ===================================
Use lsblk -s and lsblk -O in lvmdump only if these options are supported.
Fix number of stripes shown in lvcreate raid10 message when too many. Fix number of stripes shown in lvcreate raid10 message when too many.
Do not monitor cache-pool metadata when LV is just being cleared. Do not monitor cache-pool metadata when LV is just being cleared.
Add allocation/cache_pool_max_chunks to prevent misuse of cache target. Add allocation/cache_pool_max_chunks to prevent misuse of cache target.

View File

@ -28,6 +28,7 @@ PS=ps # need alx
SED=sed SED=sed
DD=dd DD=dd
CUT=cut CUT=cut
GREP=grep
DATE=date DATE=date
BASENAME=basename BASENAME=basename
UDEVADM=udevadm UDEVADM=udevadm
@ -259,8 +260,14 @@ if (( $sysreport )); then
if test -z "LSBLK"; then if test -z "LSBLK"; then
myecho "WARNING: lsblk not found" myecho "WARNING: lsblk not found"
else else
log "$LSBLK -O >> \"$sysreport_dir/lsblk\"" if $LSBLK --help | $GREP -- --output-all >/dev/null; then
log "$LSBLK -s >> \"$sysreport_dir/lsblk_s\"" log "$LSBLK -O >> \"$sysreport_dir/lsblk_O\""
else
log "$LSBLK >> \"$sysreport_dir/lsblk\""
fi
if $LSBLK --help | $GREP -- --inverse >/dev/null; then
log "$LSBLK -s >> \"$sysreport_dir/lsblk_s\""
fi
fi fi
if test -z "$SYSTEMCTL"; then if test -z "$SYSTEMCTL"; then
@ -281,7 +288,7 @@ if (( $sysreport )); then
lvm2-activation-net.service \ lvm2-activation-net.service \
> \"$sysreport_dir/systemd_lvm2_services_status\" 2>> \"$log\"" > \"$sysreport_dir/systemd_lvm2_services_status\" 2>> \"$log\""
log "$SYSTEMCTL list-units -l -a --no-legend --no-pager > \"$sysreport_dir/systemd_unit_list\" 2>> \"$log\"" log "$SYSTEMCTL list-units -l -a --no-legend --no-pager > \"$sysreport_dir/systemd_unit_list\" 2>> \"$log\""
for unit in $(cat $sysreport_dir/systemd_unit_list | grep lvm2-pvscan | cut -d " " -f 1); do for unit in $(cat $sysreport_dir/systemd_unit_list | $GREP lvm2-pvscan | cut -d " " -f 1); do
log "$SYSTEMCTL status -l --no-pager -n $log_lines -o short-precise $unit >> \"$sysreport_dir/systemd_lvm2_pvscan_service_status\"" log "$SYSTEMCTL status -l --no-pager -n $log_lines -o short-precise $unit >> \"$sysreport_dir/systemd_lvm2_pvscan_service_status\""
done done
fi fi