Skip to content

Commit 4ffd1d4

Browse files
committed
mgr/dashboard: fix edit bucket failing in other selected gateways
even if I select gateway 8002, the bucket policy req seems to go through 8000 and doesn't find the bucket ``` 2024-06-07T13:40:33.161+0000 7f563be00700 0 [dashboard DEBUG rest_client] RGW REST API GET req: /hello?policy data: None 2024-06-07T13:40:33.164+0000 7f563be00700 0 [dashboard DEBUG urllib3.connectionpool] http://172.20.0.5:8000 "GET /hello?policy HTTP/1.1" 404 174 2024-06-07T13:40:33.164+0000 7f563be00700 0 [dashboard ERROR rest_client] RGW REST API failed GET req status: 404 2024-06-07T13:40:33.164+0000 7f563be00700 0 [dashboard ERROR exception] Internal Server Error Traceback (most recent call last): File "/ceph/src/pybind/mgr/dashboard/services/exception.py", line 47, in dashboard_exception_handler return handler(*args, **kwargs) File "/usr/lib/python3.6/site-packages/cherrypy/_cpdispatch.py", line 54, in __call__ return self.callable(*self.args, **self.kwargs) File "/ceph/src/pybind/mgr/dashboard/controllers/_base_controller.py", line 263, in inner ret = func(*args, **kwargs) File "/ceph/src/pybind/mgr/dashboard/controllers/_rest_controller.py", line 193, in wrapper return func(*vpath, **params) File "/ceph/src/pybind/mgr/dashboard/controllers/rgw.py", line 463, in get result['bucket_policy'] = self._get_policy(bucket_name) File "/ceph/src/pybind/mgr/dashboard/controllers/rgw.py", line 381, in _get_policy return rgw_client.get_bucket_policy(bucket) File "/ceph/src/pybind/mgr/dashboard/rest_client.py", line 543, in func_wrapper **kwargs) File "/ceph/src/pybind/mgr/dashboard/services/rgw_client.py", line 957, in get_bucket_policy raise e File "/ceph/src/pybind/mgr/dashboard/services/rgw_client.py", line 949, in get_bucket_policy request = request() File "/ceph/src/pybind/mgr/dashboard/rest_client.py", line 325, in __call__ data, raw_content, headers) File "/ceph/src/pybind/mgr/dashboard/rest_client.py", line 428, in do_request resp.content) dashboard.rest_client.RequestException: RGW REST API failed request with status code 404 (b'{"Code":"NoSuchBucket","Message":"","BucketName":"hello","RequestId":"tx0000' b'0d73bbbad485175ea-0066630dd1-18785-zone1-zg1-realm1","HostId":"18785-zone1-z' b'g1-realm1-zg1-realm1"}') ``` But for the same bucket the encryption and other req goes through the correct gateway ``` 2024-06-07T13:40:32.704+0000 7f563be00700 0 [dashboard DEBUG urllib3.connectionpool] http://172.20.0.5:8002 "GET /hello?versioning HTTP/1.1" 200 2 2024-06-07T13:40:32.745+0000 7f563be00700 0 [dashboard DEBUG rest_client] RGW REST API GET res status: 200 content: {} 2024-06-07T13:40:32.745+0000 7f563be00700 0 [dashboard INFO rgw_client] Found RGW daemon with configuration: host=172.20.0.5, port=8000, ssl=False 2024-06-07T13:40:32.746+0000 7f563be00700 0 [dashboard INFO rgw_client] Found RGW daemon with configuration: host=172.20.0.5, port=8002, ssl=False 2024-06-07T13:40:32.746+0000 7f563be00700 0 [dashboard DEBUG rest_client] RGW REST API GET req: /hello?encryption data: None 2024-06-07T13:40:32.747+0000 7f563be00700 0 [dashboard DEBUG urllib3.connectionpool] http://172.20.0.5:8002 "GET /hello?encr ``` Fixes: https://tracker.ceph.com/issues/66395 Signed-off-by: Nizamudeen A <[email protected]>
1 parent df637ab commit 4ffd1d4

File tree

1 file changed

+3
-3
lines changed
  • src/pybind/mgr/dashboard/controllers

1 file changed

+3
-3
lines changed

src/pybind/mgr/dashboard/controllers/rgw.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,8 @@ def _set_locking(self, owner, daemon_name, bucket_name, mode,
376376
retention_period_days,
377377
retention_period_years)
378378

379-
def _get_policy(self, bucket: str):
380-
rgw_client = RgwClient.admin_instance()
379+
def _get_policy(self, bucket: str, daemon_name, owner):
380+
rgw_client = RgwClient.instance(owner, daemon_name)
381381
return rgw_client.get_bucket_policy(bucket)
382382

383383
def _set_policy(self, bucket_name: str, policy: str, daemon_name, owner):
@@ -448,7 +448,7 @@ def get(self, bucket, daemon_name=None):
448448
result['encryption'] = encryption['Status']
449449
result['versioning'] = versioning['Status']
450450
result['mfa_delete'] = versioning['MfaDelete']
451-
result['bucket_policy'] = self._get_policy(bucket_name)
451+
result['bucket_policy'] = self._get_policy(bucket_name, daemon_name, result['owner'])
452452
result['acl'] = self._get_acl(bucket_name, daemon_name, result['owner'])
453453

454454
# Append the locking configuration.

0 commit comments

Comments
 (0)