From 96aea889d2b1046898f9993f064c9f92003cd233 Mon Sep 17 00:00:00 2001 From: John Garbutt Date: Wed, 29 May 2013 12:27:01 +0100 Subject: [PATCH] Move live-migration control flow from scheduler to conductor This builds on previous patches that moved code to the conductor and adding the conductor into the control path. We take care to ensure this works with a local conductor, but running the code in a greenlet thread, but this will work best when conductor is run as a standalone service. The next steps are to move more logic from the compute manager into the conductor, then to start supporting dealing with tasks that get stopped half way though execution. Part of blueprint live-migration-to-conductor Change-Id: I4120156db1499dfd3ed22095e528787eb73d33a6 --- nova/scheduler/manager.py | 3 +-- nova/scheduler/rpcapi.py | 11 +---------- nova/tests/scheduler/test_rpcapi.py | 6 ------ nova/tests/scheduler/test_scheduler.py | 2 +- 4 files changed, 3 insertions(+), 19 deletions(-) diff --git a/nova/scheduler/manager.py b/nova/scheduler/manager.py index 8e01fcee1..9d5d504d3 100644 --- a/nova/scheduler/manager.py +++ b/nova/scheduler/manager.py @@ -132,8 +132,7 @@ class SchedulerManager(manager.Manager): def _schedule_live_migration(self, context, instance, dest, block_migration, disk_over_commit): task = live_migrate.LiveMigrationTask(context, instance, - dest, block_migration, disk_over_commit, - self.driver.select_hosts) + dest, block_migration, disk_over_commit) return task.execute() def run_instance(self, context, request_spec, admin_password, diff --git a/nova/scheduler/rpcapi.py b/nova/scheduler/rpcapi.py index 794c03895..47c889aaf 100644 --- a/nova/scheduler/rpcapi.py +++ b/nova/scheduler/rpcapi.py @@ -71,6 +71,7 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): 2.8 - Deprecate prep_resize() -- JUST KIDDING. It is still used by the compute manager for retries. 2.9 - Added the leagacy_bdm_in_spec parameter to run_instances + 2.10 - Deprecated live_migration() call, moved to conductor ''' # @@ -122,16 +123,6 @@ class SchedulerAPI(nova.openstack.common.rpc.proxy.RpcProxy): filter_properties=filter_properties, reservations=reservations_p)) - def live_migration(self, ctxt, block_migration, disk_over_commit, - instance, dest): - # NOTE(comstud): Call vs cast so we can get exceptions back, otherwise - # this call in the scheduler driver doesn't return anything. - instance_p = jsonutils.to_primitive(instance) - return self.call(ctxt, self.make_msg('live_migration', - block_migration=block_migration, - disk_over_commit=disk_over_commit, instance=instance_p, - dest=dest)) - def update_service_capabilities(self, ctxt, service_name, host, capabilities): self.fanout_cast(ctxt, self.make_msg('update_service_capabilities', diff --git a/nova/tests/scheduler/test_rpcapi.py b/nova/tests/scheduler/test_rpcapi.py index ea65ed658..b63db380e 100644 --- a/nova/tests/scheduler/test_rpcapi.py +++ b/nova/tests/scheduler/test_rpcapi.py @@ -70,12 +70,6 @@ class SchedulerRpcAPITestCase(test.NoDBTestCase): request_spec='fake_request_spec', filter_properties='fake_props', reservations=list('fake_res')) - def test_live_migration(self): - self._test_scheduler_api('live_migration', rpc_method='call', - block_migration='fake_block_migration', - disk_over_commit='fake_disk_over_commit', - instance='fake_instance', dest='fake_dest') - def test_update_service_capabilities(self): self._test_scheduler_api('update_service_capabilities', rpc_method='fanout_cast', service_name='fake_name', diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py index fed1a585f..2d9660a9d 100644 --- a/nova/tests/scheduler/test_scheduler.py +++ b/nova/tests/scheduler/test_scheduler.py @@ -271,7 +271,7 @@ class SchedulerManagerTestCase(test.NoDBTestCase): instance = {'host': 'h'} self.mox.StubOutClassWithMocks(live_migrate, "LiveMigrationTask") task = live_migrate.LiveMigrationTask(self.context, instance, - "dest", "bm", "doc", self.manager.driver.select_hosts) + "dest", "bm", "doc") task.execute() self.mox.ReplayAll()