From 0546616926d7f95017405b4abb532a4517db7d90 Mon Sep 17 00:00:00 2001 From: Sateesh Chodapuneedi Date: Wed, 28 Sep 2011 18:07:22 +0530 Subject: bug 861310 Check if host list is not empty before trying to weigh the hosts. Change-Id: I4014bf64951963088cdfaad1210fa9d23e7cc08b --- nova/scheduler/base_scheduler.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nova/scheduler/base_scheduler.py b/nova/scheduler/base_scheduler.py index e8629ca92..132b8a493 100644 --- a/nova/scheduler/base_scheduler.py +++ b/nova/scheduler/base_scheduler.py @@ -56,6 +56,9 @@ class BaseScheduler(abstract_scheduler.AbstractScheduler): """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] -- cgit