diff options
| author | Jenkins <jenkins@review.openstack.org> | 2012-08-10 23:31:45 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2012-08-10 23:31:45 +0000 |
| commit | 7c62170c67fc60b6fd0ddd0239c40b9238a372d6 (patch) | |
| tree | 243d828c8577a3b659234bd505c5253a51590cbd /nova/api | |
| parent | c998ebda59d71fb647b15866b26a2331226282ba (diff) | |
| parent | 13d25ed7dc0005f89a0522eff3bf5e5cda30fb07 (diff) | |
Merge changes I87ce041c,Iaca00958,I326b26c4
* changes:
Don't accept key_name if not enabled
Key min_count, max_count, ret_res_id off of ext.
Key availability_zone in create server off of ext.
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/availability_zone.py | 27 | ||||
| -rw-r--r-- | nova/api/openstack/compute/contrib/multiple_create.py | 27 | ||||
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 20 |
3 files changed, 68 insertions, 6 deletions
diff --git a/nova/api/openstack/compute/contrib/availability_zone.py b/nova/api/openstack/compute/contrib/availability_zone.py new file mode 100644 index 000000000..524f454ea --- /dev/null +++ b/nova/api/openstack/compute/contrib/availability_zone.py @@ -0,0 +1,27 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 OpenStack LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License + +from nova.api.openstack import extensions + + +class Availability_zone(extensions.ExtensionDescriptor): + """Add availability_zone to the Create Server v1.1 API""" + + name = "AvailabilityZone" + alias = "os-availability-zone" + namespace = ("http://docs.openstack.org/compute/ext/" + "availabilityzone/api/v1.1") + updated = "2012-08-09T00:00:00+00:00" diff --git a/nova/api/openstack/compute/contrib/multiple_create.py b/nova/api/openstack/compute/contrib/multiple_create.py new file mode 100644 index 000000000..9b3ca8a57 --- /dev/null +++ b/nova/api/openstack/compute/contrib/multiple_create.py @@ -0,0 +1,27 @@ +# vim: tabstop=4 shiftwidth=4 softtabstop=4 + +# Copyright 2012 OpenStack LLC. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License + +from nova.api.openstack import extensions + + +class Multiple_create(extensions.ExtensionDescriptor): + """Allow multiple create in the Create Server v1.1 API""" + + name = "MultipleCreate" + alias = "os-multiple-create" + namespace = ("http://docs.openstack.org/compute/ext/" + "multiplecreate/api/v1.1") + updated = "2012-08-07T00:00:00+00:00" diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 41742df15..e8ede37e7 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -641,22 +641,30 @@ class Controller(wsgi.Controller): raise exc.HTTPBadRequest(explanation=msg) # optional openstack extensions: - key_name = server_dict.get('key_name') + key_name = None + if self.ext_mgr.is_loaded('os-keypairs'): + key_name = server_dict.get('key_name') + user_data = None if self.ext_mgr.is_loaded('os-user-data'): user_data = server_dict.get('user_data') self._validate_user_data(user_data) - availability_zone = server_dict.get('availability_zone') + availability_zone = None + if self.ext_mgr.is_loaded('os-availability-zone'): + availability_zone = server_dict.get('availability_zone') block_device_mapping = None if self.ext_mgr.is_loaded('os-volumes'): block_device_mapping = server_dict.get('block_device_mapping') - ret_resv_id = server_dict.get('return_reservation_id', False) - - min_count = server_dict.get('min_count') - max_count = server_dict.get('max_count') + ret_resv_id = False + min_count = None + max_count = None + if self.ext_mgr.is_loaded('os-multiple-create'): + ret_resv_id = server_dict.get('return_reservation_id', False) + min_count = server_dict.get('min_count') + max_count = server_dict.get('max_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'. |
