diff options
author | Jenkins <jenkins@review.openstack.org> | 2016-09-01 21:49:23 +0000 |
---|---|---|
committer | Gerrit Code Review <review@openstack.org> | 2016-09-01 21:49:23 +0000 |
commit | 8bd486594f5677e1e4a1f78495cfe5565022c274 (patch) | |
tree | a96ca92c4c565853f14e8c614c427f8d6a43ab78 /nova/context.py | |
parent | f3a1f92a1fc809ad7e73ad36f2db12f474366377 (diff) | |
parent | 4df0869e00f4316ebb41ed9cdf4d6a433227f4d0 (diff) | |
download | nova-8bd486594f5677e1e4a1f78495cfe5565022c274.tar.gz |
Merge "Move cell message queue switching and add caching"
Diffstat (limited to 'nova/context.py')
-rw-r--r-- | nova/context.py | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/nova/context.py b/nova/context.py index 313919f83d..5d464f034f 100644 --- a/nova/context.py +++ b/nova/context.py @@ -343,26 +343,18 @@ def authorize_quota_class_context(context, class_name): @contextmanager def target_cell(context, cell_mapping): - """Adds database and message queue connection information to the context + """Adds database connection information to the context for communicating with the given target cell. :param context: The RequestContext to add connection information :param cell_mapping: A objects.CellMapping object """ original_db_connection = context.db_connection - original_mq_connection = context.mq_connection - # avoid circular imports + # avoid circular import from nova import db - from nova import rpc db_connection_string = cell_mapping.database_connection context.db_connection = db.create_context_manager(db_connection_string) - # NOTE(melwitt): none:// url is a special value meaning do not switch - if not cell_mapping.transport_url.startswith('none'): - transport_url = cell_mapping.transport_url - context.mq_connection = rpc.create_transport(transport_url) - try: yield context finally: context.db_connection = original_db_connection - context.mq_connection = original_mq_connection |