]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Fix tuple usage error
authorJoshua Harlow <harlowja@yahoo-inc.com>
Wed, 4 Sep 2013 19:20:54 +0000 (12:20 -0700)
committerJoshua Harlow <harlowja@yahoo-inc.com>
Wed, 4 Sep 2013 19:20:54 +0000 (12:20 -0700)
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

index f07743565eaea834f0226d52498800d594ef015c..391250a6f33cf4e0010d6119b1213aea02d2e375 100644 (file)
@@ -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):