]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/rook: populate rados_config_location field
authorJeff Layton <jlayton@redhat.com>
Tue, 15 Jan 2019 18:50:22 +0000 (13:50 -0500)
committerJeff Layton <jlayton@redhat.com>
Tue, 15 Jan 2019 19:14:35 +0000 (14:14 -0500)
The dashboard ganesha management code requires the rados:// config
URL for the nfs-ganesha daemons. Ensure that we populate that.

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

index ff4c55b350dccc54b2f3c8320f708ae97acc6733..9e56c94d01eb2f5ed4b78bbd210384eb18fcac70 100644 (file)
@@ -355,6 +355,7 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
                 sd.daemon_name = p['labels']["mgr"]
             elif sd.service_type == "nfs":
                 sd.daemon_name = p['labels']["ceph_nfs"]
+                sd.rados_config_location = self.rook_cluster.get_nfs_conf_url(sd.daemon_name, p['labels']['instance'])
             else:
                 # Unknown type -- skip it
                 continue
index abaa08f46f760d3ded1dfae62d5605caf1ed3af3..aa1e969ceef1f8a89d5f5758784a2e6202825a6f 100644 (file)
@@ -129,6 +129,22 @@ class RookCluster(object):
 
         return nodename_to_devices
 
+    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.
+        #
+        ceph_nfs = self.rook_api_get("cephnfses/{0}".format(nfs_cluster))
+        pool = ceph_nfs['spec']['rados']['pool']
+        namespace = ceph_nfs['spec']['rados'].get('namespace', None)
+
+        if namespace == None:
+            url = "rados://{0}/conf-{1}.{2}".format(pool, nfs_cluster, instance)
+        else:
+            url = "rados://{0}/{1}/conf-{2}.{3}".format(pool, namespace, nfs_cluster, instance)
+        return url
+
+
     def describe_pods(self, service_type, service_id, nodename):
         # Go query the k8s API about deployment, containers related to this
         # filesystem