From: Ernesto Puerta <37327689+epuertat@users.noreply.github.com> Date: Wed, 16 Dec 2020 12:27:32 +0000 (+0100) Subject: Merge pull request #38534 from votdev/issue_48542_rgw_status X-Git-Tag: v16.1.0~246 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=63a5cd41c8b4e1ff5ee01854b4aa1425fe2da1bf;p=ceph.git Merge pull request #38534 from votdev/issue_48542_rgw_status mgr/dashboard: The /rgw/status endpoint does not check for running service Reviewed-by: Aashish Sharma Reviewed-by: Alfonso Martínez Reviewed-by: Laura Paduano Reviewed-by: Nizamudeen A --- 63a5cd41c8b4e1ff5ee01854b4aa1425fe2da1bf diff --cc src/pybind/mgr/dashboard/controllers/rgw.py index 59ed06aa24b,a6bab3dba37..23d1f5db62f --- a/src/pybind/mgr/dashboard/controllers/rgw.py +++ b/src/pybind/mgr/dashboard/controllers/rgw.py @@@ -49,21 -49,11 +49,23 @@@ class Rgw(BaseController) def status(self): status = {'available': False, 'message': None} try: + if not CephService.get_service_list('rgw'): + raise LookupError('No RGW service is running.') instance = RgwClient.admin_instance() # Check if the service is online. - if not instance.is_service_online(): # pragma: no cover - no complexity there + try: + is_online = instance.is_service_online() + except RequestException as e: + # Drop this instance because the RGW client seems not to + # exist anymore (maybe removed via orchestrator). Removing + # the instance from the cache will result in the correct + # error message next time when the backend tries to + # establish a new connection (-> 'No RGW found' instead + # of 'RGW REST API failed request ...'). + # Note, this only applies to auto-detected RGW clients. + RgwClient.drop_instance(instance.userid) + raise e + if not is_online: msg = 'Failed to connect to the Object Gateway\'s Admin Ops API.' raise RequestException(msg) # Ensure the API user ID is known by the RGW.