# ceph auth get-or-create client.<user_id> mon 'allow r' osd 'allow rw pool=.nfs namespace=<nfs_cluster_name>, allow rw tag cephfs data=<fs_name>' mds 'allow rw path=<export_path>'
+View Customized NFS Ganesha Configuration
+-----------------------------------------
+
+.. code:: bash
+
+ $ ceph nfs cluster config get <cluster_id>
+
+This will output the user defined configuration (if any).
+
Reset NFS Ganesha Configuration
-------------------------------
except Exception as e:
return exception_handler(e, "Failed to show info for cluster")
+ def get_nfs_cluster_config(self, cluster_id: str) -> Tuple[int, str, str]:
+ try:
+ if cluster_id in available_clusters(self.mgr):
+ rados_obj = NFSRados(self.mgr, cluster_id)
+ conf = rados_obj.read_obj(self._get_user_conf_obj_name(cluster_id))
+ return 0, conf or "", ""
+ raise ClusterNotFound()
+ except Exception as e:
+ return exception_handler(e, f"Fetching NFS-Ganesha Config failed for {cluster_id}")
+
def set_nfs_cluster_config(self, cluster_id: str, nfs_config: str) -> Tuple[int, str, str]:
try:
if cluster_id in available_clusters(self.mgr):
ExportMgr._check_rados_notify(ioctx, config_obj)
log.debug("Added %s url to %s", obj, config_obj)
+ def read_obj(self, obj: str) -> Optional[str]:
+ with self.mgr.rados.open_ioctx(self.pool) as ioctx:
+ ioctx.set_namespace(self.namespace)
+ try:
+ return ioctx.read(obj, 1048576).decode()
+ except ObjectNotFound:
+ return None
+
def update_obj(self, conf_block: str, obj: str, config_obj: str) -> None:
with self.mgr.rados.open_ioctx(self.pool) as ioctx:
ioctx.set_namespace(self.namespace)
"""Displays NFS Cluster info"""
return self.nfs.show_nfs_cluster_info(cluster_id=cluster_id)
+ @CLICommand('nfs cluster config get', perm='r')
+ def _cmd_nfs_cluster_config_get(self, cluster_id: str) -> Tuple[int, str, str]:
+ """Fetch NFS-Ganesha config"""
+ return self.nfs.get_nfs_cluster_config(cluster_id=cluster_id)
+
@CLICommand('nfs cluster config set', perm='rw')
@CLICheckNonemptyFileInput(desc='NFS-Ganesha Configuration')
def _cmd_nfs_cluster_config_set(self, cluster_id: str, inbuf: str) -> Tuple[int, str, str]: