From 8cf635b08a57a9e3be2bef980ef38cf857b6525a Mon Sep 17 00:00:00 2001 From: Mark McLoughlin Date: Wed, 29 Aug 2012 09:21:03 +0100 Subject: Stop using scheduler RPC API magic If a scheduler RPC message isn't handled directly by a SchedulerManager method, the __getattr__() fallback passes the message to a driver method in the form of schedule_${method}() and, if that doesn't exist, instead calls the schedule() method supplying the topic and method args. This is pretty bizarre stuff and we appear to only use it in two cases: 1) live_migration - this is how the schedule_live_migration() method in the driver gets called, but the side-effect is that we require the client to pass a topic argument which is never used. This would be much more sanely handled with an explicit SchedulerManager.live_migration() method. 2) create_volume - the volume API asks the scheduler to pick a target host for create_volume() using this method. This would be easily handled with an SchedulerManager.create_volume() method. Change-Id: I1047489d85ac51d8d36fea1c4eb858df638ce349 --- nova/tests/scheduler/test_rpcapi.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'nova/tests/scheduler/test_rpcapi.py') diff --git a/nova/tests/scheduler/test_rpcapi.py b/nova/tests/scheduler/test_rpcapi.py index a2fee64b2..95133622b 100644 --- a/nova/tests/scheduler/test_rpcapi.py +++ b/nova/tests/scheduler/test_rpcapi.py @@ -86,10 +86,16 @@ class SchedulerRpcAPITestCase(test.TestCase): 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', topic='fake_topic', - version='1.3') + instance='fake_instance', dest='fake_dest', + version='1.7') def test_update_service_capabilities(self): self._test_scheduler_api('update_service_capabilities', rpc_method='fanout_cast', service_name='fake_name', host='fake_host', capabilities='fake_capabilities') + + def test_create_volume(self): + self._test_scheduler_api('create_volume', + rpc_method='cast', volume_id="fake_volume", + snapshot_id="fake_snapshots", reservations=list('fake_res'), + version='1.7') -- cgit