[PATCH 2/3] Update md name when lookup relied on UUID.

David Lehman dlehman at redhat.com
Fri Aug 1 16:49:42 UTC 2014


On 08/01/2014 03:56 AM, Anne Mulhern wrote:
>
>
>
>
> ----- Original Message -----
>> From: "David Lehman" <dlehman at redhat.com>
>> To: anaconda-patches at lists.fedorahosted.org
>> Sent: Friday, August 1, 2014 12:16:03 AM
>> Subject: [PATCH 2/3] Update md name when lookup relied on UUID.
>>
>> ---
>>   blivet/devicetree.py | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/blivet/devicetree.py b/blivet/devicetree.py
>> index f8fc112..73558df 100644
>> --- a/blivet/devicetree.py
>> +++ b/blivet/devicetree.py
>> @@ -910,6 +910,9 @@ class DeviceTree(object):
>>                   log.warning("failed to obtain uuid for mdraid device")
>>               else:
>>                   device = self.getDeviceByUuid(uuid,
>>                   incomplete=flags.allow_degraded_mdraid)
>> +                if device:
>> +                    # update the device instance with the real name
>> +                    device.name = name
>>
>>           # if we get here, we found all of the slave devices and
>>           # something must be wrong -- if all of the slaves are in
>> --
>> 1.9.3
>>
>> _______________________________________________
>> anaconda-patches mailing list
>> anaconda-patches at lists.fedorahosted.org
>> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>>
>
> Please add
>
> Related: rhbz#1090009
>
> to commit message since this change should go in with the code just above it.

Will do.

>
> Also, it would make more general sense to move the assignment down and
> out a bit and have something like:
>
> if device is not None:
>      device.name = name
> else:
>      # if we get here, we found all of the slave devices and
>      # something must be wrong -- if all of the slaves
>      etc.
>
> In some cases, if we actually managed to get the device by name for instance,
> that assignment definitely is redundant, but there's always the chance that
> we'll add trying to get the device by yet another way somewhere up above,
> and then fail to set the name in the case that we got the device, which
> would be a pain to figure out later.

Although it seems unlikely that we'll add another lookup key I went 
ahead and made this change. I also changed it to bypass the name setter 
and assign to device._name instead since changing the names of existing 
devices is generally not allowed.

>
> - 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