From: Michael Fritch Date: Thu, 27 Feb 2020 14:24:52 +0000 (-0700) Subject: mgr/cephadm: create empty nfs rados config obj X-Git-Tag: v16.1.0~2793^2~17 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9103f4758beb7e0f0dba523f776f9918c0dbfe6d;p=ceph.git mgr/cephadm: create empty nfs rados config obj Signed-off-by: Michael Fritch --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 8a9c5e09f2bb..ee623f41944c 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -2795,6 +2795,7 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule): nfs = NFSGanesha(self, daemon_id, spec.pool, namespace=spec.namespace) keyring = nfs.create_keyring() cephadm_config = nfs.get_cephadm_config() + nfs.create_rados_config_obj() return self._create_daemon('nfs', daemon_id, host, keyring=keyring, cephadm_config=cephadm_config) diff --git a/src/pybind/mgr/cephadm/nfs.py b/src/pybind/mgr/cephadm/nfs.py index 61b4812e0bc5..75caf6caec32 100644 --- a/src/pybind/mgr/cephadm/nfs.py +++ b/src/pybind/mgr/cephadm/nfs.py @@ -46,6 +46,14 @@ class NFSGanesha(object): }) return keyring + def create_rados_config_obj(self): + # type: () -> None + obj = self.get_rados_config_name() + with self.mgr.rados.open_ioctx(self.pool) as ioctx: + if self.namespace: + ioctx.set_namespace(self.namespace) + ioctx.write_full(obj, ''.encode('utf-8')) + def get_ganesha_conf(self): # type: () -> str return '''# generated by cephadm diff --git a/src/pybind/mgr/cephadm/tests/test_cephadm.py b/src/pybind/mgr/cephadm/tests/test_cephadm.py index eb4d0e2dfdad..bd6f520267ce 100644 --- a/src/pybind/mgr/cephadm/tests/test_cephadm.py +++ b/src/pybind/mgr/cephadm/tests/test_cephadm.py @@ -260,6 +260,7 @@ class TestCephadm(object): match_glob(out, "Deployed rbd-mirror.* on host 'test'") @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('{}')) + @mock.patch("cephadm.module.CephadmOrchestrator.rados", mock.MagicMock()) def test_nfs(self, cephadm_module): with self._with_host(cephadm_module, 'test'): ps = PlacementSpec(hosts=['test'], count=1)