From d9eb3535254ca2d198c84cde6b2ea02997ab8808 Mon Sep 17 00:00:00 2001 From: Joshua Harlow Date: Wed, 4 Sep 2013 12:20:54 -0700 Subject: [PATCH] Fix tuple usage error The exc_info is just a tuple (captured in taskflow) and isn't itself a callable object so we should not need to use it like one to extract the exception type and value. Fixes bug #1220867 Change-Id: Ie27d004bad4053baa2ac8eb84bb8b7cdc05a954d --- cinder/volume/flows/create_volume/__init__.py | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/cinder/volume/flows/create_volume/__init__.py b/cinder/volume/flows/create_volume/__init__.py index f07743565..391250a6f 100644 --- a/cinder/volume/flows/create_volume/__init__.py +++ b/cinder/volume/flows/create_volume/__init__.py @@ -829,13 +829,21 @@ class OnFailureRescheduleTask(base.CinderTask): ] def _is_reschedulable(self, cause): - exc_type, value = cause.exc_info()[:2] - if not exc_type and cause.exc: - exc_type = type(cause.exc) - if not exc_type: - return True - if exc_type in self.no_reschedule_types: + # Figure out the type of the causes exception and compare it against + # our black-list of exception types that will not cause rescheduling. + exc_type, value = cause.exc_info[:2] + # If we don't have a type from exc_info but we do have a exception in + # the cause, try to get the type from that instead. + if not value: + value = cause.exc + if not exc_type and value: + exc_type = type(value) + if exc_type and exc_type in self.no_reschedule_types: return False + # Couldn't figure it out, by default assume whatever the cause was can + # be fixed by rescheduling. + # + # NOTE(harlowja): Crosses fingers. return True def __call__(self, context, *args, **kwargs): -- 2.45.2