@cluster_setter
def set_nfs_cluster_config(self, cluster_id, nfs_config):
try:
- if not nfs_config:
- raise NFSInvalidOperation("Empty Config!!")
if cluster_id in available_clusters(self.mgr):
rados_obj = NFSRados(self.mgr, self.pool_ns)
if rados_obj.check_user_config():
def update_export(self, export_config):
try:
- if not export_config:
- raise NFSInvalidOperation("Empty Config!!")
new_export = json.loads(export_config)
# check export type
return FSExport(self).update_export(new_export)
-import errno
import logging
import threading
from typing import Tuple, Optional, List
-from mgr_module import MgrModule, CLICommand, Option
+from mgr_module import MgrModule, CLICommand, Option, CLICheckNonemptyFileInput
import orchestrator
from .export import ExportMgr
return self.export_mgr.get_export(cluster_id=clusterid, pseudo_path=binding)
@CLICommand('nfs export update', perm='rw')
+ @CLICheckNonemptyFileInput(desc='CephFS Export configuration')
def _cmd_nfs_export_update(self, inbuf: str) -> Tuple[int, str, str]:
"""Update an export of a NFS cluster by `-i <json_file>`"""
# The export <json_file> is passed to -i and it's processing is handled by the Ceph CLI.
return self.nfs.show_nfs_cluster_info(cluster_id=clusterid)
@CLICommand('nfs cluster config set', perm='rw')
+ @CLICheckNonemptyFileInput(desc='NFS-Ganesha Configuration')
def _cmd_nfs_cluster_config_set(self, clusterid: str, inbuf: str) -> Tuple[int, str, str]:
"""Set NFS-Ganesha config by `-i <config_file>`"""
return self.nfs.set_nfs_cluster_config(cluster_id=clusterid, nfs_config=inbuf)