Re: [PATCH 5/5] Recognize mpath devices when we see them.

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

 



On 08/06/2009 02:11 PM, David Lehman wrote:
>> diff --git a/storage/devicelibs/dm.py b/storage/devicelibs/dm.py
>> index 29df126..a4a4ca9 100644
>> --- a/storage/devicelibs/dm.py
>> +++ b/storage/devicelibs/dm.py
>> @@ -105,3 +113,13 @@ def get_backing_devs_from_name(map_name):
>>      slave_devs = os.listdir("/sys/block/virtual/%s" % dm_node)
>>      return slave_devs
>>  
>> +def dm_is_multipath_disk(map_name):
>> +    return False
>> +
>> +def dm_get_mutlipath_partition_disk(map_name):
>> +    return None
>> +
>> +def dm_is_multipath_partition(map_name):
>> +    return False
>> +
>> +
> 
> Why add the above three functions if they don't do anything?

Yeah, they eventually got done differently.  I'll remove them.

> 
>> diff --git a/storage/devices.py b/storage/devices.py
>> index 3ca05aa..a866f14 100644
>> --- a/storage/devices.py
>> +++ b/storage/devices.py
>> @@ -96,6 +96,7 @@
>>  import os
>>  import math
>>  import copy
>> +import string
> 
> If we can avoid this by using the string instances' methods we should do
> so.

Indeed.

>> @@ -762,14 +763,15 @@ class DiskDevice(StorageDevice):
>>                  # When the device has no partition table but it has a FS, it
>>                  # will be created with label type loop.  Treat the same as if
>>                  # the device had no label (cause it really doesn't).
>> -                if self._partedDisk.type == "loop":
>> +                if self.partedDisk.type == "loop":
>>                      if self._initcb is not None and self._initcb():
>> -                        self._partedDisk = parted.freshDisk( \
>> -                                device=self.partedDevice, \
>> +                        self._partedDisk = parted.freshDisk(device=self.partedDevice, \
>>                                  ty = platform.getPlatform(None).diskType)
>>                      else:
>>                          raise DeviceUserDeniedFormatError("User prefered to not format.")
>>  
>> +        return self._partedDisk
>> +
> 
> It looks like some of the previous patch is being reverted in the above
> hunk (self._partedDisk -v- self.partedDisk).

Ah, that and another problem -- the "return" here should have been in the
previous commit.  I'll push the previous commit with that merged into it.

>>  
>> +    @property
>> +    def up(self):
>> +        return self._isUp
> 
> Is this different from status?

Hrm.  No, probably not.

> 
>> +
>> +    @property
>> +    def path(self):
>> +        """ Device node representing this device. """
>> +        return "/dev/mapper/%s" % (self.name,)
> 
> This should not be needed. StorageDevice already does this, except
> without hard-coding /dev/mapper.

Gone.

>> +
>> +    @property
>> +    def wwid(self):
>> +        serial = self.identity
>> +        ret = []
>> +        while serial:
>> +            ret.append(serial[:2])
>> +            serial = serial[2:]
>> +        return string.join(ret, ':')
> 
> You could avoid the string import above by instead doing this:
> 
>   return ":".join(ret)
> 
> Weird looking, I know.

Yeah.

>> +    def handleMultipathMemberFormat(self, info, device):
>> +        log_method_call(self, name=device.name, type=device.format.type)
>> +
>> +        serial = udev_device_get_serial(info)
>> +        found = False
>> +        if self.__multipaths.has_key(serial):
>> +            mp = self.__multipaths[serial]
>> +            mp.addParent(device)
>> +        else:
>> +            name = generateMultipathDeviceName()
>> +            devname = "/dev/mapper/%s" % (name,)
>> +
>> +            if self.zeroMbr:
>> +                cb = lambda: True
>> +            else:
>> +                desc = []
>> +                serialtmp = serial
>> +                while serialtmp:
>> +                    desc.append(serialtmp[:2])
>> +                    serialtmp = serialtmp[2:]
>> +                desc = "WWID %s" % (string.join(desc, ':'),)
> 
> Again, you can do ":".join(desc) here instead.

okay.

>> diff --git a/storage/udev.py b/storage/udev.py
>> index 450b54a..adb69e6 100644
>> --- a/storage/udev.py
>> +++ b/storage/udev.py
>> @@ -22,6 +22,7 @@
>>  
>>  import os
>>  import stat
>> +import block
>>  
>>  import iutil
>>  from errors import *
>> @@ -134,6 +135,10 @@ def udev_device_get_label(udev_info):
>>      """ Get the label from the device's format as reported by udev. """
>>      return udev_info.get("ID_FS_LABEL")
>>  
>> +def udev_device_is_multipath_member(info):
>> +    """ Return True if the device is part of a multipath. """
>> +    return info.get("ID_FS_TYPE") == "multipath_member"
> 
> It kind of sucks that we have this string both in the format class and
> here.

I can see that, yeah, but I don't really have a better way.

Another patch will hit your mailbox soon.

-- 
        Peter

The Shuttle is now going five times the sound of speed.
		-- Dan Rather, first landing of Columbia

_______________________________________________
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