]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/orchestrator_cli: _update_mons require host spec only
authorSebastian Wagner <sebastian.wagner@suse.com>
Mon, 6 Jan 2020 13:07:55 +0000 (14:07 +0100)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 7 Jan 2020 08:44:29 +0000 (09:44 +0100)
* `mgr/cephadm` requres a host spec right now
* `mgr/rook` only supports `spec.count` right now

Signed-off-by: Sebastian Wagner <sebastian.wagner@suse.com>
src/pybind/mgr/cephadm/module.py
src/pybind/mgr/orchestrator_cli/module.py
src/pybind/mgr/rook/module.py

index 2821ce389a01b64f408b1db2e369978f0a28342d..b68b52c91d027f2999a38a1f5f68d7176e346eb4 100644 (file)
@@ -1148,6 +1148,10 @@ class CephadmOrchestrator(MgrModule, orchestrator.Orchestrator):
         """
         Adjust the number of cluster managers.
         """
+        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 = NodeAssignment(spec=spec, get_hosts_func=self._get_hosts, service_type='mon').load()
         return self._update_mons(spec)
 
index f437349cf1bd1cf2c6d65d474ba9af223b6e9866..64391f428ba73f03190811d3dc3733a3da505d65 100644 (file)
@@ -622,15 +622,10 @@ Usage:
         "name=label,type=CephString,req=false",
         'Update the number of monitor instances')
     def _update_mons(self, num=None, hosts=[], label=None):
-
-        if hosts or label:
-            placement = orchestrator.PlacementSpec(label=label, count=num, hosts=hosts)
-        else:
+        if not num and not hosts and not label:
             # Improve Error message. Point to parse_host_spec examples
-            raise orchestrator.OrchestratorValidationError("Mons need a host spec. (host, network, name(opt))")
-            # TODO: Scaling without a HostSpec doesn't work right now.
-            # we need network autodetection for that.
-            # placement = orchestrator.PlacementSpec(count=num)
+            raise orchestrator.OrchestratorValidationError("Mons need a placement spec. (num, host, network, name(opt))")
+        placement = orchestrator.PlacementSpec(label=label, count=num, hosts=hosts)
         placement.validate()
 
         spec = orchestrator.StatefulServiceSpec(placement=placement)
index a04f7732c5063527429c74026c71db009961d92f..38ead7c40d9a5bd69ae90c8ffd5463d0895c083d 100644 (file)
@@ -338,8 +338,9 @@ class RookOrchestrator(MgrModule, orchestrator.Orchestrator):
         )
 
     def update_mons(self, spec):
-        if spec.placement.nodes:
-            raise RuntimeError("Host list is not supported by rook.")
+        # type: (orchestrator.StatefulServiceSpec) -> RookCompletion
+        if spec.placement.hosts or spec.placement.label:
+            raise RuntimeError("Host list or label is not supported by rook.")
 
         return write_completion(
             lambda: self.rook_cluster.update_mon_count(spec.placement.count),