Re: [PATCH] Don't create a PartitionDevice for devices that do not exist (#489122).

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

 



Ack.

On Thu, 2009-03-12 at 16:37 -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
> exist.
> ---
>  storage/devices.py    |    7 +++----
>  storage/devicetree.py |    4 ++++
>  2 files changed, 7 insertions(+), 4 deletions(-)
> 
> diff --git a/storage/devices.py b/storage/devices.py
> index ae1ad09..13d85b8 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,8 @@ 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)
> +        return None
>  
>  class Device(object):
>      """ A generic device.
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 49f551c..15da568 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -880,6 +880,8 @@ class DeviceTree(object):
>                                             minor=udev_device_get_minor(info), \
>                                             exists=True, \
>                                             parents=[disk])
> +                    if not device:
> +                        return
>                      self._addDevice(device)
>                      #self.ignoredDisks.append(name)
>  
> @@ -1012,6 +1014,8 @@ class DeviceTree(object):
>                                                  minor=udev_device_get_minor(info),
>                                                  exists=True,
>                                                  parents=[disk])
> +                if not device:
> +                    return
>                  self._addDevice(device)
>  
>          #

_______________________________________________
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