Do not use service catalog for cache client

Previously cache client used endpoints from service catalog to
request cache items from node. It works perfectly on devstack
but it doesn't work when an OpenStack cloud is deployed with HA
(3/5/7 controllers). We need to use -H option instead.
This option makes cache management client interact with the local
endpoint which is more appropriate as image cache is local to
each node/controller.

Change-Id: I355fb36d9af7e06dcac70b8263dc1a2b915ffc8f
Closes-Bug: #1634486
This commit is contained in:
kairat_kushaev 2016-11-03 13:21:05 +03:00 committed by Kairat Kushaev
parent 81d321b6d4
commit 616060db65
2 changed files with 11 additions and 1 deletions

View File

@ -128,4 +128,5 @@ def get_client(host, port=None, timeout=None, use_ssl=False, username=None,
auth_token=auth_token or
os.getenv('OS_TOKEN'),
creds=creds,
insecure=insecure)
insecure=insecure,
configure_via_auth=False)

View File

@ -116,6 +116,15 @@ class GetClientTestCase(utils.BaseTestCase):
).creds
self.assertEqual(expected_creds, creds)
def test_get_client_using_provided_host(self):
cli = client.get_client(self.host)
cli._do_request = mock.MagicMock()
cli.configure_from_url = mock.MagicMock()
cli.auth_plugin.management_url = mock.MagicMock()
cli.do_request("GET", "/queued_images")
self.assertFalse(cli.configure_from_url.called)
self.assertFalse(client.get_client(self.host).configure_via_auth)
def test_get_client_client_configuration_error(self):
self.assertRaises(exception.ClientConfigurationError,
client.get_client, self.host, username='name',