Documentation
¶
Index ¶
- type InventoryUsage
- type PlacementAPI
- type PlacementSyncer
- func (s *PlacementSyncer) Init(ctx context.Context) error
- func (s *PlacementSyncer) Sync(ctx context.Context) (int64, error)
- func (s *PlacementSyncer) SyncInventoryUsages(ctx context.Context) (int64, error)
- func (s *PlacementSyncer) SyncResourceProviders(ctx context.Context) (int64, error)
- func (s *PlacementSyncer) SyncTraits(ctx context.Context) (int64, error)
- type ResourceProvider
- type Trait
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type InventoryUsage ¶
type InventoryUsage struct {
ResourceProviderUUID string `db:"resource_provider_uuid,primarykey"`
ResourceProviderGeneration int `db:"resource_provider_generation"`
// Something like: DISK_GB, VCPU, MEMORY_MB.
InventoryClassName string `db:"inventory_class_name,primarykey"`
// Overcommit factor for the inventory class.
AllocationRatio float32 `db:"allocation_ratio"`
// A maximum amount any single allocation against an inventory can have.
MaxUnit int `db:"max_unit"`
// A minimum amount any single allocation against an inventory can have.
MinUnit int `db:"min_unit"`
// The amount of the resource a provider has reserved for its own use.
Reserved int `db:"reserved"`
// A representation of the divisible amount of the resource that may be
// requested. For example, step_size = 5 means that only values divisible by
// 5 (5, 10, 15, etc.) can be requested.
StepSize int `db:"step_size"`
// The actual amount of the resource that the provider can accommodate.
Total int `db:"total"`
// The amount of the resource that is currently in use.
Used int `db:"used"`
}
Combined model for resource provider inventories and usages.
Both models are combined in one table to avoid frequent joins, since both are used in conjunction to calculate capacity. They are also fetched and displayed together when using the cli command `openstack resource provider inventory list`.
See: https://docs.openstack.org/api-ref/placement/#list-resource-provider-inventories And: https://docs.openstack.org/api-ref/placement/#list-usages
func (InventoryUsage) Indexes ¶
func (InventoryUsage) Indexes() map[string][]string
Indexes for the resource provider inventory table.
func (InventoryUsage) TableName ¶
func (InventoryUsage) TableName() string
Table in which the openstack inventory usage model is stored.
type PlacementAPI ¶
type PlacementAPI interface {
// Init the placement API.
Init(ctx context.Context) error
// Fetch all resource providers from the placement API.
GetAllResourceProviders(ctx context.Context) ([]ResourceProvider, error)
// Fetch all traits for the given resource providers from the placement API.
GetAllTraits(ctx context.Context, providers []ResourceProvider) ([]Trait, error)
// Fetch all inventories + usages for the given resource providers from the placement API.
GetAllInventoryUsages(ctx context.Context, providers []ResourceProvider) ([]InventoryUsage, error)
}
func NewPlacementAPI ¶
func NewPlacementAPI(mon datasources.Monitor, k keystone.KeystoneAPI, conf v1alpha1.PlacementDatasource) PlacementAPI
Create a new OpenStack placement api.
type PlacementSyncer ¶
type PlacementSyncer struct {
// Database to store the placement objects in.
DB db.DB
// Monitor to track the syncer.
Mon datasources.Monitor
// Configuration for the placement syncer.
Conf v1alpha1.PlacementDatasource
// Placement API client to fetch the data.
API PlacementAPI
}
Syncer for OpenStack
func (*PlacementSyncer) Init ¶
func (s *PlacementSyncer) Init(ctx context.Context) error
Init the OpenStack resource provider and trait syncer.
func (*PlacementSyncer) Sync ¶
func (s *PlacementSyncer) Sync(ctx context.Context) (int64, error)
Sync the OpenStack placement objects.
func (*PlacementSyncer) SyncInventoryUsages ¶
func (s *PlacementSyncer) SyncInventoryUsages(ctx context.Context) (int64, error)
Sync the OpenStack resource provider inventories and usages into the database.
func (*PlacementSyncer) SyncResourceProviders ¶
func (s *PlacementSyncer) SyncResourceProviders(ctx context.Context) (int64, error)
Sync the OpenStack resource providers into the database.
func (*PlacementSyncer) SyncTraits ¶
func (s *PlacementSyncer) SyncTraits(ctx context.Context) (int64, error)
Sync the OpenStack traits into the database.
type ResourceProvider ¶
type ResourceProvider struct {
UUID string `json:"uuid" db:"uuid,primarykey"`
Name string `json:"name" db:"name"`
ParentProviderUUID string `json:"parent_provider_uuid" db:"parent_provider_uuid"`
RootProviderUUID string `json:"root_provider_uuid" db:"root_provider_uuid"`
ResourceProviderGeneration int `json:"resource_provider_generation" db:"resource_provider_generation"`
}
Resource provider model from the OpenStack placement API. This model is returned when listing resource providers.
func (ResourceProvider) Indexes ¶
func (r ResourceProvider) Indexes() map[string][]string
Indexes for the resource provider table.
func (ResourceProvider) TableName ¶
func (r ResourceProvider) TableName() string
Table in which the openstack model is stored.
type Trait ¶
type Trait struct {
// Corresponds to the hypervisor uuid in the nova hypervisors table.
ResourceProviderUUID string `db:"resource_provider_uuid,primarykey"`
Name string `db:"name,primarykey"`
ResourceProviderGeneration int `db:"resource_provider_generation"`
}
Resource provider trait model from the OpenStack placement API.