diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-11-27 04:21:28 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-11-27 04:21:28 +0000 |
| commit | 4e4a91c17c840b64d8d2b4de703b3839c09b209d (patch) | |
| tree | e60904aa617ef853b7b39343ca7107d153046065 | |
| parent | 587a943a45a54039b67608a843b20b6e1999247b (diff) | |
| parent | 77f212bc3fb8f927c6c2c2c21c1b62d39c1c51ec (diff) | |
| download | nova-4e4a91c17c840b64d8d2b4de703b3839c09b209d.tar.gz nova-4e4a91c17c840b64d8d2b4de703b3839c09b209d.tar.xz nova-4e4a91c17c840b64d8d2b4de703b3839c09b209d.zip | |
Merge "Clean up unused methods in scheduler/driver"
| -rw-r--r-- | nova/scheduler/driver.py | 29 | ||||
| -rw-r--r-- | nova/tests/scheduler/test_scheduler.py | 74 |
2 files changed, 0 insertions, 103 deletions
diff --git a/nova/scheduler/driver.py b/nova/scheduler/driver.py index c5523f229..99636379e 100644 --- a/nova/scheduler/driver.py +++ b/nova/scheduler/driver.py @@ -96,35 +96,6 @@ def instance_update_db(context, instance_uuid): return db.instance_update(context, instance_uuid, values) -def cast_to_compute_host(context, host, method, **kwargs): - """Cast request to a compute host queue""" - - instance_uuid = kwargs.get('instance_uuid', None) - if instance_uuid: - instance_update_db(context, instance_uuid) - - rpc.cast(context, - rpc.queue_get_for(context, CONF.compute_topic, host), - {"method": method, "args": kwargs}) - LOG.debug(_("Casted '%(method)s' to compute '%(host)s'") % locals()) - - -def cast_to_host(context, topic, host, method, **kwargs): - """Generic cast to host""" - - topic_mapping = {CONF.compute_topic: cast_to_compute_host} - - func = topic_mapping.get(topic) - if func: - cast_to_compute_host(context, host, method, **kwargs) - else: - rpc.cast(context, - rpc.queue_get_for(context, topic, host), - {"method": method, "args": kwargs}) - LOG.debug(_("Casted '%(method)s' to %(topic)s '%(host)s'") - % locals()) - - def encode_instance(instance, local=True): """Encode locally created instance for return via RPC""" # TODO(comstud): I would love to be able to return the full diff --git a/nova/tests/scheduler/test_scheduler.py b/nova/tests/scheduler/test_scheduler.py index 475807b3b..105240775 100644 --- a/nova/tests/scheduler/test_scheduler.py +++ b/nova/tests/scheduler/test_scheduler.py @@ -639,80 +639,6 @@ class SchedulerDriverModuleTestCase(test.TestCase): super(SchedulerDriverModuleTestCase, self).setUp() self.context = context.RequestContext('fake_user', 'fake_project') - def test_cast_to_compute_host_update_db_with_instance_uuid(self): - host = 'fake_host1' - method = 'fake_method' - fake_kwargs = {'instance_uuid': 'fake_uuid', - 'extra_arg': 'meow'} - queue = 'fake_queue' - - self.mox.StubOutWithMock(timeutils, 'utcnow') - self.mox.StubOutWithMock(db, 'instance_update') - self.mox.StubOutWithMock(rpc, 'queue_get_for') - self.mox.StubOutWithMock(rpc, 'cast') - - timeutils.utcnow().AndReturn('fake-now') - db.instance_update(self.context, 'fake_uuid', - {'host': None, 'node': None, 'scheduled_at': 'fake-now'}) - rpc.queue_get_for(self.context, 'compute', host).AndReturn(queue) - rpc.cast(self.context, queue, - {'method': method, - 'args': fake_kwargs}) - - self.mox.ReplayAll() - driver.cast_to_compute_host(self.context, host, method, - **fake_kwargs) - - def test_cast_to_compute_host_update_db_without_instance_uuid(self): - host = 'fake_host1' - method = 'fake_method' - fake_kwargs = {'extra_arg': 'meow'} - queue = 'fake_queue' - - self.mox.StubOutWithMock(rpc, 'queue_get_for') - self.mox.StubOutWithMock(rpc, 'cast') - - rpc.queue_get_for(self.context, 'compute', host).AndReturn(queue) - rpc.cast(self.context, queue, - {'method': method, - 'args': fake_kwargs}) - - self.mox.ReplayAll() - driver.cast_to_compute_host(self.context, host, method, - **fake_kwargs) - - def test_cast_to_host_compute_topic(self): - host = 'fake_host1' - method = 'fake_method' - fake_kwargs = {'extra_arg': 'meow'} - - self.mox.StubOutWithMock(driver, 'cast_to_compute_host') - driver.cast_to_compute_host(self.context, host, method, - **fake_kwargs) - - self.mox.ReplayAll() - driver.cast_to_host(self.context, 'compute', host, method, - **fake_kwargs) - - def test_cast_to_host_unknown_topic(self): - host = 'fake_host1' - method = 'fake_method' - fake_kwargs = {'extra_arg': 'meow'} - topic = 'unknown' - queue = 'fake_queue' - - self.mox.StubOutWithMock(rpc, 'queue_get_for') - self.mox.StubOutWithMock(rpc, 'cast') - - rpc.queue_get_for(self.context, topic, host).AndReturn(queue) - rpc.cast(self.context, queue, - {'method': method, - 'args': fake_kwargs}) - - self.mox.ReplayAll() - driver.cast_to_host(self.context, topic, host, method, - **fake_kwargs) - def test_encode_instance(self): instance = {'id': 31337, 'test_arg': 'meow'} |
