Merge "Remove cast_to_network from scheduler."
This commit is contained in:
@@ -124,22 +124,12 @@ def cast_to_compute_host(context, host, method, **kwargs):
|
||||
LOG.debug(_("Casted '%(method)s' to compute '%(host)s'") % locals())
|
||||
|
||||
|
||||
def cast_to_network_host(context, host, method, **kwargs):
|
||||
"""Cast request to a network host queue"""
|
||||
|
||||
rpc.cast(context,
|
||||
rpc.queue_get_for(context, 'network', host),
|
||||
{"method": method, "args": kwargs})
|
||||
LOG.debug(_("Casted '%(method)s' to network '%(host)s'") % locals())
|
||||
|
||||
|
||||
def cast_to_host(context, topic, host, method, **kwargs):
|
||||
"""Generic cast to host"""
|
||||
|
||||
topic_mapping = {
|
||||
"compute": cast_to_compute_host,
|
||||
"volume": cast_to_volume_host,
|
||||
'network': cast_to_network_host}
|
||||
"volume": cast_to_volume_host}
|
||||
|
||||
func = topic_mapping.get(topic)
|
||||
if func:
|
||||
|
||||
@@ -740,24 +740,6 @@ class SchedulerDriverModuleTestCase(test.TestCase):
|
||||
driver.cast_to_compute_host(self.context, host, method,
|
||||
**fake_kwargs)
|
||||
|
||||
def test_cast_to_network_host(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, 'network', host).AndReturn(queue)
|
||||
rpc.cast(self.context, queue,
|
||||
{'method': method,
|
||||
'args': fake_kwargs})
|
||||
|
||||
self.mox.ReplayAll()
|
||||
driver.cast_to_network_host(self.context, host, method,
|
||||
**fake_kwargs)
|
||||
|
||||
def test_cast_to_host_compute_topic(self):
|
||||
host = 'fake_host1'
|
||||
method = 'fake_method'
|
||||
@@ -784,19 +766,6 @@ class SchedulerDriverModuleTestCase(test.TestCase):
|
||||
driver.cast_to_host(self.context, 'volume', host, method,
|
||||
**fake_kwargs)
|
||||
|
||||
def test_cast_to_host_network_topic(self):
|
||||
host = 'fake_host1'
|
||||
method = 'fake_method'
|
||||
fake_kwargs = {'extra_arg': 'meow'}
|
||||
|
||||
self.mox.StubOutWithMock(driver, 'cast_to_network_host')
|
||||
driver.cast_to_network_host(self.context, host, method,
|
||||
**fake_kwargs)
|
||||
|
||||
self.mox.ReplayAll()
|
||||
driver.cast_to_host(self.context, 'network', host, method,
|
||||
**fake_kwargs)
|
||||
|
||||
def test_cast_to_host_unknown_topic(self):
|
||||
host = 'fake_host1'
|
||||
method = 'fake_method'
|
||||
|
||||
Reference in New Issue
Block a user