From aa97ba926d5bf6bc81903c5d651ece308e9629c0 Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Fri, 7 Dec 2012 09:00:04 -0800 Subject: Use conductor for migration_get() This patch removes direct database accesses for looking up migrations by id, and instead queries conductor. Related to blueprint no-db-compute Change-Id: Ia7df121971b14b1eb4ce65063246968b3603309d --- nova/compute/manager.py | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/manager.py b/nova/compute/manager.py index fd8dc7d17..f0c0fe961 100644 --- a/nova/compute/manager.py +++ b/nova/compute/manager.py @@ -1625,8 +1625,7 @@ class ComputeManager(manager.SchedulerDependentManager): migration=None, migration_id=None): """Destroys the source instance.""" if not migration: - migration = self.db.migration_get(context.elevated(), - migration_id) + migration = self.conductor_api.migration_get(context, migration_id) self._notify_about_instance_usage(context, instance, "resize.confirm.start") @@ -1662,8 +1661,7 @@ class ComputeManager(manager.SchedulerDependentManager): """ if not migration: - migration = self.db.migration_get(context.elevated(), - migration_id) + migration = self.conductor_api.migration_get(context, migration_id) # NOTE(comstud): A revert_resize is essentially a resize back to # the old size, so we need to send a usage event here. @@ -1706,10 +1704,8 @@ class ComputeManager(manager.SchedulerDependentManager): in the database. """ - elevated = context.elevated() - if not migration: - migration = self.db.migration_get(elevated, migration_id) + migration = self.conductor_api.migration_get(context, migration_id) with self._error_out_instance_on_exception(context, instance['uuid'], reservations): @@ -1889,7 +1885,7 @@ class ComputeManager(manager.SchedulerDependentManager): instance_type=None): """Starts the migration of a running instance to another host.""" if not migration: - migration = self.db.migration_get(context.elevated(), migration_id) + migration = self.conductor_api.migration_get(context, migration_id) with self._error_out_instance_on_exception(context, instance['uuid'], reservations): if not instance_type: @@ -2026,8 +2022,7 @@ class ComputeManager(manager.SchedulerDependentManager): """ if not migration: - migration = self.db.migration_get(context.elevated(), - migration_id) + migration = self.conductor_api.migration_get(context, migration_id) try: self._finish_resize(context, instance, migration, disk_info, image) -- cgit