Bug 195206 - Extend device filters to control names displayed for devices
Summary: Extend device filters to control names displayed for devices
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: lvm2
Version: 4.0
Hardware: All
OS: Linux
low
low
Target Milestone: ---
: ---
Assignee: LVM and device-mapper development team
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-06-14 14:57 UTC by Bob Gautier
Modified: 2010-05-17 12:46 UTC (History)
4 users (show)

Fixed In Version: 2.02.25
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2010-05-17 12:46:58 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Bob Gautier 2006-06-14 14:57:41 UTC
Description of problem:

We are using lvm2 to manage storage that is reached via device-mapper-multipath.

In an attempt to make the lvm commands show names of multipath devices rather 
than relatively meaningless /dev/dm-[0-9]* names, we have put a filter in 
our /etc/lvm/lvm.conf:

    filter = [ "r|/dev/dm-.*|","a/.*/" ]

However this only works the in the absence of a /etc/lvm/.cache file.

Version-Release number of selected component (if applicable):

lvm2-2.02.01-1.3.RHEL4

How reproducible:

Completely.

Steps to Reproduce:
1. Create some devicemapper devices to be managed by LVM
2. Make (some of) those devices LVM manageable, e.g. 'pvcreate ....'
3. Insert a filter into /etc/lvm/lvm.conf (see above)
3. Remove the lvm cache: rm /etc/lvm/.cache
4. Run /usr/sbin/pvs.  Observe names such as /dev/mapper/... in the output
5. Run /usr/sbin/pvs again.  Note that /dev/mapper/... has been replaced 
by /dev/dm-[0-9]*

Actual results:

# rm /etc/lvm/.cache
rm: remove regular file `/etc/lvm/.cache'? y
# /usr/sbin/pvs
  PV                   VG       Fmt  Attr PSize  PFree 
  /dev/cciss/c0d0p5    Volume00 lvm2 a-   63.72G 49.72G
  /dev/mapper/redolog0 oraredo  lvm2 a-    4.00G     0 
  /dev/mapper/sandisk0 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk1 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk2 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk3 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk4 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk5 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk6 srevg    lvm2 a-   10.00G  4.96G
  /dev/mapper/sandisk7 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk8 srevg    lvm2 a-   10.00G     0 
  /dev/mapper/sandisk9 srevg    lvm2 a-   10.00G     0 
# /usr/sbin/pvs
  PV                VG       Fmt  Attr PSize  PFree 
  /dev/cciss/c0d0p5 Volume00 lvm2 a-   63.72G 49.72G
  /dev/dm-0         srevg    lvm2 a-   10.00G     0 
  /dev/dm-1         srevg    lvm2 a-   10.00G     0 
  /dev/dm-10        oraredo  lvm2 a-    4.00G     0 
  /dev/dm-2         srevg    lvm2 a-   10.00G     0 
  /dev/dm-3         srevg    lvm2 a-   10.00G     0 
  /dev/dm-4         srevg    lvm2 a-   10.00G     0 
  /dev/dm-5         srevg    lvm2 a-   10.00G     0 
  /dev/dm-6         srevg    lvm2 a-   10.00G     0 
  /dev/dm-7         srevg    lvm2 a-   10.00G  4.96G
  /dev/dm-8         srevg    lvm2 a-   10.00G     0 
  /dev/dm-9         srevg    lvm2 a-   10.00G     0 

Expected results:

The output of /usr/sbin/pvs (and other lvm commands) should not be affected by 
presence of the cache file, and in any case should respect filters 
in /etc/lvm/lvm.conf.

We expect to see LVM output in terms of /dev/mapper names all the time - 
no /dev/dm-* names.

Additional info:

We have tried various filter regexps.  Have we got it right?

There are other paths to the devicemapper devices (e.g. /dev/mpath/*) -- are 
these interfering?

Comment 1 Alasdair Kergon 2006-06-14 15:08:16 UTC
As things stand, filters control which underlying devices (i.e. major/minor
numbers) are accessed by the software.  They do not control device naming.  It
would be nice to change this.

Comment 2 Bob Gautier 2006-06-14 15:19:20 UTC
Thanks for the quick reply.

So the filtering mechanism isn't intended to do what we want, right now?

It seems odd to go to all the trouble of filtering a set of names when looking 
for major/minor numbers, only to subsequently allow the use of those names 
as 'friendly' names for those same numbers.  I agree it would be nice to change 
that :-)

By the way, I *can* get the effect I want by filtering the cache file, i.e. 
running 'grep -v dm-' over it.  Do you have a problem with that as a workaround?


Comment 3 Mike Snitzer 2006-07-21 21:11:23 UTC
In response to comment#1, why would it be nice to have LVM handle renaming
devices?  Shouldn't that be left to udev et al?

Comment 4 Bryn M. Reeves 2008-07-22 09:23:50 UTC
Doesn't preferred_names achive this?

Comment 5 Bryn M. Reeves 2008-07-22 09:24:44 UTC
In reply to comment #3 this isn't talking about actual renaming, rather it's how
LVM2 chooses which name to report for a device when there exist multiple device
nodes/symlinks that all reference the same major/minor number.


Comment 6 Alasdair Kergon 2010-05-17 12:46:58 UTC
You can now set devices/preferred_names in lvm.conf as Bryn points out:

    # If several entries in the scanned directories correspond to the
    # same block device and the tools need to display a name for device,
    # all the pathnames are matched against each item in the following
    # list of regular expressions in turn and the first match is used.
    preferred_names = [ ]


Note You need to log in before you can comment on or make changes to this bug.