Liam Kelleher <liam.kelleher@hp.com>
Mandell Degerness <mandell@pistoncloud.com>
Mark McLoughlin <markmc@redhat.com>
+Mike Perez <thingee@gmail.com>
Monty Taylor <mordred@inaugust.com>
Morita Kazutaka <morita.kazutaka@gmail.com>
Muneyuki Noguchi <noguchimn@nttdata.co.jp>
import webob
from cinder.api.openstack.volume import volumes
+from cinder import exception
from cinder import flags
from cinder import test
from cinder.tests.api.openstack import fakes
'size': 100}}
self.assertEqual(res_dict, expected)
+ def test_volume_creation_fails_with_bad_size(self):
+ vol = {"size": '',
+ "display_name": "Volume Test Name",
+ "display_description": "Volume Test Desc",
+ "availability_zone": "zone1:host1"}
+ body = {"volume": vol}
+ req = fakes.HTTPRequest.blank('/v1/volumes')
+ self.assertRaises(exception.InvalidInput,
+ self.controller.create,
+ req,
+ body)
+
def test_volume_create_no_body(self):
body = {}
req = fakes.HTTPRequest.blank('/v1/volumes')
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)
if quota.allowed_volumes(context, 1, size) < 1:
pid = context.project_id
LOG.warn(_("Quota exceeded for %(pid)s, tried to create"