summaryrefslogtreecommitdiffstats
path: root/nova/api
diff options
context:
space:
mode:
authorEoghan Glynn <eglynn@redhat.com>2012-07-30 16:23:11 +0100
committerEoghan Glynn <eglynn@redhat.com>2012-08-14 19:14:51 +0100
commit3b6207976a51d33ee2ec701d21fa2a0cc6eca2e8 (patch)
tree99323df4740f01c6a1f9eb5b93d7bf8d6b110fe8 /nova/api
parent9deb489a8ba5ca2417787ba5e5429a60cf1712c2 (diff)
downloadnova-3b6207976a51d33ee2ec701d21fa2a0cc6eca2e8.tar.gz
nova-3b6207976a51d33ee2ec701d21fa2a0cc6eca2e8.tar.xz
nova-3b6207976a51d33ee2ec701d21fa2a0cc6eca2e8.zip
Allow XML payload for volume creation.
Fixes nova-volume aspect of LP 1030330 Tolerate volume size attribute of type string as opposed to int. Change-Id: I7cccb760a246d562792dec1669d634803bb9bc57
Diffstat (limited to 'nova/api')
-rw-r--r--nova/api/openstack/volume/volumes.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/nova/api/openstack/volume/volumes.py b/nova/api/openstack/volume/volumes.py
index 4c12638b4..ec9a47a74 100644
--- a/nova/api/openstack/volume/volumes.py
+++ b/nova/api/openstack/volume/volumes.py
@@ -218,7 +218,17 @@ class VolumeController(object):
raise exc.HTTPUnprocessableEntity()
volume = body['volume']
- size = volume['size']
+
+ def as_int(s):
+ try:
+ return int(s)
+ except ValueError:
+ return s
+
+ # NOTE(eglynn): we're tolerant of non-int sizes here, as type
+ # integrity is enforced later in the creation codepath
+ size = as_int(volume['size'])
+
LOG.audit(_("Create volume of %s GB"), size, context=context)
kwargs = {}