Bug 2232548

Summary: Radosgw-admin bucket stats doesn't update for bucket quota
Product: [Red Hat Storage] Red Hat Ceph Storage Reporter: Shreyansh Sancheti <ssanchet>
Component: RGWAssignee: Matt Benjamin (redhat) <mbenjamin>
Status: NEW --- QA Contact: Madhavi Kasturi <mkasturi>
Severity: high Docs Contact:
Priority: unspecified    
Version: 5.3CC: ceph-eng-bugs, cephqe-warriors, vereddy
Target Milestone: ---   
Target Release: 7.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shreyansh Sancheti 2023-08-17 10:24:44 UTC
Description of problem:
After creating a test bucket in a vstart environment, I checked the bucket quota with bucket stats command. After the seeing the default I changed the bucket quota with the command line radosgw-admin tool and enabled the bucket quota, upon checking with the same command line tool and listing the bucket quota it was not updated, but when checked the same with curl on the usage api endpoint we see the quota updated.


Steps to Reproduce:
1. In a vstart cluster with the 5.3-rhel patches build, create a test bucket using awscli or s3cmd. 
2. using cmd line option update the quota for bucket 

./bin/radosgw-admin quota set --uid=testid --quota-scope=bucket --max-objects=123  --max-size=12345
#enable the bucket quota for the same bucket
./bin/radosgw-admin quota enable --quota-scope=bucket --uid=testid

#to see the changes 
./bin/radosgw-admin bucket stats --bucket=bucket1 | jq '.bucket_quota'
>>{
  "enabled": false,
  "check_on_raw": false,
  "max_size": -1,
  "max_size_kb": 0,
  "max_objects": -1
}

3. to see the changes using curl:

resource="/bucket1/"
S3KEY="**"
S3SECRET="**"
dateValue=$(date -R -u)

stringToSign="HEAD\n\n\n${dateValue}\n${resource}"

signature=`echo -en ${stringToSign} | openssl sha1 -hmac ${S3SECRET} -binary | base64`

curl -sk -H "authorization: AWS ${S3KEY}:${signature}" -H "date: ${dateValue}" "http:///${endpoint}${resource}?usage" -v -XHEAD
>
< HTTP/1.1 200 OK
< X-RGW-Object-Count: 0
< X-RGW-Bytes-Used: 0
< X-RGW-Quota-User-Size: -1
< X-RGW-Quota-User-Objects: -1
< X-RGW-Quota-Max-Buckets: 1000
< X-RGW-Quota-Bucket-Size: 13312
< X-RGW-Quota-Bucket-Objects: 123

Actual results:
>>{
  "enabled": false,
  "check_on_raw": false,
  "max_size": -1,
  "max_size_kb": 0,
  "max_objects": -1
}

Expected results:
>>{
  "enabled": true,
  "check_on_raw": false,
  "max_size": 13312,
  "max_size_kb": 0,
  "max_objects": 123
}

Additional info:

Comment 1 RHEL Program Management 2023-08-17 10:24:55 UTC
Please specify the severity of this bug. Severity is defined here:
https://bugzilla.redhat.com/page.cgi?id=fields.html#bug_severity.