// Find hosts suitable for migrating a virtual machine.
555232
func (s *HostService) FindHostsForMigration(p *FindHostsForMigrationParams) (*FindHostsForMigrationResponse, error) {
	resp, err := s.cs.newRequest("findHostsForMigration", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r FindHostsForMigrationResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
633007
func (t *vhostTrie) matchHost(host string) *vhostTrie {
	// try exact match
	if subtree, ok := t.edges[host]; ok {
		return subtree
	}

	// then try replacing labels in the host
	// with wildcards until we get a match
	labels := strings.Split(host, ".")
	for i := range labels {
		labels[i] = "*"
		candidate := strings.Join(labels, ".")
		if subtree, ok := t.edges[candidate]; ok {
			return subtree
		}
	}

	return nil
}
874429
func (c *Client) FindHostsInPool(poolID string) ([]host.Host, error) {
	response := make([]host.Host, 0)
	if err := c.call("FindHostsInPool", poolID, &response); err != nil {
		return []host.Host{}, err
	}
	return response, nil
}
282703
func (ds *Datastore) GetDatastoreHostMounts(ctx context.Context) ([]types.ManagedObjectReference, error) {
	var dsMo mo.Datastore
	pc := property.DefaultCollector(ds.Client())
	err := pc.RetrieveOne(ctx, ds.Datastore.Reference(), []string{"host"}, &dsMo)
	if err != nil {
		klog.Errorf("Failed to retrieve datastore host mount property. err: %v", err)
		return nil, err
	}
	hosts := make([]types.ManagedObjectReference, len(dsMo.Host))
	for _, dsHostMount := range dsMo.Host {
		hosts = append(hosts, dsHostMount.Key)
	}
	return hosts, nil
}
963186
func (_class HostMetricsClass) GetAll(sessionID SessionRef) (_retval []HostMetricsRef, _err error) {
	_method := "host_metrics.get_all"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertHostMetricsRefSetToGo(_method + " -> ", _result.Value)
	return
}
410095
func (c *Config) Host() string {
	switch c.Type {
	case "ssh":
		return c.SSHHost
	case "winrm":
		return c.WinRMHost
	default:
		return ""
	}
}
517054
func (_class HostCPUClass) GetAllRecords(sessionID SessionRef) (_retval map[HostCPURef]HostCPURecord, _err error) {
	_method := "host_cpu.get_all_records"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg)
	if _err != nil {
		return
	}
	_retval, _err = convertHostCPURefToHostCPURecordMapToGo(_method + " -> ", _result.Value)
	return
}
84701
func (_m *FacadeInterface) GetHostStatuses(ctx datastore.Context, hostIDs []string, since time.Time) ([]host.HostStatus, error) {
	ret := _m.Called(ctx, hostIDs, since)

	var r0 []host.HostStatus
	if rf, ok := ret.Get(0).(func(datastore.Context, []string, time.Time) []host.HostStatus); ok {
		r0 = rf(ctx, hostIDs, since)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]host.HostStatus)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, []string, time.Time) error); ok {
		r1 = rf(ctx, hostIDs, since)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
1023446
func getHostsSlice(records []dns.SrvRecord) []string {
	var hosts []string
	for _, r := range records {
		hosts = append(hosts, r.Host)
	}
	return hosts
}
45246
func (kc *HostKeyChecker) GetHostKeyAlgorithms(addr string) []string {
	var results []string
	remoteAddr, err := kc.addrToHostPort(addr)
	if err != nil {
		log.Errorf("Failed to parse address %v: %v", addr, err)
		return nil
	}

	hostKeys, err := kc.m.GetHostKeys()

	_, ok := err.(*os.PathError)
	if err != nil && !ok {
		log.Errorf("Failed to read known_hosts file %v: %v", kc.m.String(), err)
		return nil
	}

	for pattern, keys := range hostKeys {
		if !matchHost(remoteAddr, pattern) {
			remoteIP, err := net.ResolveTCPAddr("tcp", addr)
			if err != nil {
				log.Errorf("Failed to resolve TCP address %v: %v", addr, err)
				continue
			}
			ipAddr, err := kc.addrToHostPort(remoteIP.String())
			if err != nil {
				log.Errorf("Failed to parse address %v: %v", remoteIP.String(), err)
				continue
			}
			if !matchHost(ipAddr, pattern) {
				continue
			}
		}
		for _, hostKey := range keys {
			results = append(results, hostKey.Type())
		}
	}

	return results
}
602723
func (api *API) Hosts(ctx context.Context) []*Node {
	span, _ := tracing.StartSpanFromContext(ctx, "API.Hosts")
	defer span.Finish()
	return api.cluster.Nodes()
}
37537
func (vm *VM) listHostedServices() ([]hostedservice.HostedService, error) {
	sc, err := vm.getServiceClient()
	if err != nil {
		return nil, fmt.Errorf(errGetClient, err)
	}

	resp, err := sc.ListHostedServices()
	if err != nil {
		return nil, err
	}

	return resp.HostedServices, nil
}
349888
func (r Network_Storage_Group_Nfs) GetAllowedHosts() (resp []datatypes.Network_Storage_Allowed_Host, err error) {
	err = r.Session.DoRequest("SoftLayer_Network_Storage_Group_Nfs", "getAllowedHosts", nil, &r.Options, &resp)
	return
}
401669
func (r Virtual_DedicatedHost) GetAvailableRouters(dedicatedHost *datatypes.Virtual_DedicatedHost) (resp []datatypes.Hardware, err error) {
	params := []interface{}{
		dedicatedHost,
	}
	err = r.Session.DoRequest("SoftLayer_Virtual_DedicatedHost", "getAvailableRouters", params, &r.Options, &resp)
	return
}
212951
func (s *HostService) ListHostTags(p *ListHostTagsParams) (*ListHostTagsResponse, error) {
	resp, err := s.cs.newRequest("listHostTags", p.toURLValues())
	if err != nil {
		return nil, err
	}

	var r ListHostTagsResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
8115
func (r Virtual_Guest) MigrateDedicatedHost(destinationHostId *int) (err error) {
	var resp datatypes.Void
	params := []interface{}{
		destinationHostId,
	}
	err = r.Session.DoRequest("SoftLayer_Virtual_Guest", "migrateDedicatedHost", params, &r.Options, &resp)
	return
}
1073660
func (_m *FacadeInterface) FindHostsInPool(ctx datastore.Context, poolID string) ([]host.Host, error) {
	ret := _m.Called(ctx, poolID)

	var r0 []host.Host
	if rf, ok := ret.Get(0).(func(datastore.Context, string) []host.Host); ok {
		r0 = rf(ctx, poolID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).([]host.Host)
		}
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(datastore.Context, string) error); ok {
		r1 = rf(ctx, poolID)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}