From: Sage Weil Date: Mon, 16 Dec 2019 21:48:00 +0000 (-0600) Subject: mgr/cephadm: add 'reconfig' service action X-Git-Tag: v15.1.0~392^2~5 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=e07330c08473ef0c57e19c10bff0baffdc0c020a;p=ceph.git mgr/cephadm: add 'reconfig' service action Signed-off-by: Sage Weil --- diff --git a/qa/tasks/cephadm.py b/qa/tasks/cephadm.py index e0145c96ad9e..116e34f3b81c 100644 --- a/qa/tasks/cephadm.py +++ b/qa/tasks/cephadm.py @@ -418,20 +418,18 @@ def ceph_mons(ctx, config): break # refresh ceph.conf files for all mons + first mgr - """ for remote, roles in ctx.cluster.remotes.items(): for mon in [r for r in roles if teuthology.is_type('mon', cluster_name)(r)]: c_, _, id_ = teuthology.split_role(mon) _shell(ctx, cluster_name, remote, [ - 'ceph', 'orchestrator', 'service', 'redeploy', + 'ceph', 'orchestrator', 'service-instance', 'reconfig', 'mon', id_, ]) _shell(ctx, cluster_name, ctx.ceph[cluster_name].bootstrap_remote, [ - 'ceph', 'orchestrator', 'service', 'redeploy', + 'ceph', 'orchestrator', 'service-instance', 'reconfig', 'mgr', ctx.ceph[cluster_name].first_mgr, ]) - """ yield diff --git a/src/pybind/mgr/cephadm/module.py b/src/pybind/mgr/cephadm/module.py index a470c9c96dfb..491e37784345 100644 --- a/src/pybind/mgr/cephadm/module.py +++ b/src/pybind/mgr/cephadm/module.py @@ -859,20 +859,12 @@ class CephadmOrchestrator(MgrModule, orchestrator.Orchestrator): @async_map_completion def _service_action(self, service_type, service_id, host, action): if action == 'redeploy': - # recreate the systemd unit and then restart - if service_type == 'mon': - # get mon. key - ret, keyring, err = self.mon_command({ - 'prefix': 'auth get', - 'entity': 'mon.', - }) - else: - ret, keyring, err = self.mon_command({ - 'prefix': 'auth get', - 'entity': '%s.%s' % (service_type, service_id), - }) + # stop, recreate the container+unit, then restart return self._create_daemon(service_type, service_id, host, - keyring) + None) + elif action == 'reconfig': + return self._create_daemon(service_type, service_id, host, + None, reconfig=True) actions = { 'start': ['reset-failed', 'start'], @@ -1053,7 +1045,8 @@ class CephadmOrchestrator(MgrModule, orchestrator.Orchestrator): return self._remove_daemon(args) def _create_daemon(self, daemon_type, daemon_id, host, keyring, - extra_args=[], extra_config=None): + extra_args=[], extra_config=None, + reconfig=False): name = '%s.%s' % (daemon_type, daemon_id) # generate config @@ -1063,6 +1056,7 @@ class CephadmOrchestrator(MgrModule, orchestrator.Orchestrator): if extra_config: config += extra_config + # crash_keyring ret, crash_keyring, err = self.mon_command({ 'prefix': 'auth get-or-create', 'entity': 'client.crash.%s' % host, @@ -1076,6 +1070,9 @@ class CephadmOrchestrator(MgrModule, orchestrator.Orchestrator): 'crash_keyring': crash_keyring, }) + if reconfig: + extra_args.append('--reconfig') + out, err, code = self._run_cephadm( host, name, 'deploy', [ @@ -1085,7 +1082,8 @@ class CephadmOrchestrator(MgrModule, orchestrator.Orchestrator): stdin=j) self.log.debug('create_daemon code %s out %s' % (code, out)) self.service_cache.invalidate(host) - return "(Re)deployed {} on host '{}'".format(name, host) + return "{} {} on host '{}'".format( + 'Reconfigured' if reconfig else 'Deployed', name, host) @async_map_completion def _remove_daemon(self, name, host): diff --git a/src/pybind/mgr/orchestrator.py b/src/pybind/mgr/orchestrator.py index 2c11f6840fea..7f4a15c5c97b 100644 --- a/src/pybind/mgr/orchestrator.py +++ b/src/pybind/mgr/orchestrator.py @@ -857,7 +857,7 @@ class Orchestrator(object): * If using service_id, perform the action on a single specific daemon instance. - :param action: one of "start", "stop", "restart", "redeploy" + :param action: one of "start", "stop", "restart", "redeploy", "reconfig" :param service_type: e.g. "mds", "rgw", ... :param service_name: name of logical service ("cephfs", "us-east", ...) :param service_id: service daemon instance (usually a short hostname) diff --git a/src/pybind/mgr/orchestrator_cli/module.py b/src/pybind/mgr/orchestrator_cli/module.py index 75a9a31c0b02..ebf40c472251 100644 --- a/src/pybind/mgr/orchestrator_cli/module.py +++ b/src/pybind/mgr/orchestrator_cli/module.py @@ -575,10 +575,10 @@ Usage: @orchestrator._cli_write_command( 'orchestrator service', - "name=action,type=CephChoices,strings=start|stop|restart|redeploy " + "name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig " "name=svc_type,type=CephString " "name=svc_name,type=CephString", - 'Start, stop, restart, redeploy an entire service (i.e. all daemons)') + 'Start, stop, restart, redeploy, or reconfig an entire service (i.e. all daemons)') def _service_action(self, action, svc_type, svc_name): completion = self.service_action(action, svc_type, service_name=svc_name) self._orchestrator_wait([completion]) @@ -587,10 +587,10 @@ Usage: @orchestrator._cli_write_command( 'orchestrator service-instance', - "name=action,type=CephChoices,strings=start|stop|restart|redeploy " + "name=action,type=CephChoices,strings=start|stop|restart|redeploy|reconfig " "name=svc_type,type=CephString " "name=svc_id,type=CephString", - 'Start, stop, restart, or redeploy a specific service instance') + 'Start, stop, restart, redeploy, or reconfig a specific service instance') def _service_instance_action(self, action, svc_type, svc_id): completion = self.service_action(action, svc_type, service_id=svc_id) self._orchestrator_wait([completion])