diff options
| author | Matthew Treinish <treinish@linux.vnet.ibm.com> | 2012-10-04 10:20:58 -0400 |
|---|---|---|
| committer | Matthew Treinish <treinish@linux.vnet.ibm.com> | 2012-10-04 15:59:49 -0400 |
| commit | 903b51e148c2f9e858b5ea0ca5b230ac308d76c5 (patch) | |
| tree | cfd7634a8e69658fa464e1d85386699e9ffef41e /nova/api | |
| parent | 3c8ed4ec14cab8ae6ac4f88286baac090800fa94 (diff) | |
Fix XML response for return_reservation_id.
The XML serializer for create uses the server template for it's response.
However, when return_reservation_id is set, only a reservation_id is
going to be returned.
To enable the XML response to be serialized the reservation id is now
returned in a server tag/object.
This commit fixes bug 1061124
Change-Id: Ic74071b1d527c3f3752e296d3fd46a28a99beb76
Signed-off-by: Matthew Treinish <treinish@linux.vnet.ibm.com>
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/servers.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py index 07731e3ba..89eac8bfd 100644 --- a/nova/api/openstack/compute/servers.py +++ b/nova/api/openstack/compute/servers.py @@ -66,6 +66,7 @@ def make_server(elem, detailed=False): elem.set('accessIPv6') elem.set('status') elem.set('progress') + elem.set('reservation_id') # Attach image node image = xmlutil.SubTemplateElement(elem, 'image', selector='image') @@ -889,7 +890,13 @@ class Controller(wsgi.Controller): # Let the caller deal with unhandled exceptions. # If the caller wanted a reservation_id, return it - if ret_resv_id: + + # NOTE(treinish): XML serialization will not work without a root + # selector of 'server' however JSON return is not expecting a server + # field/object + if ret_resv_id and (req.get_content_type() == 'application/xml'): + return {'server': {'reservation_id': resv_id}} + elif ret_resv_id: return {'reservation_id': resv_id} req.cache_db_instances(instances) |
