From: Sebastian Wagner Date: Mon, 15 Jul 2019 11:25:39 +0000 (+0200) Subject: mgr/mgr_module: Allow resetting module options X-Git-Tag: v15.1.0~2123^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=03424798356532cf70841fb189718a8534b4e356;p=ceph.git mgr/mgr_module: Allow resetting module options Introduced in 4872cc5aa32611e44705aebf93145a92d5df776a `_ceph_set_module_option` also accepts `None`, not just strings. Fixes: http://tracker.ceph.com/issues/40779 Signed-off-by: Sebastian Wagner --- diff --git a/doc/mgr/orchestrator_cli.rst b/doc/mgr/orchestrator_cli.rst index 1ad340c731f..38684229b11 100644 --- a/doc/mgr/orchestrator_cli.rst +++ b/doc/mgr/orchestrator_cli.rst @@ -69,7 +69,7 @@ Disable the Orchestrator To disable the orchestrator again, use the empty string ``""``:: ceph orchestrator set backend ""`` - ceph mgr module disalbe rook + ceph mgr module disable rook Usage ===== diff --git a/qa/tasks/mgr/test_module_selftest.py b/qa/tasks/mgr/test_module_selftest.py index 7e6a5110c9d..bec2786c33d 100644 --- a/qa/tasks/mgr/test_module_selftest.py +++ b/qa/tasks/mgr/test_module_selftest.py @@ -78,6 +78,10 @@ class TestModuleSelftest(MgrTestCase): def test_crash(self): self._selftest_plugin("crash") + def test_orchestrator_cli(self): + self._selftest_plugin("orchestrator_cli") + + def test_selftest_config_update(self): """ That configuration updates are seen by running mgr modules diff --git a/src/pybind/mgr/mgr_module.py b/src/pybind/mgr/mgr_module.py index bdd0b26cc39..00d45ddd597 100644 --- a/src/pybind/mgr/mgr_module.py +++ b/src/pybind/mgr/mgr_module.py @@ -1012,7 +1012,8 @@ class MgrModule(ceph_module.BaseMgrModule): return self._get_module_option(key, default, self.get_mgr_id()) def _set_module_option(self, key, val): - return self._ceph_set_module_option(self.module_name, key, str(val)) + return self._ceph_set_module_option(self.module_name, key, + None if val is None else str(val)) def set_module_option(self, key, val): """ diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 30740a28389..ebf9740a647 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -378,7 +378,7 @@ Usage: """ mgr_map = self.get("mgr_map") - if module_name == "": + if module_name is None or module_name == "": self.set_module_option("orchestrator", None) return HandleCommandResult() @@ -428,3 +428,9 @@ Usage: o, avail, " ({0})".format(why) if not avail else "" )) + + def self_test(self): + old_orch = self._select_orchestrator() + self._set_backend('') + assert self._select_orchestrator() is None + self._set_backend(old_orch)