Re: [anaconda-storage-branch PATCH] Attempt disk commits 5 times before raising an exception.

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

 



On Thu, 2009-03-19 at 18:17 -1000, David Cantrell wrote:
> Hitting this periodically on my test systems.  The disk may or may
> not be capable of the ped_disk_commit_to_dev() call yet.  The disk
> is busy.  I don't want to use a Timer thread since we're using
> PyGTK and we'll get in to all sorts of problems if threads are
> brought it.  The poor man's try loop has been working for me today.

I hit this one a couple of times recently as well. This looks like a
good way to be at least a little more resilient.

> ---
>  storage/devices.py |   17 ++++++++++++++++-
>  1 files changed, 16 insertions(+), 1 deletions(-)
> 
> diff --git a/storage/devices.py b/storage/devices.py
> index 305b087..816cf6a 100644
> --- a/storage/devices.py
> +++ b/storage/devices.py
> @@ -782,7 +782,22 @@ class DiskDevice(StorageDevice):
>  
>          self.setupParents()
>          self.setup()
> -        self.partedDisk.commit()
> +
> +        # give committing 5 tries, failing that, raise an exception
> +        attempt = 1
> +        maxTries = 5
> +        keepTrying = True
> +
> +        while keepTrying and (attempt <= maxTries):
> +            try:
> +                self.partedDisk.commit()
> +                keepTrying = False
> +            except parted.DiskException as msg:
> +                log.warning(msg)
> +                attempt += 1
> +
> +        if keepTrying:
> +            raise DeviceError("cannot commit to disk %s after %d attempts" % (self.name, maxTries,))
>  
>      def destroy(self):
>          """ Destroy the 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