diff options
author | Chris Behrens <cbehrens@codestud.com> | 2011-09-08 20:07:18 +0000 |
---|---|---|
committer | Tarmac <> | 2011-09-08 20:07:18 +0000 |
commit | 1b5a4e553216376c44d6adb8af8aa425d0ec1b92 (patch) | |
tree | cb47e60a3143ebddba0ff777de582842e6048d30 | |
parent | a09d8123c6e7cea8f097fcdeb7f57cd75d682745 (diff) | |
parent | 7a0752ee27f037dba4b741c25b1615a367cece3d (diff) | |
download | nova-1b5a4e553216376c44d6adb8af8aa425d0ec1b92.tar.gz nova-1b5a4e553216376c44d6adb8af8aa425d0ec1b92.tar.xz nova-1b5a4e553216376c44d6adb8af8aa425d0ec1b92.zip |
Fix lp:844155
When using an abstract scheduler class, if no compute hosts are available locally, the checking of child zones is short circuited. I've removed the broken check.
-rw-r--r-- | nova/scheduler/abstract_scheduler.py | 3 | ||||
-rw-r--r-- | nova/tests/scheduler/test_abstract_scheduler.py | 22 |
2 files changed, 22 insertions, 3 deletions
diff --git a/nova/scheduler/abstract_scheduler.py b/nova/scheduler/abstract_scheduler.py index 7f17b642f..cb8db599f 100644 --- a/nova/scheduler/abstract_scheduler.py +++ b/nova/scheduler/abstract_scheduler.py @@ -269,9 +269,6 @@ class AbstractScheduler(driver.Scheduler): # Filter local hosts based on requirements ... filtered_hosts = self.filter_hosts(topic, request_spec, unfiltered_hosts) - if not filtered_hosts: - LOG.warn(_("No hosts available")) - return [] # weigh the selected hosts. # weighted_hosts = [{weight=weight, hostname=hostname, diff --git a/nova/tests/scheduler/test_abstract_scheduler.py b/nova/tests/scheduler/test_abstract_scheduler.py index 9bf128b13..5549ea453 100644 --- a/nova/tests/scheduler/test_abstract_scheduler.py +++ b/nova/tests/scheduler/test_abstract_scheduler.py @@ -372,6 +372,28 @@ class AbstractSchedulerTestCase(test.TestCase): self.assertEqual(fixture._decrypt_blob(test_data), json.dumps(test_data)) + def test_empty_local_hosts(self): + """ + Create a nested set of FakeZones, try to build multiple instances + and ensure that a select call returns the appropriate build plan. + """ + sched = FakeAbstractScheduler() + self.stubs.Set(sched, '_call_zone_method', fake_call_zone_method) + self.stubs.Set(nova.db, 'zone_get_all', fake_zone_get_all) + + zm = FakeZoneManager() + # patch this to have no local hosts + zm.service_states = {} + sched.set_zone_manager(zm) + + fake_context = {} + build_plan = sched.select(fake_context, + {'instance_type': {'memory_mb': 512}, + 'num_instances': 4}) + + # 0 from local zones, 12 from remotes + self.assertEqual(12, len(build_plan)) + class BaseSchedulerTestCase(test.TestCase): """Test case for Base Scheduler.""" |