{"modulePath":"github.com/cobaltcore-dev/openstack-hypervisor-operator","version":"v1.4.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package openstack\n\n## Constants\n\n```go\nconst IncomingMigrationsLookbackWindow = 6 * time.Hour\n```\nIncomingMigrationsLookbackWindow defines how far back we query Nova for migrations. Nova's live-migration monitor updates Migration.updated\\_at every ~5 seconds on both libvirt/kvm and libvirt/cloud-hypervisor backends, so any in-flight migration is guaranteed to appear in this window.\n\n## Variables\n\n```go\nvar ErrMultipleHypervisors = errors.New(\"multiple hypervisors found\")\n```\n\n```go\nvar ErrNoHypervisor = errors.New(\"no hypervisor found\")\n```\n\n## Functions\n\n```go\nfunc AbortMigration(ctx context.Context, sc *gophercloud.ServiceClient, instanceUUID string, migrationID int) error\n```\nAbortMigration issues DELETE /servers/{instanceUUID}/migrations/{migrationID} to abort a live-migration. Treats HTTP 404 and 409 as non-fatal (the migration already transitioned past an abortable state or was deleted).\n\n```go\nfunc ApplyAggregates(ctx context.Context, serviceClient *gophercloud.ServiceClient, host string, desiredAggregates []string) ([]kvmv1.Aggregate, error)\n```\nApplyAggregates ensures a host is in exactly the specified aggregates.\n\nThe 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\n\nThis 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.\n\nAll specified aggregates must already exist in OpenStack. If any desired aggregate is not found, an error is returned listing the missing aggregates.\n\nPass an empty list to remove the host from all aggregates.\n\n```go\nfunc CleanupResourceProvider(ctx context.Context, client *gophercloud.ServiceClient, provider *resourceproviders.ResourceProvider) error\n```\nRemove all empty Allocations for a certain provider, and if it is empty, delete it\n\n```go\nfunc GetHypervisorByName(ctx context.Context, sc *gophercloud.ServiceClient, hypervisorHostnamePattern string, withServers bool) (*hypervisors.Hypervisor, error)\n```\n\n```go\nfunc GetServiceClient(ctx context.Context, serviceType string, authInfo *clientconfig.AuthInfo) (*gophercloud.ServiceClient, error)\n```\nGetServiceClient returns a ServiceClient for the given serviceType. Providers are cached per auth context so Keystone is only hit once per unique set of credentials across all SetupWithManager calls. Concurrent callers with the same key share a single in-flight request via singleflight, preventing duplicate Keystone round-trips on startup.\n\n```go\nfunc NewProviderClient(ctx context.Context, authInfo *clientconfig.AuthInfo) (*gophercloud.ProviderClient, error)\n```\nNewProviderClient authenticates against OpenStack and returns a ProviderClient that can be reused across multiple service clients via ServiceClientFromProvider, avoiding repeated Keystone round-trips and catalog deserialisations.\n\n```go\nfunc ResourceProviderInUse(ctx context.Context, client *gophercloud.ServiceClient, providerID string) (bool, error)\n```\nResourceProviderInUse reports whether the resource provider has any non-zero usage. A missing provider is treated as not in use.\n\n```go\nfunc ServiceClientFromProvider(provider *gophercloud.ProviderClient, serviceType string) (*gophercloud.ServiceClient, error)\n```\nServiceClientFromProvider returns a ServiceClient for the given serviceType using an already-authenticated ProviderClient.\n\n## Types\n\n```go\ntype ConsumerAllocations struct {\n\tAllocations        map[string]resourceproviders.Allocation `json:\"allocations\"`\n\tConsumerGeneration int                                     `json:\"consumer_generation\"`\n\tProjectID          string                                  `json:\"project_id\"`\n\tUserID             string                                  `json:\"user_id\"`\n\tConsumerType       string                                  `json:\"consumer_type\"`\n}\n```\n\n```go\ntype HyperVisorsDetails struct {\n\tHypervisors []hypervisors.Hypervisor `json:\"hypervisors\"`\n}\n```\n\n```go\ntype ListAllocationsResult struct {\n\tgophercloud.Result\n}\n```\nListAllocationsResult is the response of a Get allocations operations. Call its Extract method to interpret it as a Allocations.\n\n```go\nfunc (r ListAllocationsResult) Extract() (*ConsumerAllocations, error)\n```\nExtract interprets a ListAllocationsResult as a Allocations.\n\n```go\ntype MigrationInfo struct {\n\tID            int    `json:\"id\"`\n\tUUID          string `json:\"uuid\"`\n\tInstanceUUID  string `json:\"instance_uuid\"`\n\tStatus        string `json:\"status\"`\n\tSourceCompute string `json:\"source_compute\"`\n\tDestCompute   string `json:\"dest_compute\"`\n\tMigrationType string `json:\"migration_type\"`\n}\n```\nMigrationInfo holds the subset of Nova migration fields relevant to settling incoming migrations on a host being drained.\n\n```go\nfunc ListActiveIncomingMigrations(ctx context.Context, sc *gophercloud.ServiceClient, host string) ([]MigrationInfo, error)\n```\nListActiveIncomingMigrations queries Nova for migrations that target the given host and are still in a non-terminal state. It issues a single call with a changes-since window of IncomingMigrationsLookbackWindow, then filters client-side for dest\\_compute==host and non-terminal status.\n\n```go\nfunc SettleIncomingMigrations(ctx context.Context, sc *gophercloud.ServiceClient, host string) (aborted, waiting []MigrationInfo, err error)\n```\nSettleIncomingMigrations combines listing and aborting: it lists all active incoming migrations for the host, aborts those in abortable states, and returns both the aborted and the waiting (post-migrating) sets.\n\nThe caller should treat:\n\n  - len(aborted) \u003e 0 as \"just issued aborts, recheck on next reconcile\"\n  - len(waiting) \u003e 0 as \"cannot abort, must wait for completion\"\n  - both empty as \"no incoming migrations; host is settled\"\n\n```go\ntype UpdateServiceOpts struct {\n\t// Status represents the new service status. One of enabled or disabled.\n\tStatus services.ServiceStatus `json:\"status,omitempty\"`\n\n\t// DisabledReason represents the reason for disabling a service.\n\tDisabledReason string `json:\"disabled_reason,omitempty\"`\n\n\t// ForcedDown is a manual override to tell nova that the service in question\n\t// has been fenced manually by the operations team.\n\tForcedDown *bool `json:\"forced_down,omitempty\"`\n}\n```\n\n```go\nfunc (opts UpdateServiceOpts) ToServiceUpdateMap() (map[string]any, error)\n```\nToServiceUpdateMap formats an UpdateServiceOpts structure into a request body.\n\n```go\ntype UpdateTraitsOpts struct {\n\tTraits                     []string `json:\"traits\"`\n\tResourceProviderGeneration int      `json:\"resource_provider_generation\"`\n}\n```\nUpdateTraitsOpts represents options used to create a resource provider.\n\n```go\nfunc (opts UpdateTraitsOpts) ToResourceProviderUpdateTraitsMap() (map[string]any, error)\n```\nToResourceProviderUpdateTraitsMap constructs a request body from UpdateTraitsOpts.\n\n```go\ntype UpdateTraitsOptsBuilder interface {\n\tToResourceProviderUpdateTraitsMap() (map[string]any, error)\n}\n```\nUpdateTraitsOptsBuilder allows extensions to add additional parameters to the UpdateTraits request.\n\n```go\ntype UpdateTraitsResult struct {\n\tgophercloud.Result\n}\n```\nUpdateTraitsResult is the response of a Put traits operations. Call its Extract method to interpret it as a ResourceProviderTraits.\n\n```go\nfunc UpdateTraits(ctx context.Context, client *gophercloud.ServiceClient, resourceProviderID string, opts UpdateTraitsOptsBuilder) (r UpdateTraitsResult)\n```\n\n","path":"github.com/cobaltcore-dev/openstack-hypervisor-operator/internal/openstack","name":"openstack","synopsis":"","isRedistributable":true}
