Merge "Raise BadRequest for invalid replication status"

This commit is contained in:
Jenkins 2015-07-24 00:49:13 +00:00 committed by Gerrit Code Review
commit 178c5bfe9d
2 changed files with 3 additions and 3 deletions

View File

@ -386,7 +386,7 @@ class VolumeController(wsgi.Controller):
if src_vol['replication_status'] == 'disabled':
explanation = _('source volume id:%s is not'
' replicated') % source_volid
raise exc.HTTPNotFound(explanation=explanation)
raise exc.HTTPBadRequest(explanation=explanation)
kwargs['source_replica'] = src_vol
except exception.VolumeNotFound as error:
raise exc.HTTPNotFound(explanation=error.msg)

View File

@ -317,8 +317,8 @@ class VolumeApiTest(test.TestCase):
vol = self._vol_in_request_body(source_replica=source_replica)
body = {"volume": vol}
req = fakes.HTTPRequest.blank('/v2/volumes')
# Raise 404 when replication status is disabled.
self.assertRaises(webob.exc.HTTPNotFound, self.controller.create,
# Raise 400 when replication status is disabled.
self.assertRaises(webob.exc.HTTPBadRequest, self.controller.create,
req, body)
context = req.environ['cinder.context']