]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/rook: wrap url fetch function in try/except block 26032/head
authorJeff Layton <jlayton@redhat.com>
Fri, 18 Jan 2019 17:15:18 +0000 (12:15 -0500)
committerJeff Layton <jlayton@redhat.com>
Fri, 18 Jan 2019 17:15:18 +0000 (12:15 -0500)
It's possible for the fetch of this object to fail if the service is
being torn down. Handle that situation gracefully, but log a message.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
src/pybind/mgr/rook/rook_cluster.py

index 1b0dbe2bad40b4f409829e719eceb4d726c4ee57..862f6234634640589cd51c15e6a1ecfd8411fb6c 100644 (file)
@@ -106,9 +106,15 @@ class RookCluster(object):
     def get_nfs_conf_url(self, nfs_cluster, instance):
         #
         # Fetch cephnfs object for "nfs_cluster" and then return a rados://
-        # URL for the instance within that cluster.
+        # URL for the instance within that cluster. If the fetch fails, just
+        # return None.
         #
-        ceph_nfs = self.rook_api_get("cephnfses/{0}".format(nfs_cluster))
+        try:
+            ceph_nfs = self.rook_api_get("cephnfses/{0}".format(nfs_cluster))
+        except ApiException as e:
+            log.info("Unable to fetch cephnfs object: {}".format(e.status))
+            return None
+
         pool = ceph_nfs['spec']['rados']['pool']
         namespace = ceph_nfs['spec']['rados'].get('namespace', None)