diff options
| author | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2011-09-07 13:37:29 -0500 |
|---|---|---|
| committer | Kevin L. Mitchell <kevin.mitchell@rackspace.com> | 2011-09-07 13:37:29 -0500 |
| commit | 262b5cf6e8bd577d2b08fb92e6da56f8bcdecd57 (patch) | |
| tree | e3566f1164faf570f4447d08bd2edd8a57f68c2f /nova/scheduler | |
| parent | 560698829e4c7168053775e7e5e9f1e92bb98fa8 (diff) | |
weigh_hosts() needs to return a list of hosts for the instances, not just a list of hosts
Diffstat (limited to 'nova/scheduler')
| -rw-r--r-- | nova/scheduler/base_scheduler.py | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/nova/scheduler/base_scheduler.py b/nova/scheduler/base_scheduler.py index 35e5af035..e9c078b81 100644 --- a/nova/scheduler/base_scheduler.py +++ b/nova/scheduler/base_scheduler.py @@ -55,5 +55,17 @@ class BaseScheduler(abstract_scheduler.AbstractScheduler): scheduling objectives """ # NOTE(sirp): The default logic is the same as the NoopCostFunction - return [dict(weight=1, hostname=hostname, capabilities=capabilities) - for hostname, capabilities in hosts] + hosts = [dict(weight=1, hostname=hostname, capabilities=capabilities) + for hostname, capabilities in hosts] + + # NOTE(Vek): What we actually need to return is enough hosts + # for all the instances! + num_instances = request_spec.get('num_instances', 1) + instances = [] + while num_instances > len(hosts): + instances.extend(hosts) + num_instances -= len(hosts) + if num_instances > 0: + instances.extend(hosts[:num_instances]) + + return instances |
