def _update_mgrs(self, num=None, hosts=[], label=None): placement = orchestrator.PlacementSpec(label=label, count=num, hosts=hosts) placement.validate() spec = orchestrator.StatefulServiceSpec(placement=placement) completion = self.update_mgrs(spec) self._orchestrator_wait([completion]) orchestrator.raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str())
def _update_mons(self, num=None, hosts=[], label=None): if not num and not hosts and not label: # Improve Error message. Point to parse_host_spec examples 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) completion = self.update_mons(spec) self._orchestrator_wait([completion]) orchestrator.raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str())
def _update_mons(self, num=None, hosts=[], label=None): placement = orchestrator.PlacementSpec(label=label, count=num, hosts=hosts) if 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) placement.validate() spec = orchestrator.StatefulServiceSpec(placement=placement) completion = self.update_mons(spec) self._orchestrator_wait([completion]) orchestrator.raise_if_exception(completion) return HandleCommandResult(stdout=completion.result_str())