diff --git a/cinder/compute/nova.py b/cinder/compute/nova.py index 13c0a51c349..1afd9ecc919 100644 --- a/cinder/compute/nova.py +++ b/cinder/compute/nova.py @@ -16,6 +16,7 @@ Handles all requests to Nova. """ +from keystoneauth1 import exceptions as ks_exc from keystoneauth1 import identity from keystoneauth1 import loading as ks_loading from novaclient import api_versions @@ -77,7 +78,7 @@ def _get_identity_endpoint_from_sc(context): if (not CONF[NOVA_GROUP].region_name or endpoint.get('region') == CONF[NOVA_GROUP].region_name): return endpoint.get(CONF[NOVA_GROUP].interface + 'URL') - raise nova_exceptions.EndpointNotFound() + raise ks_exc.EndpointNotFound() def novaclient(context, privileged_user=False, timeout=None, api_version=None): diff --git a/cinder/tests/unit/compute/test_nova.py b/cinder/tests/unit/compute/test_nova.py index 89239cd41e1..03b31cdb470 100644 --- a/cinder/tests/unit/compute/test_nova.py +++ b/cinder/tests/unit/compute/test_nova.py @@ -13,6 +13,7 @@ # under the License. import ddt +from keystoneauth1 import exceptions as ks_exc import mock from cinder.compute import nova @@ -171,11 +172,10 @@ class NovaClientTestCase(test.TestCase): global_request_id=self.ctx.request_id, timeout=None, extensions=nova.nova_extensions) - def test_novaclient_exceptions(self): - # This is to prevent regression if exceptions are - # removed from novaclient since the service catalog - # code does not have thorough tests. - self.assertTrue(hasattr(nova_exceptions, 'EndpointNotFound')) + def test_get_identity_endpoint_from_sc_endpoint_not_found(self): + ctxt = context.get_admin_context() + self.assertRaises(ks_exc.EndpointNotFound, + nova._get_identity_endpoint_from_sc, ctxt) class FakeNovaClient(object):