api

package
v0.0.0-...-ddb491b Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 6, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExternalSchedulerHost

type ExternalSchedulerHost struct {
	// Name of the Nova compute host, e.g. nova-compute-bb123.
	ComputeHost string `json:"host"`
	// Name of the hypervisor hostname, e.g. domain-c123.<uuid>
	HypervisorHostname string `json:"hypervisor_hostname"`
}

Host object from the Nova scheduler pipeline. See: https://github.com/sapcc/nova/blob/stable/xena-m3/nova/scheduler/host_manager.py class HostState

type ExternalSchedulerRequest

type ExternalSchedulerRequest struct {
	Spec NovaObject[NovaSpec] `json:"spec"`

	// Request context from Nova that contains additional meta information.
	Context NovaRequestContext `json:"context"`

	// Whether the Nova scheduling request is a rebuild request.
	Rebuild bool `json:"rebuild"`
	// Whether the Nova scheduling request is a resize request.
	Resize bool `json:"resize"`
	// Whether the Nova scheduling request is a live migration.
	Live bool `json:"live"`
	// Whether the affected VM is a VMware VM.
	VMware bool `json:"vmware"`

	Hosts   []ExternalSchedulerHost `json:"hosts"`
	Weights map[string]float64      `json:"weights"`

	// The name of the pipeline to execute.
	// By default the required pipeline with the name "default" will be used.
	Pipeline string `json:"pipeline"`
}

Request generated by the Nova scheduler when calling cortex. The request contains a spec of the VM to be scheduled, a list of hosts and their status, and a map of weights that were calculated by the Nova weigher pipeline. Some additional flags are also included.

func (ExternalSchedulerRequest) GetPipeline

func (r ExternalSchedulerRequest) GetPipeline() string

func (ExternalSchedulerRequest) GetSubjects

func (r ExternalSchedulerRequest) GetSubjects() []string

func (ExternalSchedulerRequest) GetTraceLogArgs

func (r ExternalSchedulerRequest) GetTraceLogArgs() []slog.Attr

func (ExternalSchedulerRequest) GetWeights

func (r ExternalSchedulerRequest) GetWeights() map[string]float64

func (ExternalSchedulerRequest) WithPipeline

func (r ExternalSchedulerRequest) WithPipeline(pipeline string) scheduler.PipelineRequest

type ExternalSchedulerResponse

type ExternalSchedulerResponse struct {
	Hosts []string `json:"hosts"`
}

Response generated by cortex for the Nova scheduler. Cortex returns an ordered list of hosts that the VM should be scheduled on.

type NovaFlavor

type NovaFlavor struct {
	ID          int               `json:"id"`
	Name        string            `json:"name"`
	MemoryMB    uint64            `json:"memory_mb"`
	VCPUs       uint64            `json:"vcpus"`
	RootGB      uint64            `json:"root_gb"`
	EphemeralGB uint64            `json:"ephemeral_gb"`
	FlavorID    string            `json:"flavorid"`
	Swap        int               `json:"swap"`
	RXTXFactor  float64           `json:"rxtx_factor"`
	VCPUWeight  int               `json:"vcpu_weight"`
	Disabled    bool              `json:"disabled"`
	IsPublic    bool              `json:"is_public"`
	ExtraSpecs  map[string]string `json:"extra_specs"`
	Description *string           `json:"description"`
	CreatedAt   string            `json:"created_at"`
	UpdatedAt   *string           `json:"updated_at"`
	DeletedAt   *string           `json:"deleted_at"`
	Deleted     bool              `json:"deleted"`
}

Nova flavor metadata for the specified VM.

type NovaImageMeta

type NovaImageMeta struct {
	ID              string                     `json:"id"`
	Name            string                     `json:"name"`
	Status          string                     `json:"status"`
	Checksum        string                     `json:"checksum"`
	Owner           string                     `json:"owner"`
	Size            int                        `json:"size"`
	ContainerFormat string                     `json:"container_format"`
	DiskFormat      string                     `json:"disk_format"`
	CreatedAt       string                     `json:"created_at"`
	UpdatedAt       string                     `json:"updated_at"`
	MinRAM          int                        `json:"min_ram"`
	MinDisk         int                        `json:"min_disk"`
	Properties      NovaObject[map[string]any] `json:"properties"`
}

Nova image metadata for the specified VM.

type NovaInstanceGroup

type NovaInstanceGroup struct {
	UserID    string         `json:"user_id"`
	ProjectID string         `json:"project_id"`
	UUID      string         `json:"uuid"`
	Name      string         `json:"name"`
	Policies  []string       `json:"policies"`
	Members   []string       `json:"members"`
	Hosts     []string       `json:"hosts"`
	Policy    string         `json:"policy"`
	Rules     map[string]any `json:"_rules"`
	CreatedAt string         `json:"created_at"`
	UpdatedAt *string        `json:"updated_at"`
	DeletedAt *string        `json:"deleted_at"`
	Deleted   bool           `json:"deleted"`
}

