mirror of
https://github.com/ceph/ceph
synced 2025-02-24 11:37:37 +00:00
mgr/orch,cephadm: add 'host set-addr'
Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
parent
5276871e15
commit
d3b9a2252c
@ -1173,6 +1173,16 @@ class CephadmOrchestrator(MgrModule, orchestrator.OrchestratorClientMixin):
|
||||
self.event.set() # refresh stray health check
|
||||
return "Removed host '{}'".format(host)
|
||||
|
||||
@async_completion
|
||||
def update_host_addr(self, host, addr):
|
||||
if host not in self.inventory:
|
||||
raise OrchestratorError('host %s not registered' % host)
|
||||
self.inventory[host]['addr'] = addr
|
||||
self._save_inventory()
|
||||
self._reset_con(host)
|
||||
self.event.set() # refresh stray health check
|
||||
return "Updated host '{}' addr to '{}'".format(host, addr)
|
||||
|
||||
@trivial_completion
|
||||
def get_hosts(self):
|
||||
"""
|
||||
|
@ -784,6 +784,16 @@ class Orchestrator(object):
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def update_host_addr(self, host, addr):
|
||||
# type: (str, str) -> Completion
|
||||
"""
|
||||
Update a host's address
|
||||
|
||||
:param host: hostname
|
||||
:param addr: address (dns name or IP)
|
||||
"""
|
||||
raise NotImplementedError()
|
||||
|
||||
def get_hosts(self):
|
||||
# type: () -> Completion
|
||||
"""
|
||||
|
@ -178,6 +178,17 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
|
||||
orchestrator.raise_if_exception(completion)
|
||||
return HandleCommandResult(stdout=completion.result_str())
|
||||
|
||||
@orchestrator._cli_write_command(
|
||||
'orchestrator host set-addr',
|
||||
'name=host,type=CephString '
|
||||
'name=addr,type=CephString',
|
||||
'Update a host address')
|
||||
def _update_set_addr(self, host, addr):
|
||||
completion = self.update_host_addr(host, addr)
|
||||
self._orchestrator_wait([completion])
|
||||
orchestrator.raise_if_exception(completion)
|
||||
return HandleCommandResult(stdout=completion.result_str())
|
||||
|
||||
@orchestrator._cli_read_command(
|
||||
'orchestrator host ls',
|
||||
'name=format,type=CephChoices,strings=json|plain,req=false',
|
||||
|
Loading…
Reference in New Issue
Block a user