Re: [PATCH 3/7] Make storage.devices.deviceNameToDiskByPath() more robust.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Agreed.

On 10/16/2009 12:24 AM, David Cantrell wrote:
> On Wed, 14 Oct 2009, Steffen Maier wrote:
>> On 10/08/2009 09:28 AM, David Cantrell wrote:
>>> Have deviceNameToDiskByPath() return the full device path rather than
>>> just the basename path.  Have it check to see if the entry in
>>> /dev/disk/by-path is actually a symlink, then readlink that.  Otherwise
>>> just take the basename of the entry.  Also fix a problem where passing
>>> it a full device path would not match (e.g., '/dev/dasdb1').  Take the
>>> basename of deviceName and match that against the readlink() value.
>>> ---
>>>  storage/devices.py |   12 ++++++++++--
>>>  1 files changed, 10 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/storage/devices.py b/storage/devices.py
>>> index 348d2fd..9d257e2 100644
>>> --- a/storage/devices.py
>>> +++ b/storage/devices.py
>>> @@ -154,10 +154,18 @@ def deviceNameToDiskByPath(deviceName=None):
>>>      if not os.path.isdir(bypath):
>>>          return ""
>>>
>>> +    deviceName = os.path.basename(deviceName)
>>> +
>>>      for path in os.listdir(bypath):
>>
>> With many devices this linear search may become a performance problem.
>> I was wondering, if one could just use something that you already had
>> for a different purpose in your "[PATCH] Add dracutSetupString() method
>> to ZFCPDiskDevice (#526354)". Take info.get("symlinks") since it's in
>> the udev-db anyway already. Search for a match of "disk/by-path" and
>> then you have it.
> 
> That works for the call from storage/devicetree.py, but the call from
> PartitionDevice.fstabSpec won't have the 'info' hash at that point.  I
> suppose
> deviceNameToDiskByPath() could be extended to use the info hash if it's a
> parameter, but I'm not sure it's a performance problem yet.  I did these
> rough
> tests:

> And given that there are currently only two calls to
> deviceNameToDiskByPath(),
> I'd prefer to keep the code in anaconda simple rather than make it behave
> differently based on the caller.
> 
> We could modify the caller in storage/devicetree.py, but that would require
> pulling in the info hash (which is there), but then we're counting on the
> symlinks hash member.  And, as you've pointed out, we should just read the
> trees and get the information ourselves.  I'd rather keep things the way
> they
> are for now.  If this becomes a major performance problem, we can discuss a
> redesign.

Steffen

Linux on System z Development

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Martin Jetter
Geschäftsführung: Erich Baier
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294


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

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux