Raise HTTPBadRequest instead of HTTPNotFound while creating
a volume from an existing source replica with invalid replication
status 'disabled'.
APIImpact
Change-Id: If7ac01a9452dca0446088189b658340da538c427
Closes-Bug: #
1471694
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)
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']