type NovaNumaTopology

type NovaNumaTopology struct {
	Cells []NovaObject[map[string]any] `json:"cells"`
}

Nova NUMA topology for the specified VM.

type NovaObject

type NovaObject[V any] struct {
	Name      string   `json:"nova_object.name"`
	Namespace string   `json:"nova_object.namespace"`
	Version   string   `json:"nova_object.version"`
	Data      V        `json:"nova_object.data"`
	Changes   []string `json:"nova_object.changes"`
}

Wrapped Nova object. Nova returns objects in this format.

type NovaObjectList

type NovaObjectList[V any] struct {
	Objects []NovaObject[V] `json:"objects"`
}

type NovaRequestContext

type NovaRequestContext struct {
	UserID          string   `json:"user"`
	ProjectID       string   `json:"project_id"`
	SystemScope     *string  `json:"system_scope"`
	Project         string   `json:"project"`
	DomainID        *string  `json:"domain"`
	UserDomainID    string   `json:"user_domain"`
	ProjectDomainID string   `json:"project_domain"`
	IsAdmin         bool     `json:"is_admin"`
	ReadOnly        bool     `json:"read_only"`
	ShowDeleted     bool     `json:"show_deleted"`
	RequestID       string   `json:"request_id"`
	GlobalRequestID *string  `json:"global_request_id"`
	ResourceUUID    *string  `json:"resource_uuid"`
	Roles           []string `json:"roles"`
	UserIdentity    string   `json:"user_identity"`
	IsAdminProject  bool     `json:"is_admin_project"`
	ReadDeleted     string   `json:"read_deleted"`

	RemoteAddress string  `json:"remote_address"`
	Timestamp     string  `json:"timestamp"`
	QuotaClass    *string `json:"quota_class"`
	UserName      string  `json:"user_name"`
	ProjectName   string  `json:"project_name"`
}

Nova request context object. For the spec of this object, see:

- This: https://github.com/sapcc/nova/blob/a56409/nova/context.py#L166 - And: https://github.com/openstack/oslo.context/blob/db20dd/oslo_context/context.py#L329

Some fields are omitted: "service_catalog", "read_deleted" (same as "show_deleted")

type NovaRequestLevelParams

type NovaRequestLevelParams struct {
	RootRequired  []any `json:"root_required"`
	RootForbidden []any `json:"root_forbidden"`
	SameSubtree   []any `json:"same_subtree"`
}

type NovaRequestedDestination

type NovaRequestedDestination struct {
	Host                string    `json:"host"`
	Node                string    `json:"node"`
	Aggregates          []string  `json:"aggregates"`
	ForbiddenAggregates *[]string `json:"forbidden_aggregates"`
}

type NovaSpec

type NovaSpec struct {
	ProjectID        string `json:"project_id"`
	UserID           string `json:"user_id"`
	InstanceUUID     string `json:"instance_uuid"`
	AvailabilityZone string `json:"availability_zone"`
	NumInstances     uint64 `json:"num_instances"`
	IsBfv            bool   `json:"is_bfv"`

	// Consider using GetSchedulerHintStr.
	SchedulerHints map[string]any `json:"scheduler_hints"`

	IgnoreHosts *[]string `json:"ignore_hosts"`
	ForceHosts  *[]string `json:"force_hosts"`
	ForceNodes  *[]string `json:"force_nodes"`

	Image              NovaObject[NovaImageMeta]          `json:"image"`
	Flavor             NovaObject[NovaFlavor]             `json:"flavor"`
	RequestLevelParams NovaObject[NovaRequestLevelParams] `json:"request_level_params"`
	NetworkMetadata    NovaObject[map[string]any]         `json:"network_metadata"`
	Limits             NovaObject[map[string]any]         `json:"limits"`
	RequestedNetworks  NovaObjectList[map[string]any]     `json:"requested_networks"`
	SecurityGroups     NovaObjectList[map[string]any]     `json:"security_groups"`

	NumaTopology         *NovaObject[NovaNumaTopology]         `json:"numa_topology"`
	RequestedDestination *NovaObject[NovaRequestedDestination] `json:"requested_destination"`
	InstanceGroup        *NovaObject[NovaInstanceGroup]        `json:"instance_group"`
}

Spec object from the Nova scheduler pipeline. Fields unused by Nova are omitted. See: https://github.com/sapcc/nova/blob/stable/xena-m3/nova/objects/request_spec.py

func (NovaSpec) GetSchedulerHintStr

func (s NovaSpec) GetSchedulerHintStr(key string) (string, error)

Hints can be a one-element list or a direct value. See: https://github.com/sapcc/nova/blob/3e715db/nova/objects/request_spec.py#L382

This function is a convenience to extract the first element from the hints list or return the value directly if it's not a list.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL