FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Ubuntu > Ubuntu Development

 
 
LinkBack Thread Tools
 
Old 03-20-2009, 03:27 AM
David Lehman
 
Default Attempt disk commits 5 times before raising an exception.

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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 
Old 03-20-2009, 03:57 AM
David Cantrell
 
Default Attempt disk commits 5 times before raising an exception.

On 03/19/2009 06:27 PM, David Lehman wrote:

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.


Applied and pushed.
Thanks.




---
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@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list



--
David Cantrell <dcantrell@redhat.com>
Red Hat / Honolulu, HI

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 03:09 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org