From: Varsha Rao Date: Fri, 3 Jan 2020 13:21:28 +0000 (+0530) Subject: mgr: Create pool for nfs ganesha recovery X-Git-Tag: wip-pdonnell-testing-20200918.022351~1563^2~28 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8c945eda6ccd9828eb0e473fafe11d3555e5f9e0;p=ceph-ci.git mgr: Create pool for nfs ganesha recovery Fixes: https://tracker.ceph.com/issues/44193 Signed-off-by: Varsha Rao --- diff --git a/src/pybind/mgr/volumes/fs/nfs.py b/src/pybind/mgr/volumes/fs/nfs.py index 93c607c6c27..23ddfee5b2f 100644 --- a/src/pybind/mgr/volumes/fs/nfs.py +++ b/src/pybind/mgr/volumes/fs/nfs.py @@ -4,9 +4,12 @@ import cephfs import orchestrator from dashboard.services.cephx import CephX from dashboard.services.ganesha import Ganesha, NFSException, Export, GaneshaConfParser +from .fs_util import create_pool log = logging.getLogger(__name__) +exp_num = 0 + class GaneshaConf(object): # pylint: disable=R0902 @@ -179,14 +182,14 @@ class GaneshaConf(object): for daemon_id in daemons: ioctx.notify("conf-{}".format(daemon_id)) -def create_instance(orch): - return GaneshaConf("a", "nfs-ganesha", "ganesha", orch) +def create_instance(orch, pool_name): + return GaneshaConf("a", pool_name, "ganesha", orch) def create_export(ganesha_conf): ex_id = ganesha_conf.create_export({ 'path': "/", 'pseudo': "/cephfs", - 'cluster_id': "a", + 'cluster_id': "cluster1", 'daemons': ["ganesha.a"], 'tag': "", 'access_type': "RW", @@ -199,6 +202,8 @@ def create_export(ganesha_conf): }) log.info("Export ID is {}".format(ex_id)) + global exp_num + exp_num += 1 return 0, "", "" def delete_export(ganesha_conf, ex_id): @@ -215,3 +220,19 @@ def check_fsal_valid(fs_map): #return 0, json.dumps(fsmap_res, indent=2), "" return fsmap_res + +def create_rados_pool(vc_mgr, pool_name): + global exp_num + if not exp_num: + r, outb, outs = create_pool(vc_mgr, pool_name) + """ + if r != 0: + #return r, outb, outs + + command = {'prefix': 'osd pool application enable', 'pool': pool_name, 'app': 'nfs'} + r, outb, outs = vc_mgr.mgr.mon_command(command) + + if r != 0: + #return r, outb, outs + log.info("pool enable done r: {}".format(r)) + """ diff --git a/src/pybind/mgr/volumes/module.py b/src/pybind/mgr/volumes/module.py index f0ae8192cc0..902ed981f1b 100644 --- a/src/pybind/mgr/volumes/module.py +++ b/src/pybind/mgr/volumes/module.py @@ -5,7 +5,8 @@ from mgr_module import MgrModule import orchestrator from .fs.volume import VolumeClient -from .fs.nfs import check_fsal_valid, create_instance, create_export, delete_export +#from .fs.nfs import check_fsal_valid, create_instance, create_export, delete_export +from .fs.nfs import * class Module(orchestrator.OrchestratorClientMixin, MgrModule): COMMANDS = [ @@ -391,9 +392,11 @@ class Module(orchestrator.OrchestratorClientMixin, MgrModule): def _cmd_fs_nfs_create(self, inbuf, cmd): if check_fsal_valid(self.vc.mgr.get('fs_map')): - instance = create_instance(self) + pool_name = "nfs-ganesha" + create_rados_pool(self.vc.mgr, pool_name) + instance = create_instance(self, pool_name) return create_export(instance) def _cmd_fs_nfs_delete(self, inbuf, cmd): - instance = create_instance(self) + instance = create_instance(self, "nfs-ganesha") return delete_export(instance, cmd['export_id'])