]> review.fuel-infra Code Review - openstack-build/cinder-build.git/commitdiff
Handle correct exception raised by python-novaclient
authorIvan Kolodyazhny <e0ne@e0ne.info>
Wed, 28 Oct 2015 05:45:57 +0000 (07:45 +0200)
committerIvan Kolodyazhny <e0ne@e0ne.info>
Wed, 28 Oct 2015 05:50:15 +0000 (07:50 +0200)
We need to hanle both novaclient.exceptions.RequestTimeout
and requests.Timeout to make it works with a different
python-nocaclient versions.

Change-Id: Ib58101f12c87653aef97e055d22542acbeeee4a7
Closes-Bug: #1510790

cinder/compute/nova.py

index 58a349da5f32458cbc12e47966a8de083ec4173b..98101210b89590d2ed15255a974ed55cf10fb19f 100644 (file)
@@ -163,7 +163,7 @@ class API(base.Base):
     def has_extension(self, context, extension, timeout=None):
         try:
             nova_exts = nova_client.discover_extensions(NOVA_API_VERSION)
-        except request_exceptions.Timeout:
+        except (nova_exceptions.RequestTimeout, request_exceptions.Timeout):
             raise exception.APITimeout(service='Nova')
         return extension in [e.name for e in nova_exts]
 
@@ -196,5 +196,5 @@ class API(base.Base):
                               timeout=timeout).servers.get(server_id)
         except nova_exceptions.NotFound:
             raise exception.ServerNotFound(uuid=server_id)
-        except request_exceptions.Timeout:
+        except (nova_exceptions.RequestTimeout, request_exceptions.Timeout):
             raise exception.APITimeout(service='Nova')