diff options
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/compute/contrib/volumes.py | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/nova/api/openstack/compute/contrib/volumes.py b/nova/api/openstack/compute/contrib/volumes.py index 640ac0c76..5b2097365 100644 --- a/nova/api/openstack/compute/contrib/volumes.py +++ b/nova/api/openstack/compute/contrib/volumes.py @@ -244,15 +244,19 @@ class VolumeController(wsgi.Controller): availability_zone = vol.get('availability_zone', None) - new_volume = self.volume_api.create(context, - size, - vol.get('display_name'), - vol.get('display_description'), - snapshot=snapshot, - volume_type=vol_type, - metadata=metadata, - availability_zone=availability_zone - ) + try: + new_volume = self.volume_api.create( + context, + size, + vol.get('display_name'), + vol.get('display_description'), + snapshot=snapshot, + volume_type=vol_type, + metadata=metadata, + availability_zone=availability_zone + ) + except exception.InvalidInput as err: + raise exc.HTTPBadRequest(explanation=str(err)) # TODO(vish): Instance should be None at db layer instead of # trying to lazy load, but for now we turn it into |
