FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Kernel

 
 
LinkBack Thread Tools
 
Old 04-19-2011, 11:05 PM
David Cantrell
 
Default Prevent /sys/class/block/mapper!vg*-lv* lookups.

I was hitting this today. The /dev/mapper/vg*-lv* names were getting
translated to /sys/class/block/mapper!vg*-lv*.
---
pyanaconda/iutil.py | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
index a004ae0..00567d7 100644
--- a/pyanaconda/iutil.py
+++ b/pyanaconda/iutil.py
@@ -806,9 +806,7 @@ def get_sysfs_path_by_name(dev_node, class_name="block"):
(e.g. /sys/class/block/vda2). This also has to work for device nodes
that are in a subdirectory of /dev like '/dev/cciss/c0d0p1'.
"""
- dev_name = os.path.basename(dev_node)
- if dev_node.startswith("/dev/"):
- dev_name = dev_node[5:].replace("/", "!")
+ dev_name = os.path.basename(os.path.realpath(dev_node)).repla ce("/", "!")
sysfs_class_dir = "/sys/class/%s" % class_name
dev_path = os.path.join(sysfs_class_dir, dev_name)
if os.path.exists(dev_path):
--
1.7.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-19-2011, 11:53 PM
"Brian C. Lane"
 
Default Prevent /sys/class/block/mapper!vg*-lv* lookups.

On Tue, Apr 19, 2011 at 01:05:57PM -1000, David Cantrell wrote:
> I was hitting this today. The /dev/mapper/vg*-lv* names were getting
> translated to /sys/class/block/mapper!vg*-lv*.
> ---
> pyanaconda/iutil.py | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index a004ae0..00567d7 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -806,9 +806,7 @@ def get_sysfs_path_by_name(dev_node, class_name="block"):
> (e.g. /sys/class/block/vda2). This also has to work for device nodes
> that are in a subdirectory of /dev like '/dev/cciss/c0d0p1'.
> """
> - dev_name = os.path.basename(dev_node)
> - if dev_node.startswith("/dev/"):
> - dev_name = dev_node[5:].replace("/", "!")
> + dev_name = os.path.basename(os.path.realpath(dev_node)).repla ce("/", "!")

Is the .replace still useful for anything? basename is going to return
the last part of the path and will never have a / in it.

--
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)
_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-20-2011, 01:01 AM
David Lehman
 
Default Prevent /sys/class/block/mapper!vg*-lv* lookups.

On Tue, 2011-04-19 at 13:05 -1000, David Cantrell wrote:
> I was hitting this today. The /dev/mapper/vg*-lv* names were getting
> translated to /sys/class/block/mapper!vg*-lv*.
> ---
> pyanaconda/iutil.py | 4 +---
> 1 files changed, 1 insertions(+), 3 deletions(-)

I think the right fix for this is to trim /dev/ and then trim mapper/ if
it's there. Otherwise you lose the point of the replace, as Brian points
out.

Dave

>
> diff --git a/pyanaconda/iutil.py b/pyanaconda/iutil.py
> index a004ae0..00567d7 100644
> --- a/pyanaconda/iutil.py
> +++ b/pyanaconda/iutil.py
> @@ -806,9 +806,7 @@ def get_sysfs_path_by_name(dev_node, class_name="block"):
> (e.g. /sys/class/block/vda2). This also has to work for device nodes
> that are in a subdirectory of /dev like '/dev/cciss/c0d0p1'.
> """
> - dev_name = os.path.basename(dev_node)
> - if dev_node.startswith("/dev/"):
> - dev_name = dev_node[5:].replace("/", "!")
> + dev_name = os.path.basename(os.path.realpath(dev_node)).repla ce("/", "!")
> sysfs_class_dir = "/sys/class/%s" % class_name
> dev_path = os.path.join(sysfs_class_dir, dev_name)
> if os.path.exists(dev_path):


_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 04-22-2011, 06:33 AM
Ales Kozumplik
 
Default Prevent /sys/class/block/mapper!vg*-lv* lookups.

On 04/20/2011 01:05 AM, David Cantrell wrote:

I was hitting this today. The /dev/mapper/vg*-lv* names were getting
translated to /sys/class/block/mapper!vg*-lv*.
---


get_sysfs_path_by_name() will not work for the named aliases of
device-mapper devices. There are no /syc/class/block/mapper/vg*-lv*
files, there are only


/sys/class/block/dm-* files.

You can take a look at storage/formats/__init__.py at how we call
get_sysfs_path_by_name(), we try to get the real device node from the dm
name using dm_node_from_name() first.


There should be an assert in get_sysfs_path_by_name() stating that
/dev/mapper/* parameters are not passed in.


Ales

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 07:46 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org