Documentation
¶
Index ¶
- Variables
- func ApplyAggregates(ctx context.Context, serviceClient *gophercloud.ServiceClient, host string, ...) ([]kvmv1.Aggregate, error)
- func CleanupResourceProvider(ctx context.Context, client *gophercloud.ServiceClient, ...) error
- func GetHypervisorByName(ctx context.Context, sc *gophercloud.ServiceClient, ...) (*hypervisors.Hypervisor, error)
- func GetServiceClient(ctx context.Context, serviceType string, authInfo *clientconfig.AuthInfo) (*gophercloud.ServiceClient, error)
- type ConsumerAllocations
- type HyperVisorsDetails
- type ListAllocationsResult
- type UpdateServiceOpts
- type UpdateTraitsOpts
- type UpdateTraitsOptsBuilder
- type UpdateTraitsResult
Constants ¶
This section is empty.
Variables ¶
var ErrMultipleHypervisors = errors.New("multiple hypervisors found")
var ErrNoHypervisor = errors.New("no hypervisor found")
Functions ¶
func ApplyAggregates ¶
func ApplyAggregates(ctx context.Context, serviceClient *gophercloud.ServiceClient, host string, desiredAggregates []string) ([]kvmv1.Aggregate, error)
ApplyAggregates ensures a host is in exactly the specified aggregates.
The function performs a two-phase operation to maintain security: 1. Verifies that all desired aggregates exist 2. Adds the host to all aggregates it should be in but isn't already 3. Removes the host from any aggregates it shouldn't be in
This ordering prevents leaving the host unprotected between operations when aggregates have filter criteria. However, conflicts may still occur with aggregates in different availability zones, in which case errors are collected and returned together for eventual convergence.
All specified aggregates must already exist in OpenStack. If any desired aggregate is not found, an error is returned listing the missing aggregates.
Pass an empty list to remove the host from all aggregates.
func CleanupResourceProvider ¶
func CleanupResourceProvider(ctx context.Context, client *gophercloud.ServiceClient, provider *resourceproviders.ResourceProvider) error
Remove all empty Allocations for a certain provider, and if it is empty, delete it
func GetHypervisorByName ¶
func GetHypervisorByName(ctx context.Context, sc *gophercloud.ServiceClient, hypervisorHostnamePattern string, withServers bool) (*hypervisors.Hypervisor, error)
func GetServiceClient ¶
func GetServiceClient(ctx context.Context, serviceType string, authInfo *clientconfig.AuthInfo) (*gophercloud.ServiceClient, error)
GetServiceClient returns an gophercloud ServiceClient for the given serviceType.
Types ¶
type ConsumerAllocations ¶
type ConsumerAllocations struct {
Allocations map[string]resourceproviders.Allocation `json:"allocations"`
ConsumerGeneration int `json:"consumer_generation"`
ProjectID string `json:"project_id"`
UserID string `json:"user_id"`
ConsumerType string `json:"consumer_type"`
}
type HyperVisorsDetails ¶
type HyperVisorsDetails struct {
Hypervisors []hypervisors.Hypervisor `json:"hypervisors"`
}
type ListAllocationsResult ¶
type ListAllocationsResult struct {
gophercloud.Result
}
ListAllocationsResult is the response of a Get allocations operations. Call its Extract method to interpret it as a Allocations.
func (ListAllocationsResult) Extract ¶
func (r ListAllocationsResult) Extract() (*ConsumerAllocations, error)
Extract interprets a ListAllocationsResult as a Allocations.
type UpdateServiceOpts ¶
type UpdateServiceOpts struct {
// Status represents the new service status. One of enabled or disabled.
Status services.ServiceStatus `json:"status,omitempty"`
// DisabledReason represents the reason for disabling a service.
DisabledReason string `json:"disabled_reason,omitempty"`
// ForcedDown is a manual override to tell nova that the service in question
// has been fenced manually by the operations team.
ForcedDown *bool `json:"forced_down,omitempty"`
}
func (UpdateServiceOpts) ToServiceUpdateMap ¶
func (opts UpdateServiceOpts) ToServiceUpdateMap() (map[string]any, error)
ToServiceUpdateMap formats an UpdateServiceOpts structure into a request body.
type UpdateTraitsOpts ¶
type UpdateTraitsOpts struct {
Traits []string `json:"traits"`
ResourceProviderGeneration int `json:"resource_provider_generation"`
}
UpdateTraitsOpts represents options used to create a resource provider.
func (UpdateTraitsOpts) ToResourceProviderUpdateTraitsMap ¶
func (opts UpdateTraitsOpts) ToResourceProviderUpdateTraitsMap() (map[string]any, error)
ToResourceProviderUpdateTraitsMap constructs a request body from UpdateTraitsOpts.
type UpdateTraitsOptsBuilder ¶
type UpdateTraitsOptsBuilder interface {
ToResourceProviderUpdateTraitsMap() (map[string]any, error)
}
UpdateTraitsOptsBuilder allows extensions to add additional parameters to the UpdateTraits request.
type UpdateTraitsResult ¶
type UpdateTraitsResult struct {
gophercloud.Result
}
UpdateTraitsResult is the response of a Put traits operations. Call its Extract method to interpret it as a ResourceProviderTraits.
func UpdateTraits ¶
func UpdateTraits(ctx context.Context, client *gophercloud.ServiceClient, resourceProviderID string, opts UpdateTraitsOptsBuilder) (r UpdateTraitsResult)