Merge "Raise BadRequest for invalid replication status"
This commit is contained in:
commit
178c5bfe9d
|
@ -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)
|
||||
|
|
|
@ -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']
|
||||
|
|
Loading…
Reference in New Issue