"""
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)
"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)
)
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),