create a new exception ZoneRequestError to use for returning errors when zone requests couldn't complete

This commit is contained in:
Chris Behrens
2011-09-07 23:24:07 -07:00
parent 342bb685c9
commit 2f48a465f9
2 changed files with 11 additions and 1 deletions

View File

@@ -806,3 +806,10 @@ class CannotResizeToSmallerSize(NovaException):
class ImageTooLarge(NovaException):
message = _("Image is larger than instance type allows")
class ZoneRequestError(Error):
def __init__(self, message=None):
if message is None:
message = _("1 or more Zones could not complete the request")
super(ZoneRequestError, self).__init__(message=message)

View File

@@ -168,7 +168,10 @@ def child_zone_helper(zone_list, func):
url = zone.api_url
LOG.warn(_("Failed request to zone; URL=%(url)s: %(e)s")
% locals())
return e
# This is being returned instead of raised, so that when results are
# processed in unmarshal_result() after the greenpool.imap completes,
# the exception can be raised there if no other zones had a response.
return exception.ZoneRequestError()
else:
return func(nova, zone)