summaryrefslogtreecommitdiff
path: root/nova/context.py
diff options
context:
space:
mode:
authorDan Smith <dansmith@redhat.com>2018-08-21 15:08:38 -0700
committerDan Smith <dansmith@redhat.com>2018-08-22 13:29:29 -0700
commitd4411a1876a498fa2f0e8811f8d5d608b8a17c95 (patch)
tree0f7266ec9862f58b237c75df590519c33c59ad5b /nova/context.py
parentb7c3dd8682a3f10cd1db8a004ef4087279e299f0 (diff)
downloadnova-d4411a1876a498fa2f0e8811f8d5d608b8a17c95.tar.gz
Stash the cell uuid on the context when targeting
This has been something we've needed for a while in order to do some optimization in places like multi_cell_list where we need to know which cell we are looking at during a scatter_gather operation. Change-Id: Ib47d4ed1072c9ee6b2d9d084e678c80a05604963
Diffstat (limited to 'nova/context.py')
-rw-r--r--nova/context.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/nova/context.py b/nova/context.py
index 399ecf02e0..0b345ab829 100644
--- a/nova/context.py
+++ b/nova/context.py
@@ -147,6 +147,7 @@ class RequestContext(context.RequestContext):
# provided by this module
self.db_connection = None
self.mq_connection = None
+ self.cell_uuid = None
self.user_auth_plugin = user_auth_plugin
if self.is_admin is None:
@@ -373,16 +374,19 @@ def set_target_cell(context, cell_mapping):
if not cell_mapping.transport_url.startswith('none'):
context.mq_connection = rpc.create_transport(
cell_mapping.transport_url)
+ context.cell_uuid = cell_mapping.uuid
CELL_CACHE[cell_mapping.uuid] = (context.db_connection,
context.mq_connection)
else:
context.db_connection = cell_tuple[0]
context.mq_connection = cell_tuple[1]
+ context.cell_uuid = cell_mapping.uuid
get_or_set_cached_cell_and_set_connections()
else:
context.db_connection = None
context.mq_connection = None
+ context.cell_uuid = None
@contextmanager