Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
109 changes: 105 additions & 4 deletions api/v1/hypervisor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ type HypervisorSpec struct {
// Aggregates are used to apply aggregates to the hypervisor.
Aggregates []string `json:"aggregates"`

// +kubebuilder:default:={}
// AllowedProjects defines which openstack projects are allowed to schedule
// instances on this hypervisor. The values of this list should be project
// uuids. If left empty, all projects are allowed.
AllowedProjects []string `json:"allowedProjects"`

// +kubebuilder:default:=true
// HighAvailability is used to enable the high availability handling of the hypervisor.
HighAvailability bool `json:"highAvailability"`
Expand Down Expand Up @@ -190,15 +196,100 @@ type OperatingSystemStatus struct {
GardenLinuxFeatures []string `json:"gardenLinuxFeatures,omitempty"`
}

// Current capabilities reported by libvirt.
type CapabilitiesStatus struct {
// Cell represents a single cell of the host's topology.
type Cell struct {
// ID is the identifier of the cell.
ID int `json:"id"`
// The cell's capacity, such as the number of cpus, memory, and hugepages.
// +kubebuilder:default:={}
Capacity map[string]resource.Quantity `json:"capacity,omitempty"`
}

// Capabilities of the hypervisor as reported by libvirt.
type Capabilities struct {
// +kubebuilder:default:=unknown
// The hosts CPU architecture (not the guests).
HostCpuArch string `json:"cpuArch,omitempty"`
// Total host memory available as a sum of memory over all numa cells.
HostMemory resource.Quantity `json:"memory,omitempty"`
// Total host cpus available as a sum of cpus over all numa cells.
HostCpus resource.Quantity `json:"cpus,omitempty"`
// The host's cell topology (a.k.a. numa cells).
// +kubebuilder:validation:Optional
HostTopology []Cell `json:"hostTopology,omitempty"`
}

// Domain capabilities of the hypervisor as reported by libvirt.
// These details are relevant to check if a VM can be scheduled on the hypervisor.
type DomainCapabilities struct {
// The available domain cpu architecture.
// +kubebuilder:default:=unknown
Arch string `json:"arch,omitempty"`

// The supported type of virtualization for domains, such as "ch".
// +kubebuilder:default:=unknown
HypervisorType string `json:"hypervisorType,omitempty"`

// Supported devices for domains.
//
// The format of this list is the device type, and if specified, a specific
// model. For example, the take the following xml domain device definition:
//
// <video supported='yes'>
// <enum name='modelType'>
// <value>nvidia</value>
// </enum>
// </video>
//
// The corresponding entries in this list would be "video" and "video/nvidia".
//
// +kubebuilder:default:={}
SupportedDevices []string `json:"supportedDevices,omitempty"`

// Supported cpu modes for domains.
//
// The format of this list is cpu mode, and if specified, a specific
// submode. For example, the take the following xml domain cpu definition:
//
// <mode name='host-passthrough' supported='yes'>
// <enum name='hostPassthroughMigratable'/>
// </mode>
//
// The corresponding entries in this list would be "host-passthrough" and
// "host-passthrough/migratable".
//
// +kubebuilder:default:={}
SupportedCpuModes []string `json:"supportedCpuModes,omitempty"`

// Supported features for domains, such as "sev" or "sgx".
//
// This is a flat list of supported features, meaning the following xml:
//
// <features>
// <sev supported='no'/>
// <sgx supported='no'/>
// </features>
//
// Would correspond to the entries "sev" and "sgx" in this list.
//
// +kubebuilder:default:={}
SupportedFeatures []string `json:"supportedFeatures,omitempty"`
}

// Domain information as reported by libvirt.
type DomainInfo struct {
// Name is the name of the domain.
Name string `json:"name"`
// UUID is the uuid of the domain.
UUID string `json:"uuid"`
// Resource allocation of the domain.
// This can include memory, cpu, and other.
Allocation map[string]resource.Quantity `json:"allocation,omitempty"`
// The memory numa cells of the domain, derived from the numa tune.
MemoryCells []int `json:"memoryCells,omitempty"`
// The cpu numa cells of the domain, derived from the numa information
// of the cpu mode.
CpuCells []int `json:"cpuCells,omitempty"`
}

// HypervisorStatus defines the observed state of Hypervisor
Expand All @@ -216,8 +307,18 @@ type HypervisorStatus struct {
// Represents the Hypervisor hosted Virtual Machines
Instances []Instance `json:"instances,omitempty"`

// The capabilities of the hypervisors as reported by libvirt.
Capabilities CapabilitiesStatus `json:"capabilities,omitempty"`
// Auto-discovered capabilities as reported by libvirt.
// +kubebuilder:validation:Optional
Capabilities Capabilities `json:"capabilities"`

// Auto-discovered domain capabilities relevant to check if a VM
// can be scheduled on the hypervisor.
// +kubebuilder:validation:Optional
DomainCapabilities DomainCapabilities `json:"domainCapabilities"`

// Auto-discovered domain infos as reported by libvirt (dumpxml).
// +kubebuilder:default:={}
DomainInfos []DomainInfo `json:"domainInfos,omitempty"`

// +kubebuilder:default:=0
// Represent the num of instances
Expand Down
113 changes: 109 additions & 4 deletions api/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

59 changes: 59 additions & 0 deletions applyconfigurations/api/v1/capabilities.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

45 changes: 0 additions & 45 deletions applyconfigurations/api/v1/capabilitiesstatus.go

This file was deleted.

Loading