// getHostsForPool returns the list of hosts for a pool.
346894
func getHostsForPool(w *rest.ResponseWriter, r *rest.Request, ctx *requestContext) {
	poolID, err := url.QueryUnescape(r.PathParam("poolId"))
	if err != nil {
		writeJSON(w, err, http.StatusBadRequest)
		return
	} else if len(poolID) == 0 {
		writeJSON(w, "poolId must be specified", http.StatusBadRequest)
		return
	}

	facade := ctx.getFacade()
	dataCtx := ctx.getDatastoreContext()

	hosts, err := facade.FindReadHostsInPool(dataCtx, poolID)
	if err != nil {
		restServerError(w, err)
		return
	}

	w.WriteJson(hosts)
}
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
}
1023446
func getHostsSlice(records []dns.SrvRecord) []string {
	var hosts []string
	for _, r := range records {
		hosts = append(hosts, r.Host)
	}
	return hosts
}
1342112
func (s *Server) GetPoolIPs(poolID string, reply *pool.PoolIPs) error {
	response, err := s.f.GetPoolIPs(s.context(), poolID)
	if err != nil {
		return err
	}
	if response == nil {
		return errors.New("pool not found")
	}
	*reply = *response
	return nil
}
292508
func (f *Facade) GetHosts(ctx datastore.Context) ([]host.Host, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetHosts"))
	return f.hostStore.GetN(ctx, 10000)
}
805981
func (p *Pool) getPool(addr string) *redis.Pool {

	defer scopedLock(&p.mutx)()

	pool, found := p.pools[addr]
	if !found {
		pool = redis.NewPool(func() (redis.Conn, error) {
			return p.dialFunc(addr)
		}, maxIdle)

		pool.TestOnBorrow = func(c redis.Conn, t time.Time) error {

			// for testing - count how many borrows we did
			atomic.AddInt64(&p.numBorrowed, 1)
			if time.Since(t) > testOnBorrowInterval {
				_, err := c.Do("PING")
				return err
			}
			return nil
		}

		p.pools[addr] = pool
	}

	return pool

}
810216
func (nc *Conn) getServers(implicitOnly bool) []string {
	poolSize := len(nc.srvPool)
	var servers = make([]string, 0)
	for i := 0; i < poolSize; i++ {
		if implicitOnly && !nc.srvPool[i].isImplicit {
			continue
		}
		url := nc.srvPool[i].url
		servers = append(servers, fmt.Sprintf("%s://%s", url.Scheme, url.Host))
	}
	return servers
}
717618
func (d *DNSProvider) getHosts(sld, tld string) ([]Record, error) {
	request, err := d.newRequestGet("namecheap.domains.dns.getHosts",
		addParam("SLD", sld),
		addParam("TLD", tld),
	)
	if err != nil {
		return nil, err
	}

	var ghr getHostsResponse
	err = d.do(request, &ghr)
	if err != nil {
		return nil, err
	}

	if len(ghr.Errors) > 0 {
		return nil, fmt.Errorf("%s [%d]", ghr.Errors[0].Description, ghr.Errors[0].Number)
	}

	return ghr.Hosts, nil
}
44962
func (c *Client) GetResourcePool(poolID string) (*pool.ResourcePool, error) {
	response := pool.New(poolID)
	if err := c.call("GetResourcePool", poolID, response); err != nil {
		return nil, err
	}
	return response, nil
}
517565
func (s *storeImpl) GetServicesByPool(ctx datastore.Context, poolID string) ([]Service, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("ServiceStore.GetServicesByPool"))
	id := strings.TrimSpace(poolID)
	if id == "" {
		return nil, errors.New("empty poolID not allowed")
	}
	q := datastore.NewQuery(ctx)
	query := search.Query().Term("PoolID", id)
	search := search.Search("controlplane").Type(kind).Size("50000").Query(query)
	results, err := q.Execute(search)
	if err != nil {
		return nil, err
	}
	return s.convert(results)
}
579141
func (_m *ClientInterface) GetResourcePool(poolID string) (*pool.ResourcePool, error) {
	ret := _m.Called(poolID)

	var r0 *pool.ResourcePool
	if rf, ok := ret.Get(0).(func(string) *pool.ResourcePool); ok {
		r0 = rf(poolID)
	} else {
		if ret.Get(0) != nil {
			r0 = ret.Get(0).(*pool.ResourcePool)
		}
	}

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

	return r0, r1
}
639280
func (_class HostCPUClass) GetHost(sessionID SessionRef, self HostCPURef) (_retval HostRef, _err error) {
	_method := "host_cpu.get_host"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertHostCPURefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertHostRefToGo(_method + " -> ", _result.Value)
	return
}
556478
func (s *Service) GetServiceVHosts() []ServiceEndpoint {
	result := []ServiceEndpoint{}

	if s.Endpoints != nil {
		for _, ep := range s.Endpoints {
			if len(ep.VHostList) > 0 {
				result = append(result, ep)
			}
		}
	}

	return result
}
848418
func (r *ringDescriber) GetHosts() ([]*HostInfo, string, error) {
	r.mu.Lock()
	defer r.mu.Unlock()

	hosts, err := r.getClusterPeerInfo()
	if err != nil {
		return r.prevHosts, r.prevPartitioner, err
	}

	var partitioner string
	if len(hosts) > 0 {
		partitioner = hosts[0].Partitioner()
	}

	return hosts, partitioner, nil
}
616008
func (_class HostClass) GetFeatures(sessionID SessionRef, self HostRef) (_retval []FeatureRef, _err error) {
	_method := "host.get_features"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertHostRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertFeatureRefSetToGo(_method + " -> ", _result.Value)
	return
}
1224685
func (f *Facade) FindHostsInPool(ctx datastore.Context, poolID string) ([]host.Host, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.FindHostsInPool"))
	return f.hostStore.FindHostsWithPoolID(ctx, poolID)
}
1151698
func (_class PoolPatchClass) GetHostPatches(sessionID SessionRef, self PoolPatchRef) (_retval []HostPatchRef, _err error) {
	_method := "pool_patch.get_host_patches"
	_sessionIDArg, _err := convertSessionRefToXen(fmt.Sprintf("%s(%s)", _method, "session_id"), sessionID)
	if _err != nil {
		return
	}
	_selfArg, _err := convertPoolPatchRefToXen(fmt.Sprintf("%s(%s)", _method, "self"), self)
	if _err != nil {
		return
	}
	_result, _err := _class.client.APICall(_method, _sessionIDArg, _selfArg)
	if _err != nil {
		return
	}
	_retval, _err = convertHostPatchRefSetToGo(_method + " -> ", _result.Value)
	return
}