summaryrefslogtreecommitdiffstats
path: root/nova
diff options
context:
space:
mode:
authorVishvananda Ishaya <vishvananda@gmail.com>2011-01-27 14:14:10 -0800
committerVishvananda Ishaya <vishvananda@gmail.com>2011-01-27 14:14:10 -0800
commitc5a691be561615073507b61dca5a9f8f768a48b1 (patch)
treed1aaf80452cde3e26f3d4409b1b5a4272f1107e0 /nova
parent05f49c2942d53e648f07300754fdd4338c0964cf (diff)
downloadnova-c5a691be561615073507b61dca5a9f8f768a48b1.tar.gz
nova-c5a691be561615073507b61dca5a9f8f768a48b1.tar.xz
nova-c5a691be561615073507b61dca5a9f8f768a48b1.zip
makes sure that : is in the availability zone before it attempts to use it to send instances to a particular host
Diffstat (limited to 'nova')
-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')