From 90b4c5157f13f2c8fb87ae0af8c824893f1c149f Mon Sep 17 00:00:00 2001 From: Jeff Layton Date: Tue, 15 Jan 2019 13:50:22 -0500 Subject: [PATCH] mgr/rook: populate rados_config_location field 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 --- src/pybind/mgr/rook/module.py | 1 + src/pybind/mgr/rook/rook_cluster.py | 16 ++++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/src/pybind/mgr/rook/module.py b/src/pybind/mgr/rook/module.py index ff4c55b350d..9e56c94d01e 100644 --- a/src/pybind/mgr/rook/module.py +++ b/src/pybind/mgr/rook/module.py @@ -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 diff --git a/src/pybind/mgr/rook/rook_cluster.py b/src/pybind/mgr/rook/rook_cluster.py index abaa08f46f7..aa1e969ceef 100644 --- a/src/pybind/mgr/rook/rook_cluster.py +++ b/src/pybind/mgr/rook/rook_cluster.py @@ -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 -- 2.39.5