Clean up ClientRouter debt

This removes the two deprecated by_instance() and by_host() methods
in ClientRouter and replaces them with calls to a single client()
routine. We stopped using the instance and host parameters in these
methods in an earlier patch to remove the caching in the router.

Related to blueprint cells-aware-api

Change-Id: Ifa7cd99a442ef0f8e9ad4a6b52982d0fedf1cd7e
This commit is contained in:
Dan Smith
2017-03-10 10:07:39 -08:00
parent fe91dcd9e9
commit faa65728bb
4 changed files with 84 additions and 168 deletions

View File

@@ -410,24 +410,11 @@ class ClientRouter(periodic_task.PeriodicTasks):
# Prevent this empty context from overwriting the thread local copy
self.run_periodic_tasks(nova.context.RequestContext(overwrite=False))
def _client(self, context, transport=None):
def client(self, context):
transport = context.mq_connection
if transport:
return messaging.RPCClient(transport, self.target,
version_cap=self.version_cap,
serializer=self.serializer)
else:
return self.default_client
def by_instance(self, context, instance):
"""Deprecated."""
if context.mq_connection:
return self._client(context, transport=context.mq_connection)
else:
return self.default_client
def by_host(self, context, host):
"""Deprecated."""
if context.mq_connection:
return self._client(context, transport=context.mq_connection)
else:
return self.default_client