From: Sebastian Wagner Date: Sat, 29 Aug 2020 19:36:09 +0000 (+0200) Subject: mgr/cephadm: Refactor `get_minimal_ceph_conf()` X-Git-Tag: v15.2.9~122^2~44^2~9 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=9163ace608dfa2562f9afd06d28d9efb49bc22c3;p=ceph.git mgr/cephadm: Refactor `get_minimal_ceph_conf()` Create a single source for the minimal ceph.conf Signed-off-by: Sebastian Wagner (cherry picked from commit fd4611836d3aa36882a18167d27af1b06715a0a6) --- diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index 3a47ce3ad4e2..91efbfa0f6a9 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -1522,9 +1522,7 @@ To check that the host is reachable: return None def _deploy_etc_ceph_ceph_conf(self, host: str) -> Optional[str]: - ret, config, err = self.check_mon_command({ - "prefix": "config generate-minimal-conf", - }) + config = self.get_minimal_ceph_conf() try: with self._remote_connection(host) as tpl: @@ -1547,6 +1545,13 @@ To check that the host is reachable: return f'failed to create /etc/ceph/ceph.conf on {host}: {str(e)}' return None + def get_minimal_ceph_conf(self) -> str: + _, config, _ = self.check_mon_command({ + "prefix": "config generate-minimal-conf", + }) + return config + + def _invalidate_daemons_and_kick_serve(self, filter_host=None): if filter_host: self.cache.invalidate_host_daemons(filter_host) diff --git a/src/pybind/mgr/cephadm/services/cephadmservice.py b/src/pybind/mgr/cephadm/services/cephadmservice.py index 1abf63e5dadb..8acc4f7fa38c 100644 --- a/src/pybind/mgr/cephadm/services/cephadmservice.py +++ b/src/pybind/mgr/cephadm/services/cephadmservice.py @@ -288,10 +288,8 @@ class CephService(CephadmService): 'entity': entity, }) - # generate config - ret, config, err = self.mgr.check_mon_command({ - "prefix": "config generate-minimal-conf", - }) + config = self.mgr.get_minimal_ceph_conf() + if extra_ceph_config: config += extra_ceph_config diff --git a/src/pybind/mgr/cephadm/services/osd.py b/src/pybind/mgr/cephadm/services/osd.py index 87ea6a8482a3..b173bbcd74de 100644 --- a/src/pybind/mgr/cephadm/services/osd.py +++ b/src/pybind/mgr/cephadm/services/osd.py @@ -237,13 +237,8 @@ class OSDService(CephService): 'entity': 'client.bootstrap-osd', }) - # generate config - ret, config, err = self.mgr.check_mon_command({ - "prefix": "config generate-minimal-conf", - }) - j = json.dumps({ - 'config': config, + 'config': self.mgr.get_minimal_ceph_conf(), 'keyring': keyring, })