summaryrefslogtreecommitdiffstats
path: root/nova/tests/scheduler/test_chance_scheduler.py
diff options
context:
space:
mode:
authorTiago Mello <tmello@linux.vnet.ibm.com>2013-06-05 20:52:07 -0300
committerTiago Mello <tmello@linux.vnet.ibm.com>2013-06-06 01:16:19 -0300
commitcb49e5407cc1db0cd3533b57a12ec99a7179abd7 (patch)
tree9020a6970fb1c85a0fa2fc5607333277272d0e89 /nova/tests/scheduler/test_chance_scheduler.py
parent86e12403ccb851199457bd0eaadc3f1d3c75679f (diff)
downloadnova-cb49e5407cc1db0cd3533b57a12ec99a7179abd7.tar.gz
nova-cb49e5407cc1db0cd3533b57a12ec99a7179abd7.tar.xz
nova-cb49e5407cc1db0cd3533b57a12ec99a7179abd7.zip
Refactors scheduler.chance.select_hosts to raise NoValidHost
This change is intended to refactor the method to be consistent with the filter_scheduler.select_hosts implementation. This method is called by scheduler.manager and it is exposed through the scheduler.rpcapi. Thus, both implementations should behave the same. This change is needed by others that will move cold migration to conductor. Partially implements bp cold-migrations-to-conductor Change-Id: I0f6fef43324cf829cdb26633874c537572423f77
Diffstat (limited to 'nova/tests/scheduler/test_chance_scheduler.py')
-rw-r--r--nova/tests/scheduler/test_chance_scheduler.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/nova/tests/scheduler/test_chance_scheduler.py b/nova/tests/scheduler/test_chance_scheduler.py
index a589000cd..8a281073a 100644
--- a/nova/tests/scheduler/test_chance_scheduler.py
+++ b/nova/tests/scheduler/test_chance_scheduler.py
@@ -194,3 +194,12 @@ class ChanceSchedulerTestCase(test_scheduler.SchedulerTestCase):
self.mox.ReplayAll()
hosts = self.driver.select_hosts(ctxt, request_spec, {})
self.assertEquals(['host3', 'host1'], hosts)
+
+ def test_select_hosts_no_valid_host(self):
+
+ def _return_no_host(*args, **kwargs):
+ return []
+
+ self.stubs.Set(self.driver, '_schedule', _return_no_host)
+ self.assertRaises(exception.NoValidHost,
+ self.driver.select_hosts, self.context, {}, {})