]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/cephadm: add 'reconfig' service action
authorSage Weil <sage@redhat.com>
Mon, 16 Dec 2019 21:48:00 +0000 (15:48 -0600)
committerSage Weil <sage@redhat.com>
Sun, 22 Dec 2019 16:50:23 +0000 (10:50 -0600)
Signed-off-by: Sage Weil <sage@redhat.com>
qa/tasks/cephadm.py
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/orchestrator.py
src/pybind/mgr/orchestrator_cli/module.py

index e0145c96ad9e9944816b5f335dc91d2fee2fd1dc..116e34f3b81c7025751cdf30373fb36f4732fb0d 100644 (file)
@@ -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
 
index a470c9c96dfbb7efa3781308030ba67e4041ebe9..491e3778434538bc14758cacbdf00afb33b2a149 100644 (file)
@@ -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):
index 2c11f6840fea4afafb6a4b4eb1975fc0ed32459f..7f4a15c5c97b573b3b0b59a4b5df01ae1143b5b3 100644 (file)
@@ -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)
index 75a9a31c0b027022a5491ee718e3e97ed6ae2d63..ebf40c4722514efeb32a0b724dc58a4f64c820c5 100644 (file)
@@ -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])