Don't create a PartitionDevice for devices that do not exist (#489122).
On Thu, 2009-03-12 at 15:36 -0400, Chris Lumens wrote:
> This is a strange situation to be in, but there appears to be a corner case
> where parted cannot read the disk label despite there being a partition table
> on the disk. anaconda will prompt to create a new disk label. This means
> there's no partitions on the disk, but the list of partitions to probe still
> has the old partition list. So, we should just ignore devices that no longer
Looks good, but this is only part of the solution. We also need to check
the result of PartitionDeviceFactory in addUdevDevice and then return
immediately if it is None.
> storage/devices.py | 6 ++----
> 1 files changed, 2 insertions(+), 4 deletions(-)
> diff --git a/storage/devices.py b/storage/devices.py
> index ae1ad09..fd98056 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -173,9 +173,7 @@ def PartitionDeviceFactory(*args, **kwargs):
> parents = kwargs["parents"]
> if isinstance(parents, Device):
> parents = [parents]
> - # we receive a list of parents. look for the disk that contains the name
> - # if we dont find the name we will return PartitionDevice and let it raise
> - # the exception.
> + # we receive a list of parents. look for the disk that contains the name.
> for root in roots:
> for parent in parents:
> path = os.path.join(root,norm_name)
> @@ -194,7 +192,7 @@ def PartitionDeviceFactory(*args, **kwargs):
> return PartitionDevice(*args, **kwargs)
> # If we get here, we did not find anything.
> - return PartitionDevice(*args, **kwargs)
> + log.warning("unable to find parted device for %s" % norm_name)
> class Device(object):
> """ A generic device.
Anaconda-devel-list mailing list