From: Sage Weil Date: Tue, 1 Oct 2019 15:52:37 +0000 (-0500) Subject: mgr/ssh: deploy new mgrs with ceph-daemon X-Git-Tag: v15.1.0~1313^2~39 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=f10e645c154faab4e400120481cd4265c9539f96;p=ceph.git mgr/ssh: deploy new mgrs with ceph-daemon Signed-off-by: Sage Weil --- diff --git a/src/pybind/mgr/ssh/module.py b/src/pybind/mgr/ssh/module.py index 12adf3097dc04..6bd28519c4648 100644 --- a/src/pybind/mgr/ssh/module.py +++ b/src/pybind/mgr/ssh/module.py @@ -356,21 +356,6 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): return out - def _bootstrap_mgr(self, conn): - """ - Bootstrap a manager. - - 1. install a copy of ceph.conf - 2. install the manager bootstrap key - - :param conn: remote host connection - """ - self._ensure_ceph_conf(conn) - keyring = self._get_bootstrap_key("mgr") - keyring_path = "/var/lib/ceph/bootstrap-mgr/ceph.keyring" - conn.remote_module.write_keyring(keyring_path, keyring) - return keyring_path - def _bootstrap_osd(self, conn): """ Bootstrap an osd. @@ -678,55 +663,17 @@ class SSHOrchestrator(MgrModule, orchestrator.Orchestrator): """ self.log.info("create_mgr({}): starting".format(host)) - conn = self._get_connection(host) - - try: - bootstrap_keyring_path = self._bootstrap_mgr(conn) - - mgr_path = "/var/lib/ceph/mgr/ceph-{name}".format(name=host) - conn.remote_module.safe_makedirs(mgr_path) - keyring_path = os.path.join(mgr_path, "keyring") - - command = [ - 'ceph', - '--name', 'client.bootstrap-mgr', - '--keyring', bootstrap_keyring_path, - 'auth', 'get-or-create', 'mgr.{name}'.format(name=host), - 'mon', 'allow profile mgr', - 'osd', 'allow *', - 'mds', 'allow *', - '-o', - keyring_path - ] - - out, err, ret = remoto.process.check(conn, command) - if ret != 0: - raise Exception("oops") - - remoto.process.run(conn, - ['systemctl', 'enable', 'ceph-mgr@{name}'.format(name=host)], - timeout=7 - ) - - remoto.process.run(conn, - ['systemctl', 'start', 'ceph-mgr@{name}'.format(name=host)], - timeout=7 - ) - - remoto.process.run(conn, - ['systemctl', 'enable', 'ceph.target'], - timeout=7 - ) - - return "Created mgr on host '{}'".format(host) - - except Exception as e: - self.log.error("create_mgr({}): error: {}".format(host, e)) - raise + # get mgr. key + ret, keyring, err = self.mon_command({ + 'prefix': 'auth get-or-create', + 'entity': 'mgr.%s' % host, + 'caps': ['mon', 'allow profile mgr', + 'osd', 'allow *', + 'mds', 'allow *'], + }) + self.log.debug('keyring %s' % keyring) - finally: - self.log.info("create_mgr({}): finished".format(host)) - conn.exit() + return self._create_daemon('mgr', host, keyring) def update_mgrs(self, num, hosts): """