Skip to content

Commit f5f9af4

Browse files
authored
Merge pull request ceph#62110 from cbodley/wip-69842
rgw: rgw_init_ioctx() adds set_pool_full_try() Reviewed-by: Adam Emerson <[email protected]>
2 parents b407f79 + c29f531 commit f5f9af4

File tree

6 files changed

+17
-1
lines changed

6 files changed

+17
-1
lines changed

qa/suites/rgw/verify/tasks/rados-pool-quota.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ overrides:
99
log-ignorelist:
1010
- reached quota
1111
- POOL_FULL
12+
- pool(s) full

qa/workunits/rgw/test_rgw_rados_pool_quota.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ def main():
7171
exec_cmd(f'rados -p {DATA_POOL} ls')
7272
log.debug('forced quota to propagate')
7373

74+
# expect uploads to fail at pool quota
75+
try:
76+
bucket.put_object(Key=f'{key}-at-quota', Body=b"new data")
77+
except botocore.exceptions.ClientError as e:
78+
if not e.response['Error']['Code'] == 'InsufficientCapacity':
79+
raise
80+
else:
81+
assert False, 'Upload succeeded at quota limit, expected InsufficientCapacity'
82+
83+
# expect deletions to succeed at pool quota
7484
for obj in objects:
7585
try:
7686
bucket.Object(obj).delete()

src/rgw/driver/rados/rgw_cr_rados.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ RGWRadosRemoveCR::RGWRadosRemoveCR(rgw::sal::RadosStore* store, const rgw_raw_ob
437437
int RGWRadosRemoveCR::send_request(const DoutPrefixProvider *dpp)
438438
{
439439
auto rados = store->getRados()->get_rados_handle();
440-
int r = rados->ioctx_create(obj.pool.name.c_str(), ioctx);
440+
int r = rgw_init_ioctx(dpp, rados, obj.pool, ioctx);
441441
if (r < 0) {
442442
lderr(cct) << "ERROR: failed to open pool (" << obj.pool.name << ") ret=" << r << dendl;
443443
return r;

src/rgw/driver/rados/rgw_tools.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,8 @@ int rgw_init_ioctx(const DoutPrefixProvider *dpp,
9494
if (!pool.ns.empty()) {
9595
ioctx.set_namespace(pool.ns);
9696
}
97+
// at pool quota, never block waiting for space - we want to error immediately
98+
ioctx.set_pool_full_try();
9799
return 0;
98100
}
99101

src/rgw/rgw_common.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ rgw_http_errors rgw_http_s3_errors({
140140
{ ERR_NO_SUCH_PUBLIC_ACCESS_BLOCK_CONFIGURATION, {404, "NoSuchPublicAccessBlockConfiguration"}},
141141
{ ERR_ACCOUNT_EXISTS, {409, "AccountAlreadyExists"}},
142142
{ ECANCELED, {409, "ConcurrentModification"}},
143+
{ EDQUOT, {507, "InsufficientCapacity"}},
144+
{ ENOSPC, {507, "InsufficientCapacity"}},
143145
});
144146

145147
rgw_http_errors rgw_http_swift_errors({

src/rgw/rgw_rest.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ const static struct rgw_http_status_code http_codes[] = {
8383
{ 500, "Internal Server Error" },
8484
{ 501, "Not Implemented" },
8585
{ 503, "Slow Down"},
86+
{ 507, "Insufficient Storage"},
8687
{ 0, NULL },
8788
};
8889

0 commit comments

Comments
 (0)