From de2da83cfb895febcef58b972ed3ed0dff9ac064 Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Mon, 13 May 2013 15:53:22 +0100 Subject: compute.api call conductor ComputeTaskManager for live-migrate Before the compute api called the scheduler to perform live migrate. This change makes the compute api call the conductor, which in turn calls the scheduler. For those not using the conductor service, this does not add any extra rpc calls. This change in control flow means we can look to move live-migrate more related rpc calls into the conductor from both schduler driver and compute manager. part of blueprint live-migration-to-conductor Change-Id: I081c5e090921d69878d044839616a48f198ecb7d --- nova/compute/api.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'nova/compute') diff --git a/nova/compute/api.py b/nova/compute/api.py index 19c59bbd5..927476810 100644 --- a/nova/compute/api.py +++ b/nova/compute/api.py @@ -197,10 +197,20 @@ class API(base.Base): self.consoleauth_rpcapi = consoleauth_rpcapi.ConsoleAuthAPI() self.scheduler_rpcapi = scheduler_rpcapi.SchedulerAPI() self.compute_rpcapi = compute_rpcapi.ComputeAPI() + self._compute_task_api = None self.servicegroup_api = servicegroup.API() super(API, self).__init__(**kwargs) + @property + def compute_task_api(self): + if self._compute_task_api is None: + # TODO(alaski): Remove calls into here from conductor manager so + # that this isn't necessary. #1180540 + from nova import conductor + self._compute_task_api = conductor.ComputeTaskAPI() + return self._compute_task_api + def _instance_update(self, context, instance_uuid, **kwargs): """Update an instance in the database using kwargs as value.""" @@ -2501,8 +2511,11 @@ class API(base.Base): task_state=task_states.MIGRATING, expected_task_state=None) - self.scheduler_rpcapi.live_migration(context, block_migration, - disk_over_commit, instance, host_name) + self.compute_task_api.migrate_server(context, instance, + scheduler_hint={'host': host_name}, + live=True, rebuild=False, flavor=None, + block_migration=block_migration, + disk_over_commit=disk_over_commit) @check_instance_state(vm_state=[vm_states.ACTIVE, vm_states.STOPPED], task_state=[None]) -- cgit