summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorChris Behrens <cbehrens@codestud.com>2011-06-29 12:23:26 -0700
committerChris Behrens <cbehrens@codestud.com>2011-06-29 12:23:26 -0700
commit851802e772095b646a7570bf0cc0c6d32be4643c (patch)
tree96ccd72a48cae858f3d35b18d06500c26adf8fe8 /nova/api
parent6af4a9ded53efe4ca5c3aad1f3a621cc73513fb0 (diff)
downloadnova-851802e772095b646a7570bf0cc0c6d32be4643c.tar.gz
nova-851802e772095b646a7570bf0cc0c6d32be4643c.tar.xz
nova-851802e772095b646a7570bf0cc0c6d32be4643c.zip
Fixed indentation issues
Fixed min/max_count checking issues Fixed a wrongly log message when zone aware scheduler finds no suitable hosts
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/create_instance_helper.py11
-rw-r--r--nova/api/openstack/servers.py12
2 files changed, 15 insertions, 8 deletions
diff --git a/nova/api/openstack/create_instance_helper.py b/nova/api/openstack/create_instance_helper.py
index 4c6cc0f83..2cc38911a 100644
--- a/nova/api/openstack/create_instance_helper.py
+++ b/nova/api/openstack/create_instance_helper.py
@@ -116,9 +116,16 @@ class CreateInstanceHelper(object):
reservation_id = body['server'].get('reservation_id')
min_count = body['server'].get('min_count')
max_count = body['server'].get('max_count')
- if min_count:
+ # min_count and max_count are optional. If they exist, they come
+ # in as strings. We want to default 'min_count' to 1, and default
+ # 'max_count' to be 'min_count'.
+ if not min_count:
+ min_count = 1
+ else:
min_count = int(min_count)
- if max_count:
+ if not max_count:
+ max_count = min_count
+ else:
max_count = int(max_count)
if min_count > max_count:
min_count = max_count
diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py
index decbfd6e6..66ef97af0 100644
--- a/nova/api/openstack/servers.py
+++ b/nova/api/openstack/servers.py
@@ -83,11 +83,11 @@ class Controller(object):
recurse_zones = query_str.get('recurse_zones')
recurse_zones = recurse_zones and True or False
instance_list = self.compute_api.get_all(
- req.environ['nova.context'],
- reservation_id=reservation_id,
- project_id=project_id,
- fixed_ip=fixed_ip,
- recurse_zones=recurse_zones)
+ req.environ['nova.context'],
+ reservation_id=reservation_id,
+ project_id=project_id,
+ fixed_ip=fixed_ip,
+ recurse_zones=recurse_zones)
limited_list = self._limit_items(instance_list, req)
builder = self._get_view_builder(req)
servers = [builder.build(inst, is_detail)['server']
@@ -120,7 +120,7 @@ class Controller(object):
result = None
try:
extra_values, instances = self.helper.create_instance(
- req, body, self.compute_api.create)
+ req, body, self.compute_api.create)
except faults.Fault, f:
return f