Skip to content

Commit

Permalink
bug 861310
Browse files Browse the repository at this point in the history
Check if host list is not empty before trying to weigh the hosts.

Change-Id: I4014bf64951963088cdfaad1210fa9d23e7cc08b
  • Loading branch information
Sateesh Chodapuneedi committed Sep 29, 2011
1 parent ef22c00 commit 0546616
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nova/scheduler/base_scheduler.py
Expand Up @@ -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]
Expand Down

0 comments on commit 0546616

Please sign in to comment.