summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorGiampaolo Lauria <lauria@us.ibm.com>2013-01-25 10:44:23 -0500
committerGiampaolo Lauria <lauria@us.ibm.com>2013-01-29 12:55:14 -0500
commit2b602148be8ffa9aec377fc2c220464d9c43c885 (patch)
tree1f688cc0f15cae72a979063620ccfdc511f8ffb3 /nova/api
parent7a01888b3f663c2292dc4ed9ff36436fdffa9b3e (diff)
Fix get and update in FlavorExtraSpecs
Fixes bug 1105170 Added serializer test Change-Id: I365a81e17319fa96d53b53eafb6326fff8bde288
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/compute/contrib/flavorextraspecs.py14
1 files changed, 11 insertions, 3 deletions
diff --git a/nova/api/openstack/compute/contrib/flavorextraspecs.py b/nova/api/openstack/compute/contrib/flavorextraspecs.py
index c8deb7b4c..84f157b6a 100644
--- a/nova/api/openstack/compute/contrib/flavorextraspecs.py
+++ b/nova/api/openstack/compute/contrib/flavorextraspecs.py
@@ -34,6 +34,15 @@ class ExtraSpecsTemplate(xmlutil.TemplateBuilder):
return xmlutil.MasterTemplate(xmlutil.make_flat_dict('extra_specs'), 1)
+class ExtraSpecTemplate(xmlutil.TemplateBuilder):
+ def construct(self):
+ sel = xmlutil.Selector(xmlutil.get_items, 0)
+ root = xmlutil.TemplateElement('extra_spec', selector=sel)
+ root.set('key', 0)
+ root.text = 1
+ return xmlutil.MasterTemplate(root, 1)
+
+
class FlavorExtraSpecsController(object):
"""The flavor extra specs API controller for the OpenStack API."""
@@ -70,7 +79,7 @@ class FlavorExtraSpecsController(object):
raise exc.HTTPBadRequest(explanation=unicode(error))
return body
- @wsgi.serializers(xml=ExtraSpecsTemplate)
+ @wsgi.serializers(xml=ExtraSpecTemplate)
def update(self, req, flavor_id, id, body):
context = req.environ['nova.context']
authorize(context)
@@ -87,10 +96,9 @@ class FlavorExtraSpecsController(object):
body)
except exception.MetadataLimitExceeded as error:
raise exc.HTTPBadRequest(explanation=unicode(error))
-
return body
- @wsgi.serializers(xml=ExtraSpecsTemplate)
+ @wsgi.serializers(xml=ExtraSpecTemplate)
def show(self, req, flavor_id, id):
"""Return a single extra spec item."""
context = req.environ['nova.context']