[PATCH 7/8] Properly identify dm devices even when udev info is incomplete.

Anne Mulhern amulhern at redhat.com
Tue Sep 16 20:33:10 UTC 2014





----- Original Message -----
> From: "David Lehman" <dlehman at redhat.com>
> To: anaconda-patches at lists.fedorahosted.org
> Sent: Tuesday, September 16, 2014 3:54:30 PM
> Subject: Re: [PATCH 7/8] Properly identify dm devices even when udev info	is incomplete.
> 
> On 09/16/2014 02:41 PM, Anne Mulhern wrote:
> >
> >
> >
> >
> > ----- Original Message -----
> >> From: "David Lehman" <dlehman at redhat.com>
> >> To: anaconda-patches at lists.fedorahosted.org
> >> Sent: Tuesday, September 16, 2014 12:41:10 PM
> >> Subject: [PATCH 7/8] Properly identify dm devices even when udev info is
> >> 	incomplete.
> >>
> >> This will help us to ignore device-mapper devices that we can't use.
> >>
> >> Resolves: rhbz#1080727
> >> ---
> >>   blivet/udev.py | 3 ++-
> >>   1 file changed, 2 insertions(+), 1 deletion(-)
> >>
> >> diff --git a/blivet/udev.py b/blivet/udev.py
> >> index 5755d0c..14bf50a 100644
> >> --- a/blivet/udev.py
> >> +++ b/blivet/udev.py
> >> @@ -159,7 +159,8 @@ def device_get_label(udev_info):
> >>
> >>   def device_is_dm(info):
> >>       """ Return True if the device is a device-mapper device. """
> >> -    return 'DM_NAME' in info
> >> +    dm_dir = "%s/dm" % device_get_sysfs_path(info)
> >> +    return 'DM_NAME' in info or os.path.exists(dm_dir)
> >>
> >>   def device_is_md(info):
> >>       """ Return True if the device is a mdraid array device. """
> >> --
> >> 1.9.3
> >>
> >> _______________________________________________
> >> anaconda-patches mailing list
> >> anaconda-patches at lists.fedorahosted.org
> >> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> >>
> >
> > More proper to use os.path.join() instead of % op.
> 
> I stopped using os.path.join when I found out it behaves like this:
> 
>  >>> os.path.join("/a/b/c", "/d/e")
> '/d/e'
> 
> >
> > - mulhern
> > _______________________________________________
> > anaconda-patches mailing list
> > anaconda-patches at lists.fedorahosted.org
> > https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> >
> 
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
> 

It _would_ be nice if they had bothered to explain why they preferred
"/d/e" to "/a/b/c" or raising an exception as
raise ValueError("Can not concatenate absolute path onto preceding non-empty path.")
or something like that. But I agree with them that "/a/b/c/d/e" would be wrong,
even if convenient sometimes.

join for NT is 30 lines, for posix it's 9, for the old macs its 13. Guess the
*nix's win again.

- mulhern



More information about the anaconda-patches mailing list