Skip to content

Commit 37950dd

Browse files
Add domain information list with numa cell allocation
1 parent 52d9308 commit 37950dd

8 files changed

Lines changed: 476 additions & 110 deletions

File tree

api/v1/hypervisor_types.go

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,15 @@ type OperatingSystemStatus struct {
196196
GardenLinuxFeatures []string `json:"gardenLinuxFeatures,omitempty"`
197197
}
198198

199+
// Cell represents a single cell of the host's topology.
200+
type Cell struct {
201+
// ID is the identifier of the cell.
202+
ID int `json:"id"`
203+
// The cell's capacity, such as the number of cpus, memory, and hugepages.
204+
// +kubebuilder:default:={}
205+
Capacity map[string]resource.Quantity `json:"capacity,omitempty"`
206+
}
207+
199208
// Capabilities of the hypervisor as reported by libvirt.
200209
type Capabilities struct {
201210
// +kubebuilder:default:=unknown
@@ -205,6 +214,9 @@ type Capabilities struct {
205214
HostMemory resource.Quantity `json:"memory,omitempty"`
206215
// Total host cpus available as a sum of cpus over all numa cells.
207216
HostCpus resource.Quantity `json:"cpus,omitempty"`
217+
// The host's cell topology (a.k.a. numa cells).
218+
// +kubebuilder:validation:Optional
219+
HostTopology []Cell `json:"hostTopology,omitempty"`
208220
}
209221

210222
// Domain capabilities of the hypervisor as reported by libvirt.
@@ -213,20 +225,73 @@ type DomainCapabilities struct {
213225
// The available domain cpu architecture.
214226
// +kubebuilder:default:=unknown
215227
Arch string `json:"arch,omitempty"`
228+
216229
// The supported type of virtualization for domains, such as "ch".
217230
// +kubebuilder:default:=unknown
218231
HypervisorType string `json:"hypervisorType,omitempty"`
219-
// Supported devices for domains, such as "video".
232+
233+
// Supported devices for domains.
234+
//
235+
// The format of this list is the device type, and if specified, a specific
236+
// model. For example, the take the following xml domain device definition:
237+
//
238+
// <video supported='yes'>
239+
// <enum name='modelType'>
240+
// <value>nvidia</value>
241+
// </enum>
242+
// </video>
243+
//
244+
// The corresponding entries in this list would be "video" and "video/nvidia".
245+
//
220246
// +kubebuilder:default:={}
221247
SupportedDevices []string `json:"supportedDevices,omitempty"`
222-
// Supported cpu modes for domains, such as "host-passthrough".
248+
249+
// Supported cpu modes for domains.
250+
//
251+
// The format of this list is cpu mode, and if specified, a specific
252+
// submode. For example, the take the following xml domain cpu definition:
253+
//
254+
// <mode name='host-passthrough' supported='yes'>
255+
// <enum name='hostPassthroughMigratable'/>
256+
// </mode>
257+
//
258+
// The corresponding entries in this list would be "host-passthrough" and
259+
// "host-passthrough/migratable".
260+
//
223261
// +kubebuilder:default:={}
224262
SupportedCpuModes []string `json:"supportedCpuModes,omitempty"`
263+
225264
// Supported features for domains, such as "sev" or "sgx".
265+
//
266+
// This is a flat list of supported features, meaning the following xml:
267+
//
268+
// <features>
269+
// <sev supported='no'/>
270+
// <sgx supported='no'/>
271+
// </features>
272+
//
273+
// Would correspond to the entries "sev" and "sgx" in this list.
274+
//
226275
// +kubebuilder:default:={}
227276
SupportedFeatures []string `json:"supportedFeatures,omitempty"`
228277
}
229278

279+
// Domain information as reported by libvirt.
280+
type DomainInfo struct {
281+
// Name is the name of the domain.
282+
Name string `json:"name"`
283+
// UUID is the uuid of the domain.
284+
UUID string `json:"uuid"`
285+
// Resource allocation of the domain.
286+
// This can include memory, cpu, and other.
287+
Allocation map[string]resource.Quantity `json:"allocation,omitempty"`
288+
// The memory numa cells of the domain, derived from the numa tune.
289+
MemoryCells []int `json:"memoryCells,omitempty"`
290+
// The cpu numa cells of the domain, derived from the numa information
291+
// of the cpu mode.
292+
CpuCells []int `json:"cpuCells,omitempty"`
293+
}
294+
230295
// HypervisorStatus defines the observed state of Hypervisor
231296
type HypervisorStatus struct {
232297
// +kubebuilder:default:=unknown
@@ -251,16 +316,9 @@ type HypervisorStatus struct {
251316
// +kubebuilder:validation:Optional
252317
DomainCapabilities DomainCapabilities `json:"domainCapabilities"`
253318

254-
// Auto-discovered capacity available in total on the hypervisor.
255-
// The remaining physical capacity can be calculated
256-
// as Capacity - Allocation.
319+
// Auto-discovered domain infos as reported by libvirt (dumpxml).
257320
// +kubebuilder:default:={}
258-
Capacity map[string]resource.Quantity `json:"capacity,omitempty"`
259-
260-
// Auto-discovered capacity currently allocated by instances
261-
// on the hypervisor. Note that this does not include reserved capacity.
262-
// +kubebuilder:default:={}
263-
Allocation map[string]resource.Quantity `json:"allocation,omitempty"`
321+
DomainInfos []DomainInfo `json:"domainInfos,omitempty"`
264322

265323
// +kubebuilder:default:=0
266324
// Represent the num of instances

api/v1/zz_generated.deepcopy.go

Lines changed: 66 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/capabilities.go

Lines changed: 17 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/cell.go

Lines changed: 42 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/domaininfo.go

Lines changed: 73 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)