nova: use EndpointNotFound from keystoneauth1
I16e0b6e55a9c9da04c4582f9be672018d37bf368 in python-novaclient 15.0.0 removed the EndpointNotFound class which breaks the cinder unit test "test_novaclient_exceptions". That test was added with change Iea3ff0405ef8cf9c5222a489d85f9d135ebd3652 in Ocata after novaclient 7.0.0 removed its service catalog code. The cinder novaclient module code was updated in I55613793c8f525a36ac74636f47d7ab76f5c7e39 (Pike) and Ie27f3b528dbfaa57fe354a84a93787e1618182a3 (Pike) to remove the hacked service catalog code but still checks the service catalog for an identity endpoint if cinder isn't configured with an auth_url for talking to nova. That code was raising novaclient.EndpointNotFound which is now gone, so this change swaps it to use EndpointNotFound from the keystoneauth1 library instead. Needed by: https://review.opendev.org/679295/ Change-Id: I4b03beba0f847d779b6f3031be7ac68925cc79f4 Closes-Bug: #1842440
This commit is contained in:
parent
2c3017ab26
commit
3cef55907b
@ -16,6 +16,7 @@
|
|||||||
Handles all requests to Nova.
|
Handles all requests to Nova.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
from keystoneauth1 import identity
|
from keystoneauth1 import identity
|
||||||
from keystoneauth1 import loading as ks_loading
|
from keystoneauth1 import loading as ks_loading
|
||||||
from novaclient import api_versions
|
from novaclient import api_versions
|
||||||
@ -77,7 +78,7 @@ def _get_identity_endpoint_from_sc(context):
|
|||||||
if (not CONF[NOVA_GROUP].region_name or
|
if (not CONF[NOVA_GROUP].region_name or
|
||||||
endpoint.get('region') == CONF[NOVA_GROUP].region_name):
|
endpoint.get('region') == CONF[NOVA_GROUP].region_name):
|
||||||
return endpoint.get(CONF[NOVA_GROUP].interface + 'URL')
|
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):
|
def novaclient(context, privileged_user=False, timeout=None, api_version=None):
|
||||||
|
@ -13,6 +13,7 @@
|
|||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
import ddt
|
import ddt
|
||||||
|
from keystoneauth1 import exceptions as ks_exc
|
||||||
import mock
|
import mock
|
||||||
|
|
||||||
from cinder.compute import nova
|
from cinder.compute import nova
|
||||||
@ -171,11 +172,10 @@ class NovaClientTestCase(test.TestCase):
|
|||||||
global_request_id=self.ctx.request_id,
|
global_request_id=self.ctx.request_id,
|
||||||
timeout=None, extensions=nova.nova_extensions)
|
timeout=None, extensions=nova.nova_extensions)
|
||||||
|
|
||||||
def test_novaclient_exceptions(self):
|
def test_get_identity_endpoint_from_sc_endpoint_not_found(self):
|
||||||
# This is to prevent regression if exceptions are
|
ctxt = context.get_admin_context()
|
||||||
# removed from novaclient since the service catalog
|
self.assertRaises(ks_exc.EndpointNotFound,
|
||||||
# code does not have thorough tests.
|
nova._get_identity_endpoint_from_sc, ctxt)
|
||||||
self.assertTrue(hasattr(nova_exceptions, 'EndpointNotFound'))
|
|
||||||
|
|
||||||
|
|
||||||
class FakeNovaClient(object):
|
class FakeNovaClient(object):
|
||||||
|
Loading…
Reference in New Issue
Block a user