summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-01-28 10:05:00 +0000
committerTarmac <>2011-01-28 10:05:00 +0000
commitbe89c642e335e76bcb304b2880a4fd8241783436 (patch)
treebcea341127a606a1b88d2e41051d03ebd4fbd3a6
parent381893d0ad7482d0cc15f6806fd0d509e7c95fcd (diff)
parentc5a691be561615073507b61dca5a9f8f768a48b1 (diff)
downloadnova-be89c642e335e76bcb304b2880a4fd8241783436.tar.gz
nova-be89c642e335e76bcb304b2880a4fd8241783436.tar.xz
nova-be89c642e335e76bcb304b2880a4fd8241783436.zip
Fixes simple scheduler to able to be run_instance by admins + availability zones.
-rw-r--r--nova/scheduler/simple.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/nova/scheduler/simple.py b/nova/scheduler/simple.py
index baf4966d4..0191ceb3d 100644
--- a/nova/scheduler/simple.py
+++ b/nova/scheduler/simple.py
@@ -43,7 +43,9 @@ class SimpleScheduler(chance.ChanceScheduler):
def schedule_run_instance(self, context, instance_id, *_args, **_kwargs):
"""Picks a host that is up and has the fewest running instances."""
instance_ref = db.instance_get(context, instance_id)
- if instance_ref['availability_zone'] and context.is_admin:
+ if (instance_ref['availability_zone']
+ and ':' in instance_ref['availability_zone']
+ and context.is_admin):
zone, _x, host = instance_ref['availability_zone'].partition(':')
service = db.service_get_by_args(context.elevated(), host,
'nova-compute')
@@ -75,7 +77,9 @@ class SimpleScheduler(chance.ChanceScheduler):
def schedule_create_volume(self, context, volume_id, *_args, **_kwargs):
"""Picks a host that is up and has the fewest volumes."""
volume_ref = db.volume_get(context, volume_id)
- if (':' in volume_ref['availability_zone']) and context.is_admin:
+ if (volume_ref['availability_zone']
+ and ':' in volume_ref['availability_zone']
+ and context.is_admin):
zone, _x, host = volume_ref['availability_zone'].partition(':')
service = db.service_get_by_args(context.elevated(), host,
'nova-volume')