diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2016-08-30 15:33:50 +0200 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2016-08-30 15:38:34 +0200 |
commit | 16ed726610eca266bc6ef03989a156862ebf3d7a (patch) | |
tree | 06d65023b173c3d9564ef1386ce6d09b58ea98aa | |
parent | 52d1ddd601d278821d69aa35914e0db18f018749 (diff) | |
download | lvm2-16ed726610eca266bc6ef03989a156862ebf3d7a.tar.gz |
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.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rwxr-xr-x | scripts/lvmdump.sh | 13 |
2 files changed, 11 insertions, 3 deletions
@@ -1,5 +1,6 @@ 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. Do not monitor cache-pool metadata when LV is just being cleared. Add allocation/cache_pool_max_chunks to prevent misuse of cache target. diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh index d13a69be6..85f8e5c68 100755 --- a/scripts/lvmdump.sh +++ b/scripts/lvmdump.sh @@ -28,6 +28,7 @@ PS=ps # need alx SED=sed DD=dd CUT=cut +GREP=grep DATE=date BASENAME=basename UDEVADM=udevadm @@ -259,8 +260,14 @@ if (( $sysreport )); then if test -z "LSBLK"; then myecho "WARNING: lsblk not found" else - log "$LSBLK -O >> \"$sysreport_dir/lsblk\"" - log "$LSBLK -s >> \"$sysreport_dir/lsblk_s\"" + if $LSBLK --help | $GREP -- --output-all >/dev/null; then + 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 if test -z "$SYSTEMCTL"; then @@ -281,7 +288,7 @@ if (( $sysreport )); then lvm2-activation-net.service \ > \"$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\"" - 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\"" done fi |