diff options
| author | Chris Behrens <cbehrens@codestud.com> | 2011-06-22 13:45:24 -0700 |
|---|---|---|
| committer | Chris Behrens <cbehrens@codestud.com> | 2011-06-22 13:45:24 -0700 |
| commit | 1f99e500a99a4d66639f04f2c723058c4d1dfc1d (patch) | |
| tree | 17f484a1ae7610f7c3ef473f2f333589329e4e98 /nova/api | |
| parent | 7cb4d3150bf0883944624d46bc458cfd25fa1c9a (diff) | |
Check API request for min_count/max_count for number of instances to build
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/create_instance_helper.py | 6 | ||||
| -rw-r--r-- | nova/api/openstack/servers.py | 9 |
2 files changed, 11 insertions, 4 deletions
diff --git a/nova/api/openstack/create_instance_helper.py b/nova/api/openstack/create_instance_helper.py index 436e524c1..3e055936c 100644 --- a/nova/api/openstack/create_instance_helper.py +++ b/nova/api/openstack/create_instance_helper.py @@ -114,6 +114,12 @@ class CreateInstanceHelper(object): name = name.strip() 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 = int(min_count) + if max_count: + max_count = int(max_count) try: inst_type = \ diff --git a/nova/api/openstack/servers.py b/nova/api/openstack/servers.py index b82a6de19..31ec46e8e 100644 --- a/nova/api/openstack/servers.py +++ b/nova/api/openstack/servers.py @@ -111,14 +111,15 @@ class Controller(object): extra_values = None result = None try: - extra_values, result = self.helper.create_instance( + extra_values, instances = self.helper.create_instance( req, body, self.compute_api.create) except faults.Fault, f: return f - instances = result - - (inst, ) = instances + # We can only return 1 instance via the API, if we happen to + # build more than one... instances is a list, so we'll just + # use the first one.. + inst = instances[0] for key in ['instance_type', 'image_ref']: inst[key] = extra_values[key] |
