summaryrefslogtreecommitdiffstats
path: root/nova/volume/api.py
diff options
context:
space:
mode:
authorMike Perez <thingee@gmail.com>2012-07-20 09:12:50 -0700
committerMike Perez <thingee@gmail.com>2012-07-20 09:15:14 -0700
commitac5df2277968598914aeb803f5d7b57fabe876f0 (patch)
tree07762291e513dbb8adb766764e0ce6edac384c5a /nova/volume/api.py
parentbeb15b5e76312d9100b84d5a80af7ce2e1f57c9b (diff)
downloadnova-ac5df2277968598914aeb803f5d7b57fabe876f0.tar.gz
nova-ac5df2277968598914aeb803f5d7b57fabe876f0.tar.xz
nova-ac5df2277968598914aeb803f5d7b57fabe876f0.zip
Don't create volumes if an incorrect size was given
backported from cinder bug 1006875 Change-Id: I5f327dc0278413575e8c686b2db3b6000f19c4c7
Diffstat (limited to 'nova/volume/api.py')
-rw-r--r--nova/volume/api.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/nova/volume/api.py b/nova/volume/api.py
index ee079021a..90eef1e9c 100644
--- a/nova/volume/api.py
+++ b/nova/volume/api.py
@@ -80,6 +80,9 @@ class API(base.Base):
else:
snapshot_id = None
+ if not isinstance(size, int) or size <= 0:
+ msg = _('Volume size must be an integer and greater than 0')
+ raise exception.InvalidInput(reason=msg)
try:
reservations = QUOTAS.reserve(context, volumes=1, gigabytes=size)
except exception.OverQuota as e: