]> sourceware.org Git - lvm2.git/commit
dmstats: use canonical path when reporting errors
authorBryn M. Reeves <bmr@redhat.com>
Fri, 8 Jul 2016 16:06:35 +0000 (17:06 +0100)
committerBryn M. Reeves <bmr@redhat.com>
Fri, 8 Jul 2016 16:27:52 +0000 (17:27 +0100)
commit5cd39f1dc4013d5d9b150abe544187413daeaac9
treec4384cbe014c8732604ac03f168fe6c4033b884f
parent17cbcc85bdd31d6b1e0d3af8e43c39a8c58561b5
dmstats: use canonical path when reporting errors

When a 'dmstats create --filemap' operation fails (e.g. during
open(2), close(2), or dm_stats_create_regions_from_fd()), use the
canonical version of the path. This avoids cryptic/confusing error
messages when symbolic links exist in the path argument given:

  # findmnt /var/lib/libvirt/images -otarget,source
  TARGET                  SOURCE
  /var/lib/libvirt/images /dev/mapper/vg_hex-lv_images

  # readlink /var/lib/libvirt/images/my.img
  /boot/my.img

  # dmstats create --filemap /var/lib/libvirt/images/my.img
  Cannot map file: not a device-mapper device.
  Could not create regions from file /var/lib/libvirt/images/my.img
  Command failed

Using the canonical path the error is immediately obvious:

  # dmstats create --filemap /var/lib/libvirt/images/my.img
  Cannot map file: not a device-mapper device.
  Could not create regions from file /boot/my.img
  Command failed
tools/dmsetup.c
This page took 0.030955 seconds and 5 git commands to generate.