Example #1
0
 def test_mgr_update(self, _send_command, _get_connection, cephadm_module):
     with self._with_host(cephadm_module, 'test'):
         c = cephadm_module.update_mgrs(1,
                                        [parse_host_specs('test:0.0.0.0')])
         [out] = self._wait(cephadm_module, c)
         assert "(Re)deployed mgr." in out
         assert " on host 'test'" in out
Example #2
0
    def _update_mons(self, num, hosts=None):
        hosts = hosts if hosts is not None else []

        if num <= 0:
            return HandleCommandResult(-errno.EINVAL,
                                       stderr="Invalid number of mons: require {} > 0".format(num))

        if hosts:
            try:
                hosts = [orchestrator.parse_host_specs(host_spec)
                         for host_spec in hosts]
            except Exception as e:
                msg = "Failed to parse host list: '{}': {}".format(hosts, e)
                return HandleCommandResult(-errno.EINVAL, stderr=msg)

        completion = self.update_mons(num, hosts)
        self._orchestrator_wait([completion])
        orchestrator.raise_if_exception(completion)
        return HandleCommandResult(stdout=completion.result_str())
Example #3
0
def test_parse_host_specs_raises(test_input):
    with pytest.raises(ValueError):
        ret = parse_host_specs(test_input)
Example #4
0
def test_parse_host_specs(test_input, expected, require_network):
    ret = parse_host_specs(test_input, require_network=require_network)
    assert ret == expected
    assert str(ret) == test_input
Example #5
0
 def test_mon_update(self, _send_command, _get_connection, cephadm_module):
     with self._with_host(cephadm_module, 'test'):
         c = cephadm_module.update_mons(
             1, [parse_host_specs('test:0.0.0.0=a')])
         assert self._wait(cephadm_module,
                           c) == ["(Re)deployed mon.a on host 'test'"]