diff --git a/nova/scheduler/base_scheduler.py b/nova/scheduler/base_scheduler.py index e8629ca92c2..132b8a49379 100644 --- a/nova/scheduler/base_scheduler.py +++ b/nova/scheduler/base_scheduler.py @@ -56,6 +56,9 @@ def weigh_hosts(self, topic, request_spec, hosts): """Derived classes may override this to provide more sophisticated scheduling objectives """ + # Make sure if there are compute hosts to serve the request. + if not hosts: + return [] # NOTE(sirp): The default logic is the same as the NoopCostFunction hosts = [dict(weight=1, hostname=hostname, capabilities=capabilities) for hostname, capabilities in hosts]