From: Ivan Kolodyazhny Date: Wed, 28 Oct 2015 05:45:57 +0000 (+0200) Subject: Handle correct exception raised by python-novaclient X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=99dc6d34754954a27f6998406a94743c41b93981;p=openstack-build%2Fcinder-build.git Handle correct exception raised by python-novaclient 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 --- diff --git a/cinder/compute/nova.py b/cinder/compute/nova.py index 58a349da5..98101210b 100644 --- a/cinder/compute/nova.py +++ b/cinder/compute/nova.py @@ -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')