Skip to content

Commit c363806

Browse files
Refactor
1 parent 37950dd commit c363806

7 files changed

Lines changed: 208 additions & 228 deletions

File tree

api/v1/hypervisor_types.go

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -196,15 +196,6 @@ 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-
208199
// Capabilities of the hypervisor as reported by libvirt.
209200
type Capabilities struct {
210201
// +kubebuilder:default:=unknown
@@ -214,9 +205,6 @@ type Capabilities struct {
214205
HostMemory resource.Quantity `json:"memory,omitempty"`
215206
// Total host cpus available as a sum of cpus over all numa cells.
216207
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"`
220208
}
221209

222210
// Domain capabilities of the hypervisor as reported by libvirt.
@@ -276,20 +264,18 @@ type DomainCapabilities struct {
276264
SupportedFeatures []string `json:"supportedFeatures,omitempty"`
277265
}
278266

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"`
267+
// Cell represents a NUMA cell on the hypervisor.
268+
type Cell struct {
269+
// Cell ID.
270+
CellID uint64 `json:"cellID"`
271+
272+
// Auto-discovered resource allocation of all hosted VMs in this cell.
273+
// +kubebuilder:validation:Optional
274+
Allocation map[string]resource.Quantity `json:"allocation"`
275+
276+
// Auto-discovered capacity of this cell.
277+
// +kubebuilder:validation:Optional
278+
Capacity map[string]resource.Quantity `json:"capacity"`
293279
}
294280

295281
// HypervisorStatus defines the observed state of Hypervisor
@@ -316,9 +302,17 @@ type HypervisorStatus struct {
316302
// +kubebuilder:validation:Optional
317303
DomainCapabilities DomainCapabilities `json:"domainCapabilities"`
318304

319-
// Auto-discovered domain infos as reported by libvirt (dumpxml).
320-
// +kubebuilder:default:={}
321-
DomainInfos []DomainInfo `json:"domainInfos,omitempty"`
305+
// Auto-discovered resource allocation of all hosted VMs.
306+
// +kubebuilder:validation:Optional
307+
Allocation map[string]resource.Quantity `json:"allocation"`
308+
309+
// Auto-discovered capacity of the hypervisor.
310+
// +kubebuilder:validation:Optional
311+
Capacity map[string]resource.Quantity `json:"capacity"`
312+
313+
// Auto-discovered cells on this hypervisor.
314+
// +kubebuilder:validation:Optional
315+
Cells []Cell `json:"cells,omitempty"`
322316

323317
// +kubebuilder:default:=0
324318
// Represent the num of instances

api/v1/zz_generated.deepcopy.go

Lines changed: 24 additions & 42 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: 3 additions & 17 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: 21 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

applyconfigurations/api/v1/hypervisorstatus.go

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

0 commit comments

Comments
 (0)