parameters: (self, spec)
return_statement: return "Added host '{}' with addr '{}'".format(spec.hostname, spec.addr)
docstring: Add a host to be managed by the orchestrator.
  
          :param host: host name
docstring_summary: Add a host to be managed by the orchestrator.
docstring_tokens: Add a host to be managed by the orchestrator .
function: def _add_host(self, spec):
          # type: (HostSpec) -> str
          """
          Add a host to be managed by the orchestrator.
  
          :param host: host name
          """
          spec.validate()
          ip_addr = self._check_valid_addr(spec.hostname, spec.addr)
          if spec.addr == spec.hostname and ip_addr:
              spec.addr = ip_addr
  
          if spec.hostname in self.inventory and self.inventory.get_addr(spec.hostname) != spec.addr:
              self.cache.refresh_all_host_info(spec.hostname)
  
          # prime crush map?
          if spec.location:
              self.check_mon_command({
                  'prefix': 'osd crush add-bucket',
                  'name': spec.hostname,
                  'type': 'host',
                  'args': [f'{k}={v}' for k, v in spec.location.items()],
              })
  
          if spec.hostname not in self.inventory:
              self.cache.prime_empty_host(spec.hostname)
          self.inventory.add_host(spec)
          self.offline_hosts_remove(spec.hostname)
          if spec.status == 'maintenance':
              self._set_maintenance_healthcheck()
          self.event.set()  # refresh stray health check
          self.log.info('Added host %s' % spec.hostname)
          return "Added host '{}' with addr '{}'".format(spec.hostname, spec.addr)
function_tokens: def _add_host ( self , spec ) : # type: (HostSpec) -> str spec . validate ( ) ip_addr = self . _check_valid_addr ( spec . hostname , spec . addr ) if spec . addr == spec . hostname and ip_addr : spec . addr = ip_addr if spec . hostname in self . inventory and self . inventory . get_addr ( spec . hostname ) != spec . addr : self . cache . refresh_all_host_info ( spec . hostname ) # prime crush map? if spec . location : self . check_mon_command ( { 'prefix' : 'osd crush add-bucket' , 'name' : spec . hostname , 'type' : 'host' , 'args' : [ f'{k}={v}' for k , v in spec . location . items ( ) ] , } ) if spec . hostname not in self . inventory : self . cache . prime_empty_host ( spec . hostname ) self . inventory . add_host ( spec ) self . offline_hosts_remove ( spec . hostname ) if spec . status == 'maintenance' : self . _set_maintenance_healthcheck ( ) self . event . set ( ) # refresh stray health check self . log . info ( 'Added host %s' % spec . hostname ) return "Added host '{}' with addr '{}'" . format ( spec . hostname , spec . addr )