summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/servers.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/nova/api/openstack/compute/servers.py b/nova/api/openstack/compute/servers.py
index 3464cfdbd..c21599300 100644
--- a/nova/api/openstack/compute/servers.py
+++ b/nova/api/openstack/compute/servers.py
@@ -134,6 +134,13 @@ class ServerAdminPassTemplate(xmlutil.TemplateBuilder):
return xmlutil.SlaveTemplate(root, 1, nsmap=server_nsmap)
+class ServerMultipleCreateTemplate(xmlutil.TemplateBuilder):
+ def construct(self):
+ root = xmlutil.TemplateElement('server')
+ root.set('reservation_id')
+ return xmlutil.MasterTemplate(root, 1, nsmap=server_nsmap)
+
+
def FullServerTemplate():
master = ServerTemplate()
master.attach(ServerAdminPassTemplate())
@@ -917,14 +924,9 @@ class Controller(wsgi.Controller):
# Let the caller deal with unhandled exceptions.
# If the caller wanted a reservation_id, return it
-
- # 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}
+ if ret_resv_id:
+ return wsgi.ResponseObject({'reservation_id': resv_id},
+ xml=ServerMultipleCreateTemplate)
req.cache_db_instances(instances)
server = self._view_builder.create(req, instances[0])