]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #38534 from votdev/issue_48542_rgw_status
authorErnesto Puerta <37327689+epuertat@users.noreply.github.com>
Wed, 16 Dec 2020 12:27:32 +0000 (13:27 +0100)
committerGitHub <noreply@github.com>
Wed, 16 Dec 2020 12:27:32 +0000 (13:27 +0100)
mgr/dashboard: The /rgw/status endpoint does not check for running service

Reviewed-by: Aashish Sharma <aasharma@redhat.com>
Reviewed-by: Alfonso Martínez <almartin@redhat.com>
Reviewed-by: Laura Paduano <lpaduano@suse.com>
Reviewed-by: Nizamudeen A <nia@redhat.com>
1  2 
src/pybind/mgr/dashboard/controllers/rgw.py

index 59ed06aa24ba5c5956f4c9f8c9b50bf268608ec9,a6bab3dba37859ecf595480a0a0840945ad50fb2..23d1f5db62f610b969dcd7d7c37ec3003aab264f
@@@ -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.