s3api: Pass through 409s from SLO

Change-Id: Ie91a90fbb3488af63a51dcd18fa2c60ad00e234d
This commit is contained in:
Tim Burke 2021-07-23 13:46:44 -05:00 committed by Clay Gerrard
parent b53a9d8114
commit 5759072d25
3 changed files with 13 additions and 1 deletions

View File

@ -55,7 +55,7 @@ from swift.common.middleware.s3api.s3response import AccessDenied, \
MissingContentLength, InvalidStorageClass, S3NotImplemented, InvalidURI, \
MalformedXML, InvalidRequest, RequestTimeout, InvalidBucketName, \
BadDigest, AuthorizationHeaderMalformed, SlowDown, \
AuthorizationQueryParametersError, ServiceUnavailable
AuthorizationQueryParametersError, ServiceUnavailable, BrokenMPU
from swift.common.middleware.s3api.exception import NotS3Request, \
BadSwiftRequest
from swift.common.middleware.s3api.utils import utf8encode, \
@ -1405,6 +1405,9 @@ class S3Request(swob.Request):
if self.conf.ratelimit_as_client_error:
raise SlowDown(status='429 Slow Down')
raise SlowDown()
if resp.status_int == HTTP_CONFLICT:
# TODO: validate that this actually came up out of SLO
raise BrokenMPU()
raise InternalError('unexpected status code %d' % status)

View File

@ -731,3 +731,9 @@ class UserKeyMustBeSpecified(ErrorResponse):
_status = '400 Bad Request'
_msg = 'The bucket POST must contain the specified field name. If it is ' \
'specified, please check the order of the fields.'
class BrokenMPU(ErrorResponse):
# This is very much a Swift-ism, and we wish we didn't need it
_status = '409 Conflict'
_msg = 'Multipart upload has broken segment data.'

View File

@ -307,6 +307,9 @@ class TestS3ApiObj(S3ApiTestCase):
code = self._test_method_error('GET', '/bucket/object',
swob.HTTPServiceUnavailable)
self.assertEqual(code, 'ServiceUnavailable')
code = self._test_method_error('GET', '/bucket/object',
swob.HTTPConflict)
self.assertEqual(code, 'BrokenMPU')
code = self._test_method_error(
'GET', '/bucket/object',