//GetResourcePools Get a list of all the resource pools
178709
func (ps *storeImpl) GetResourcePools(ctx datastore.Context) ([]ResourcePool, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("PoolStore.GetResourcePools"))
	return query(ctx, "_exists_:ID")
}
134888
func (c *Client) ListResources(ctx context.Context, root *view.ContainerView, kind []string, ps []string, dst interface{}) error {
	ctx1, cancel1 := context.WithTimeout(ctx, c.Timeout)
	defer cancel1()
	return root.Retrieve(ctx1, kind, ps, dst)
}
39859
func SyncResourcePools(conn client.Connection, pools []pool.ResourcePool) error {
	pth := path.Join("/pools")

	logger := plog.WithField("zkpath", pth)

	// look up the children pool ids
	ch, err := conn.Children(pth)
	if err != nil && err != client.ErrNoNode {
		logger.WithError(err).Debug("Could not look up resource pools")
		return err
	}

	// store the pool ids in a hash map
	chmap := make(map[string]struct{})
	for _, poolid := range ch {
		chmap[poolid] = struct{}{}
	}

	// set the resource pools
	for _, p := range pools {
		if err := UpdateResourcePool(conn, p); err != nil {
			return err
		}

		// delete matching records
		if _, ok := chmap[p.ID]; ok {
			delete(chmap, p.ID)
		}
	}

	// remove any leftovers
	for poolid := range chmap {
		if err := RemoveResourcePool(conn, poolid); err != nil {
			return err
		}
	}
	return nil
}
762194
func (s *Server) GetResourcePool(poolID string, reply *pool.ResourcePool) error {
	response, err := s.f.GetResourcePool(s.context(), poolID)
	if err != nil {
		return err
	}
	if response == nil {
		return errors.New("pool not found")
	}
	*reply = *response
	return nil
}
1182562
func (f *Facade) GetResourcePool(ctx datastore.Context, id string) (*pool.ResourcePool, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetResourcePool"))
	glog.V(2).Infof("Facade.GetResourcePool: id=%s", id)
	var entity pool.ResourcePool
	err := f.poolStore.Get(ctx, pool.Key(id), &entity)
	if datastore.IsErrNoSuchEntity(err) {
		return nil, nil
	}
	if err != nil {
		return nil, err
	}

	f.calcPoolCapacity(ctx, &entity)

	return &entity, nil
}
189110
func (m *cgroupManagerImpl) GetResourceStats(name CgroupName) (*ResourceStats, error) {
	cgroupPaths := m.buildCgroupPaths(name)
	stats, err := getStatsSupportedSubsystems(cgroupPaths)
	if err != nil {
		return nil, fmt.Errorf("failed to get stats supported cgroup subsystems for cgroup %v: %v", name, err)
	}
	return toResourceStats(stats), nil
}
1038778
func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResourceList, error) {
	apiGroups, err := d.ServerGroups()
	if err != nil {
		return nil, err
	}
	groupVersions := ExtractGroupVersions(apiGroups)
	result := map[string]*unversioned.APIResourceList{}
	for _, groupVersion := range groupVersions {
		resources, err := d.ServerResourcesForGroupVersion(groupVersion)
		if err != nil {
			return nil, err
		}
		result[groupVersion] = resources
	}
	return result, nil
}
219495
func (c *Client) ListPools(providers, names []string) ([]params.StoragePool, error) {
	args := params.StoragePoolFilters{
		Filters: []params.StoragePoolFilter{{
			Names:     names,
			Providers: providers,
		}},
	}
	var results params.StoragePoolsResults
	if err := c.facade.FacadeCall("ListPools", args, &results); err != nil {
		return nil, errors.Trace(err)
	}
	if len(results.Results) != 1 {
		return nil, errors.Errorf("expected 1 result, got %d", len(results.Results))
	}
	if err := results.Results[0].Error; err != nil {
		return nil, err
	}
	return results.Results[0].Result, nil
}
1232362
func (f *Facade) AddResourcePool(ctx datastore.Context, entity *pool.ResourcePool) error {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.AddResourcePool"))

	glog.Infof("Adding Resource Pool %s", entity.ID)

	alog := f.auditLogger.Message(ctx, "Adding Resource Pool").
		Action(audit.Add).Entity(entity)

	if err := f.DFSLock(ctx).LockWithTimeout("add resource pool", userLockTimeout); err != nil {
		glog.Warningf("Cannot add resource pool: %s", err)
		return alog.Error(err)
	}
	defer f.DFSLock(ctx).Unlock()

	return alog.Error(f.addResourcePool(ctx, entity))
}
1228768
func (f *Facade) GetActiveHostIDs(ctx datastore.Context) ([]string, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetActiveHostIDs"))
	hostids := []string{}
	pools, err := f.GetResourcePools(ctx)
	if err != nil {
		glog.Errorf("Could not get resource pools: %v", err)
		return nil, err
	}
	for _, p := range pools {
		var active []string
		if err := f.zzk.GetActiveHosts(ctx, p.ID, &active); err != nil {
			glog.Errorf("Could not get active host ids for pool: %v", err)
			return nil, err
		}
		hostids = append(hostids, active...)
	}
	return hostids, nil
}
310203
func (ctx *Context) GetResource() (Resource, error) {
	if ctx.Resource == nil {
		return nil, trace.NotFound("resource is not set in the context")
	}
	return ctx.Resource, nil
}
1009531
func (_class PoolClass) GetAll(sessionID SessionRef) (_retval []PoolRef, _err error) {
	_method := "pool.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 = convertPoolRefSetToGo(_method + " -> ", _result.Value)
	return
}
778560
func GetResourceParams(r *raml.Resource) []string {
	params := []string{}
	return _getResourceParams(r, params)
}
696288
func (o *Domain) SPATSourcesPools(info *bambou.FetchingInfo) (SPATSourcesPoolsList, *bambou.Error) {

	var list SPATSourcesPoolsList
	err := bambou.CurrentSession().FetchChildren(o, SPATSourcesPoolIdentity, &list, info)
	return list, err
}
1143605
func GetResource(kind string, resources []*api.GenericResource) []*api.GenericResource {
	var res []*api.GenericResource

	for _, r := range resources {
		if Kind(r) != kind {
			continue
		}

		res = append(res, r)
	}

	return res
}
19170
func (c CcaClient) GetResources(serviceCode string, environmentName string) (services.ServiceResources, error) {
	//TODO: change to check service type of service code
	return cloudca.NewResources(c.apiClient, serviceCode, environmentName), nil
}
813245
func (f *Facade) GetResourcePools(ctx datastore.Context) ([]pool.ResourcePool, error) {
	defer ctx.Metrics().Stop(ctx.Metrics().Start("Facade.GetResourcePools"))
	pools, err := f.poolStore.GetResourcePools(ctx)

	if err != nil {
		return nil, fmt.Errorf("Could not load pools: %v", err)
	}

	for i := range pools {
		f.calcPoolCapacity(ctx, &pools[i])
		f.calcPoolCommitment(ctx, &pools[i])
	}

	return pools, err
}