]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: remove apply_mon support
authorSage Weil <sage@redhat.com>
Sun, 23 Feb 2020 19:46:08 +0000 (13:46 -0600)
committerSage Weil <sage@redhat.com>
Mon, 24 Feb 2020 16:46:10 +0000 (10:46 -0600)
Our apply method doesn't support removing mons at this point.  And using
it for adding mons is just an awkward version of 'daemon add'.

Update docs and cephadm.py task accordingly.

Signed-off-by: Sage Weil <sage@redhat.com>
doc/bootstrap.rst
qa/tasks/cephadm.py
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/tests/test_cephadm.py

index 8c86d2d2bd8884f105b69d5f101d3b83bc670431..808defd591df656144009d5234b05e94694e719a 100644 (file)
@@ -118,12 +118,12 @@ either as a simple IP address or as a CIDR network name.
 
 To deploy additional monitors,::
 
-  [monitor 1] # ceph orch apply mon *<new-num-monitors>* *<host1:network1> [<host1:network2>...]*
+  [monitor 1] # ceph orch daemon add mon *<host1:network1> [<host1:network2>...]*
 
 For example, to deploy a second monitor on ``newhost`` using an IP
 address in network ``10.1.2.0/24``,::
 
-  [monitor 1] # ceph orch apply mon 2 newhost:10.1.2.0/24
+  [monitor 1] # ceph orch daemon add mon newhost:10.1.2.0/24
 
 Deploying OSDs
 ==============
index e234d17eec1f6464c434caa60b1c13f35cee1923..2bf39421c6249577119f54416e099cb6d76da502 100644 (file)
@@ -468,8 +468,7 @@ def ceph_mons(ctx, config):
                 log.info('Adding %s on %s' % (mon, remote.shortname))
                 num_mons += 1
                 _shell(ctx, cluster_name, remote, [
-                    'ceph', 'orch', 'apply', 'mon',
-                    str(num_mons),
+                    'ceph', 'orch', 'daemon', 'add', 'mon',
                     remote.shortname + ':' + ctx.ceph[cluster_name].mons[mon] + '=' + id_,
                 ])
                 ctx.daemons.register_daemon(
index cb91c8e0629cb3a50e535c98578875e85a00f433..2c5122f32ddfdc2484b7598ee961bc4b9285b551 100644 (file)
@@ -2050,48 +2050,6 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin):
         orchestrator.servicespec_validate_hosts_have_network_spec(spec)
         return self._add_daemon('mon', spec, self._create_mon)
 
-    def apply_mon(self, spec):
-        # type: (orchestrator.ServiceSpec) -> orchestrator.Completion
-        if not spec.placement.hosts and not spec.placement.label:
-            # Improve Error message. Point to parse_host_spec examples
-            raise orchestrator.OrchestratorValidationError("Mons need a host spec. (host, network, name(opt))")
-
-        spec = HostAssignment(spec=spec, get_hosts_func=self._get_hosts, service_type='mon').load()
-
-        # current support limited to adding monitors.
-        mon_map = self.get("mon_map")
-        num_mons = len(mon_map["mons"])
-        if spec.count == num_mons:
-            return orchestrator.Completion(value="The requested number of monitors exist.")
-        if spec.count < num_mons:
-            raise NotImplementedError("Removing monitors is not supported.")
-
-        self.log.debug("Trying to update monitors on: {}".format(spec.placement.hosts))
-        # check that all the hosts are registered
-        [self._require_hosts(host.hostname) for host in spec.placement.hosts]
-
-        # current support requires a network to be specified
-        orchestrator.servicespec_validate_hosts_have_network_spec(spec)
-
-        daemons = self.cache.get_daemons_by_type('mon')
-        for _, _, name in spec.placement.hosts:
-            if name and len([d for d in daemons if d.daemon_id == name]):
-                raise RuntimeError('name %s alrady exists', name)
-
-        # explicit placement: enough hosts provided?
-        num_new_mons = spec.count - num_mons
-        if len(spec.placement.hosts) < num_new_mons:
-            raise RuntimeError("Error: {} hosts provided, expected {}".format(
-                len(spec.placement.hosts), num_new_mons))
-        self.log.info("creating {} monitors on hosts: '{}'".format(
-            num_new_mons, ",".join(map(lambda h: ":".join(h), spec.placement.hosts))))
-        # TODO: we may want to chain the creation of the monitors so they join
-        # the quorum one at a time.
-        args = []
-        for host, network, name in spec.placement.hosts:
-            args.append((name or host, network, host))
-        return self._create_mon(args)
-
     @async_map_completion
     def _create_mgr(self, mgr_id, host):
         """
index 967a9606f6c7bc5e869228554da51c9f235531b6..36a9f7f1c677bde4e6089063d624888e9ac97862 100644 (file)
@@ -137,12 +137,12 @@ class TestCephadm(object):
     def test_mon_update(self, _send_command, _get_connection, _save_host, _rm_host, cephadm_module):
         with self._with_host(cephadm_module, 'test'):
             ps = PlacementSpec(hosts=['test:0.0.0.0=a'], count=1)
-            c = cephadm_module.apply_mon(ServiceSpec(placement=ps))
+            c = cephadm_module.add_mon(ServiceSpec(placement=ps))
             assert wait(cephadm_module, c) == ["Deployed mon.a on host 'test'"]
 
             with pytest.raises(OrchestratorError, match="is missing a network spec"):
                 ps = PlacementSpec(hosts=['test'], count=1)
-                c = cephadm_module.apply_mon(ServiceSpec(placement=ps))
+                c = cephadm_module.add_mon(ServiceSpec(placement=ps))
                 wait(cephadm_module, c)
 
     @mock.patch("cephadm.module.CephadmOrchestrator._run_cephadm", _run_cephadm('[]'))