]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Merge pull request #38584 from votdev/wip-48593-nautilus
authorYuri Weinstein <yweinste@redhat.com>
Thu, 14 Jan 2021 16:21:06 +0000 (08:21 -0800)
committerGitHub <noreply@github.com>
Thu, 14 Jan 2021 16:21:06 +0000 (08:21 -0800)
nautilus: mgr/dashboard: Drop invalid RGW client instances, improve logging

Reviewed-by: Alfonso Martínez <almartin@redhat.com>
Reviewed-by: Ernesto Puerta <epuertat@redhat.com>
1  2 
src/pybind/mgr/dashboard/controllers/rgw.py

index 1c8343a7bd83680ff47b12cbfe6a953c444a6adb,3434cfe791627c7e8312d741835e0cdcc5bdb5e4..085155aa893a7788861f88d4d26bd938de474265
@@@ -24,11 -24,21 +24,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():
+             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.