Merge "Redundant body validation for volume_upload_image"

This commit is contained in:
Jenkins
2013-11-30 06:45:02 +00:00
committed by Gerrit Code Review
2 changed files with 23 additions and 12 deletions

View File

@@ -215,12 +215,7 @@ class VolumeActionsController(wsgi.Controller):
def _volume_upload_image(self, req, id, body):
"""Uploads the specified volume to image service."""
context = req.environ['cinder.context']
try:
params = body['os-volume_upload_image']
except (TypeError, KeyError):
msg = _("Invalid request body")
raise webob.exc.HTTPBadRequest(explanation=msg)
params = body['os-volume_upload_image']
if not params.get("image_name"):
msg = _("No image_name was specified in request.")
raise webob.exc.HTTPBadRequest(explanation=msg)