[PATCH 2/4] Don't raise an exception for failure to scan an ignored disk.
David Lehman
dlehman at redhat.com
Tue Jan 20 19:30:28 UTC 2015
On 01/20/2015 12:58 PM, Anne Mulhern wrote:
>
>
>
>
> ----- Original Message -----
>> From: "David Lehman" <dlehman at redhat.com>
>> To: anaconda-patches at lists.fedorahosted.org
>> Sent: Friday, January 9, 2015 4:32:31 PM
>> Subject: [PATCH 2/4] Don't raise an exception for failure to scan an ignored disk.
>>
>> The disk will be ignored anyway, so it should not matter if there are
>> active devices on it since we won't be trying to write to it.
>>
>> Related: rhbz#1123450
>> ---
>> blivet/devicetree.py | 15 ++++++++-------
>> 1 file changed, 8 insertions(+), 7 deletions(-)
>>
>> diff --git a/blivet/devicetree.py b/blivet/devicetree.py
>> index 41cc42e..2e5850a 100644
>> --- a/blivet/devicetree.py
>> +++ b/blivet/devicetree.py
>> @@ -944,7 +944,8 @@ class DeviceTree(object):
>> # - devices that contain disklabels made by isohybrid
>> #
>> if (disk.partitionable and not
>> - (disk.format.type == "iso9660" or disk.format.hidden)):
>> + (disk.format.type == "iso9660" or disk.format.hidden) and
>> + (flags.installer_mode and not self._isIgnoredDisk(disk))):
>
> It might be better to set it up as a flat conjunction, like:
>
> if disk.partitionable and \
> not disk.format.type == "iso9660" and \
> not disk.format.hidden and \
> flags.installer_mode and \
> not self._isIgnoredDisk(disk):
>
> Then it's clear that if flags.installer_mode is False, exception is never
> raised. I'm not sure that's what is intended, though. Maybe flags.installer_mode
> could e dropped altogether?
The intent was to only take the ignored disk list into account in
installer mode. Upon further consideration, I think the best immediate
action is to remove installer_mode from this statement completely. I
agree that the statement becomes easier to read when flattened out, so
I'll do that as well.
David
>
>> raise DeviceTreeError("failed to scan disk %s" % disk.name)
>>
>> # there's no need to filter partitions on members of multipaths
>> or
>> @@ -2176,15 +2177,15 @@ class DeviceTree(object):
>> if flags.installer_mode:
>> self.teardownAll()
>>
>> - def _hideIgnoredDisks(self):
>> - def _is_ignored(disk):
>> - return ((self.ignoredDisks and disk.name in self.ignoredDisks)
>> or
>> - (self.exclusiveDisks and
>> - disk.name not in self.exclusiveDisks))
>> + def _isIgnoredDisk(self, disk):
>> + return ((self.ignoredDisks and disk.name in self.ignoredDisks) or
>> + (self.exclusiveDisks and
>> + disk.name not in self.exclusiveDisks))
>>
>> + def _hideIgnoredDisks(self):
>> # hide any subtrees that begin with an ignored disk
>> for disk in [d for d in self._devices if d.isDisk]:
>> - if _is_ignored(disk):
>> + if self._isIgnoredDisk(disk):
>> ignored = True
>> # If the filter allows all members of a fwraid or mpath, the
>> # fwraid or mpath itself is implicitly allowed as well. I
>> don't
>> --
>> 1.9.3
>>
>> _______________________________________________
>> anaconda-patches mailing list
>> anaconda-patches at lists.fedorahosted.org
>> https://lists.fedorahosted.org/mailman/listinfo/anaconda-patches
>>
>
> - 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