Context cleanup

Before the fix of bug #1386932 (285cfaf095)
was committed, there are a few hacks in Cinder where an original copy
of (un-elevated) context has to be saved before doing
context.elevated().  Now that we have the fix in place, it's time to
clean up those old hacks.

Change-Id: Ie3e5cb7398647b4619d294c572e920e6c3b6b9c9
Related-bug: #1386392
This commit is contained in:
Zhiteng Huang
2014-11-22 02:53:40 +08:00
parent ca37fbaea9
commit f8dc04fe3f
3 changed files with 6 additions and 30 deletions

View File

@@ -347,8 +347,7 @@ class VolumeManager(manager.SchedulerDependentManager):
source_replicaid=None, consistencygroup_id=None):
"""Creates the volume."""
context_saved = context.deepcopy()
context = context.elevated()
context_elevated = context.elevated()
if filter_properties is None:
filter_properties = {}
@@ -356,7 +355,7 @@ class VolumeManager(manager.SchedulerDependentManager):
# NOTE(flaper87): Driver initialization is
# verified by the task itself.
flow_engine = create_volume.get_flow(
context,
context_elevated,
self.db,
self.driver,
self.scheduler_rpcapi,
@@ -368,7 +367,7 @@ class VolumeManager(manager.SchedulerDependentManager):
source_replicaid=source_replicaid,
consistencygroup_id=consistencygroup_id,
allow_reschedule=allow_reschedule,
reschedule_context=context_saved,
reschedule_context=context,
request_spec=request_spec,
filter_properties=filter_properties)
except Exception: