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:
17
nova/rpc.py
17
nova/rpc.py
@@ -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
|
||||
|
Reference in New Issue
Block a user