[PATCH 3/5] Remove an obsolete block related to unpredictable md device names.

David Lehman dlehman at redhat.com
Wed Jul 30 16:02:56 UTC 2014


On 07/30/2014 07:11 AM, Anne Mulhern wrote:
>
>
>
>
> ----- Original Message -----
>> From: "David Lehman" <dlehman at redhat.com>
>> To: anaconda-patches at lists.fedorahosted.org
>> Sent: Tuesday, July 29, 2014 8:11:00 PM
>> Subject: [PATCH 3/5] Remove an obsolete block related to unpredictable md	device names.
>>
>> The functionality this block originally provided should be covered by the
>> UUID lookup we do in addUdevMDDevice.
>>
>> This block no longer works because it relies on md-specific data being in
>> the udev database itself, which is no longer the case. It hasn't been
>> since we removed anaconda's udev rules.
>> ---
>>   blivet/devicetree.py | 29 -----------------------------
>>   1 file changed, 29 deletions(-)
>>
>> diff --git a/blivet/devicetree.py b/blivet/devicetree.py
>> index 670203a..e2d0db1 100644
>> --- a/blivet/devicetree.py
>> +++ b/blivet/devicetree.py
>> @@ -1599,35 +1599,6 @@ class DeviceTree(object):
>>               md_metadata = None
>>               md_name = None
>>
>> -            # check the list of devices udev knows about to see if the array
>> -            # this device belongs to is already active
>> -            for dev in udev.get_devices():
>> -                if not udev.device_is_md(dev):
>> -                    continue
>> -
>> -                try:
>> -                    dev_uuid = udev.device_get_md_uuid(dev)
>> -                    dev_level = udev.device_get_md_level(dev)
>> -                except KeyError:
>> -                    continue
>> -
>> -                if dev_uuid is None or dev_level is None:
>> -                    continue
>> -
>> -                if dev_uuid == md_uuid and dev_level == md_level:
>> -                    md_name = udev.device_get_md_name(dev)
>> -                    md_metadata = udev.device_get_md_metadata(dev)
>> -                    if not md_name:
>> -                        # containers don't typically have names and they
>> also
>> -                        # don't have a symlink in /dev/md
>> -                        md_name = udev.device_get_name(dev)
>> -                        if md_level != "container" and \
>> -                           re.match(r'md\d+$', md_name):
>> -                            # md0 -> 0
>> -                            md_name = md_name[2:]
>> -
>> -                    break
>> -
>>               # mdexamine yields MD_METADATA only for metadata version > 0.90
>>               # if MD_METADATA is missing, assume metadata version is 0.90
>>               md_metadata = md_metadata or udev.device_get_md_metadata(info)
>>               or "0.90"
>> --
>> 1.9.3
>>
>> _______________________________________________
>> anaconda-patches mailing list
>> anaconda-patches at lists.fedorahosted.org
>> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>>
>
> I'm not nearly done with this patch set as a whole, but for this patch...
>
> It's great to see this chunk of code disappear.
> You can disappear a few more lines by getting rid of
> the assignments to md_metadata and md_name just above.
> You can then simplify
> md_metadata = md_metadata or udev.device_get_md_metadata(info) or "0.90
> to
> md_metadata = udev.device_get_md_metadata(info) or "0.90
>
> There's an if block below with condition "not md_name".
> But md_name is unset at this point, so the code in the
> block should be executed unconditionally. (I don't fully
> understand what this code does, actually. Perhaps
> it needs some revision as well, I can't tell.)
>
> Also, it's wierd but some of this md info _is_
> obtained by udev/pyudev, i.e., not mdraid specific
> tools. I was so surprised to find that out
> that I annotated the md_* methods in udev.py
> with information about the provenance of the
> various key/value pairs.

I forgot that the md udev rules include the examine output for arrays. 
That would be enough to make the removed block functional, but I would 
still prefer that we keep the more concise approach from addUdevMDDevice 
instead. Unfortunately, there's a little bug in that method that 
prevents it from being very useful for this. I am withdrawing this patch 
from the set since it needs work.

David

>
> - mulhern
> _______________________________________________
> anaconda-patches mailing list
> anaconda-patches at lists.fedorahosted.org
> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>



More information about the anaconda-patches mailing list