mgr/orchestrator: orchestrator host label {add,rm}

Signed-off-by: Sage Weil <sage@redhat.com>
This commit is contained in:
Sage Weil 2019-11-25 08:32:53 -06:00
parent 454906fceb
commit 292a9927a4
2 changed files with 36 additions and 0 deletions

View File

@ -466,6 +466,20 @@ class Orchestrator(object):
"""
return self.get_inventory()
def add_host_label(self, host, label):
# type: (str) -> WriteCompletion
"""
Add a host label
"""
return NotImplementedError()
def remove_host_label(self, host, label):
# type: (str) -> WriteCompletion
"""
Remove a host label
"""
return NotImplementedError()
def get_inventory(self, node_filter=None, refresh=False):
# type: (InventoryFilter, bool) -> ReadCompletion[List[InventoryNode]]
"""

View File

@ -174,6 +174,28 @@ class OrchestratorCli(orchestrator.OrchestratorClientMixin, MgrModule):
result = "\n".join(map(lambda node: node.name, completion.result))
return HandleCommandResult(stdout=result)
@orchestrator._cli_write_command(
'orchestrator host label add',
'name=host,type=CephString '
'name=label,type=CephString',
'Add a host label')
def _host_label_add(self, host, label):
completion = self.add_host_label(host, label)
self._orchestrator_wait([completion])
orchestrator.raise_if_exception(completion)
return HandleCommandResult(stdout=completion.result_str())
@orchestrator._cli_write_command(
'orchestrator host label rm',
'name=host,type=CephString '
'name=label,type=CephString',
'Add a host label')
def _host_label_add(self, host, label):
completion = self.remove_host_label(host, label)
self._orchestrator_wait([completion])
orchestrator.raise_if_exception(completion)
return HandleCommandResult(stdout=completion.result_str())
@orchestrator._cli_read_command(
'orchestrator device ls',
"name=host,type=CephString,n=N,req=false "