Documentation ¶
Index ¶
- Constants
- func DeepEqual(v1, v2 interface{}) bool
- func MemslotIdxFromName(name string) (int, error)
- func QmpAddMemoryBackend(mon QMPRunner, idx int, sizeBytes int64) error
- func QmpAddMemoryDevice(mon *qmp.SocketMonitor, idx int) error
- func QmpAddr(vm *vmv1.VirtualMachine) (ip string, port int32)
- func QmpCancelMigration(ip string, port int32) error
- func QmpConnect(ip string, port int32) (*qmp.SocketMonitor, error)
- func QmpDelMemoryBackend(mon *qmp.SocketMonitor, idx int) error
- func QmpDelMemoryDevice(mon *qmp.SocketMonitor, idx int) error
- func QmpGetCpus(ip string, port int32) ([]QmpCpuSlot, []QmpCpuSlot, error)
- func QmpGetMemorySize(ip string, port int32) (*resource.Quantity, error)
- func QmpPlugCpu(ip string, port int32) error
- func QmpQueryMemoryBackendIds(mon *qmp.SocketMonitor) (map[int]struct{}, error)
- func QmpQuit(ip string, port int32) error
- func QmpSetMemorySlots(ctx context.Context, vm *vmv1.VirtualMachine, targetCnt int, ...) (int, error)
- func QmpStartMigration(virtualmachine *vmv1.VirtualMachine, ...) error
- func QmpSyncCpuToTarget(vm *vmv1.VirtualMachine, migration *vmv1.VirtualMachineMigration) error
- func QmpSyncMemoryToTarget(vm *vmv1.VirtualMachine, migration *vmv1.VirtualMachineMigration) error
- func QmpUnplugCpu(ip string, port int32) error
- type FailingRefresher
- type MigrationInfo
- type QMPRunner
- type QmpCpuSlot
- type QmpCpus
- type QmpMemoryDevice
- type QmpMemoryDevices
- type QmpMemorySetter
- type QmpMemorySize
- type QmpMigrationInfo
- type QmpObject
- type QmpObjects
- type ReconcileOutcome
- type ReconcileSnapshot
- type ReconcilerConfig
- type ReconcilerMetrics
- type ReconcilerWithMetrics
- type VMReconciler
- type VirtualMachineMigrationReconciler
Constants ¶
const OutcomeLabel = "outcome"
Variables ¶
This section is empty.
Functions ¶
func MemslotIdxFromName ¶ added in v0.22.0
MemslotIdxFromName takes "/objects/memslot3" or "memslot3 and returns 3
func QmpAddMemoryBackend ¶ added in v0.22.0
QmpAddMemoryBackend adds a single memory slot to the VM with the given size.
The memory slot does nothing until a corresponding "device" is added to the VM for the same memory slot. See QmpAddMemoryDevice for more. When unplugging, QmpDelMemoryDevice must be called before QmpDelMemoryBackend.
func QmpAddMemoryDevice ¶ added in v0.22.0
func QmpAddMemoryDevice(mon *qmp.SocketMonitor, idx int) error
func QmpCancelMigration ¶ added in v0.11.0
func QmpConnect ¶
func QmpConnect(ip string, port int32) (*qmp.SocketMonitor, error)
func QmpDelMemoryBackend ¶ added in v0.22.0
func QmpDelMemoryBackend(mon *qmp.SocketMonitor, idx int) error
func QmpDelMemoryDevice ¶ added in v0.22.0
func QmpDelMemoryDevice(mon *qmp.SocketMonitor, idx int) error
func QmpGetCpus ¶
func QmpGetCpus(ip string, port int32) ([]QmpCpuSlot, []QmpCpuSlot, error)
func QmpPlugCpu ¶
func QmpQueryMemoryBackendIds ¶ added in v0.22.0
func QmpQueryMemoryBackendIds(mon *qmp.SocketMonitor) (map[int]struct{}, error)
func QmpSetMemorySlots ¶ added in v0.22.0
func QmpSetMemorySlots( ctx context.Context, vm *vmv1.VirtualMachine, targetCnt int, recorder record.EventRecorder, ) (int, error)
QmpSetMemorySlots attempts to plug/unplug memory slots to match targetCnt.
Returns the number of slots, which the function managed to plug. Ideally, it matches targetCnt, but can be less or more if there are errors.
Returns -1 if failed to father current state of memory, otherwise, the return value is valid even if there are errors.
In order for the hotplug to occur, we have to do two things: 1. Plug memory backend (memslot<n>) - a QEMU object, which physically allocates the memory from host 2. Plug DIMM device (dimm<n>) - a device, which exposes the memory to the host. dimm<n> is always plugged into memslot<n> with the same n.
In order to do hotunplug, we need to make the same actions in the reversed order.
func QmpStartMigration ¶
func QmpStartMigration(virtualmachine *vmv1.VirtualMachine, virtualmachinemigration *vmv1.VirtualMachineMigration) error
func QmpSyncCpuToTarget ¶ added in v0.11.0
func QmpSyncCpuToTarget(vm *vmv1.VirtualMachine, migration *vmv1.VirtualMachineMigration) error
func QmpSyncMemoryToTarget ¶ added in v0.11.0
func QmpSyncMemoryToTarget(vm *vmv1.VirtualMachine, migration *vmv1.VirtualMachineMigration) error
func QmpUnplugCpu ¶
Types ¶
type FailingRefresher ¶ added in v0.30.0
type FailingRefresher struct {
// contains filtered or unexported fields
}
FailingRefresher is a wrapper, which implements manager.Runnable
type MigrationInfo ¶
type MigrationInfo struct { Status string `json:"status"` TotalTimeMs int64 `json:"total-time"` SetupTimeMs int64 `json:"setup-time"` DowntimeMs int64 `json:"downtime"` Ram struct { Transferred int64 `json:"transferred"` Remaining int64 `json:"remaining"` Total int64 `json:"total"` Duplicate int64 `json:"duplicate"` Normal int64 `json:"normal"` NormalBytes int64 `json:"normal-bytes"` DirtySyncCount int64 `json:"dirty-sync-count"` } `json:"ram"` Compression struct { CompressedSize int64 `json:"compressed-size"` CompressionRate float64 `json:"compression-rate"` } `json:"compression"` }
func QmpGetMigrationInfo ¶
func QmpGetMigrationInfo(ip string, port int32) (*MigrationInfo, error)
type QmpCpuSlot ¶
type QmpMemoryDevice ¶
type QmpMemoryDevice struct { Type string `json:"type"` Data struct { Memdev string `json:"memdev"` Hotplugged bool `json:"hotplugged"` Addr int64 `json:"addr"` Hotplugguble bool `json:"hotpluggable"` Size int64 `json:"size"` Slot int64 `json:"slot"` Node int64 `json:"node"` Id string `json:"id"` } `json:"data"` }
func QmpMonQueryMemoryDevices ¶ added in v0.22.0
func QmpMonQueryMemoryDevices(mon *qmp.SocketMonitor) ([]QmpMemoryDevice, error)
func QmpQueryMemoryDevices ¶
func QmpQueryMemoryDevices(ip string, port int32) ([]QmpMemoryDevice, error)
type QmpMemoryDevices ¶
type QmpMemoryDevices struct {
Return []QmpMemoryDevice `json:"return"`
}
type QmpMemorySetter ¶ added in v0.22.0
type QmpMemorySetter struct {
// contains filtered or unexported fields
}
func (*QmpMemorySetter) AddBackends ¶ added in v0.22.0
func (r *QmpMemorySetter) AddBackends()
func (*QmpMemorySetter) AddDevices ¶ added in v0.22.0
func (r *QmpMemorySetter) AddDevices()
func (*QmpMemorySetter) Disconnect ¶ added in v0.22.0
func (r *QmpMemorySetter) Disconnect()
func (*QmpMemorySetter) RemoveBackends ¶ added in v0.22.0
func (r *QmpMemorySetter) RemoveBackends()
func (*QmpMemorySetter) RemoveDevices ¶ added in v0.22.0
func (r *QmpMemorySetter) RemoveDevices()
type QmpMemorySize ¶
type QmpMigrationInfo ¶
type QmpMigrationInfo struct {
Return MigrationInfo `json:"return"`
}
type QmpObjects ¶ added in v0.22.0
type QmpObjects struct {
Return []QmpObject `json:"return"`
}
type ReconcileOutcome ¶ added in v0.29.0
type ReconcileOutcome string
const ( SuccessOutcome ReconcileOutcome = "success" FailureOutcome ReconcileOutcome = "failure" ConflictOutcome ReconcileOutcome = "conflict" )
type ReconcileSnapshot ¶ added in v0.25.0
type ReconcileSnapshot struct { // ControllerName is the name of the controller: virtualmachine or virtualmachinemigration. ControllerName string `json:"controllerName"` // Failing is the list of objects currently failing to reconcile Failing []string `json:"failing"` // Conflicting is the list of objects currently failing to reconcile // due to a conflict Conflicting []string `json:"conflicting"` }
ReconcileSnapshot provides a glimpse into the current state of ongoing reconciles
This type is (transitively) returned by the controller's "dump state" HTTP endpoint, and exists to allow us to get deeper information on the metrics - we can't expose information for every VirtualMachine into the metrics (it'd be too high cardinality), but we *can* make it available when requested.
type ReconcilerConfig ¶ added in v0.24.0
type ReconcilerConfig struct { // IsK3s is true iff the cluster is running k3s nodes. // // This is required because - unlike the other most common kubernetes distributions - k3s // changes the location of the containerd socket. // There unfortunately does not appear to be a way to disable this behavior. IsK3s bool // UseContainerMgr, if true, enables using container-mgr for new VM runner pods. // // This is defined as a config option so we can do a gradual rollout of this change. UseContainerMgr bool MaxConcurrentReconciles int // QEMUDiskCacheSettings sets the values of the 'cache.*' settings used for QEMU disks. // // This field is passed to neonvm-runner as the `-qemu-disk-cache-settings` arg, and is directly // used in setting up the VM disks via QEMU's `-drive` flag. QEMUDiskCacheSettings string // FailurePendingPeriod is the period for the propagation of // reconciliation failures to the observability instruments FailurePendingPeriod time.Duration // FailingRefreshInterval is the interval between consecutive // updates of metrics and logs, related to failing reconciliations FailingRefreshInterval time.Duration }
ReconcilerConfig stores shared configuration for VirtualMachineReconciler and VirtualMachineMigrationReconciler.
type ReconcilerMetrics ¶ added in v0.23.0
type ReconcilerMetrics struct {
// contains filtered or unexported fields
}
func MakeReconcilerMetrics ¶ added in v0.23.0
func MakeReconcilerMetrics() ReconcilerMetrics
func (ReconcilerMetrics) ObserveReconcileDuration ¶ added in v0.29.0
func (m ReconcilerMetrics) ObserveReconcileDuration( outcome ReconcileOutcome, duration time.Duration, )
type ReconcilerWithMetrics ¶ added in v0.25.0
type ReconcilerWithMetrics interface { reconcile.Reconciler Snapshot() ReconcileSnapshot FailingRefresher() FailingRefresher }
ReconcilerWithMetrics is a Reconciler produced by WithMetrics that can return a snapshot of the state backing the metrics.
func WithMetrics ¶ added in v0.23.0
func WithMetrics( reconciler reconcile.Reconciler, rm ReconcilerMetrics, cntrlName string, failurePendingPeriod time.Duration, refreshFailingInterval time.Duration, ) ReconcilerWithMetrics
WithMetrics wraps a given Reconciler with metrics capabilities.
The returned reconciler also provides a way to get a snapshot of the state of ongoing reconciles, to see the data backing the metrics.
type VMReconciler ¶ added in v0.30.0
type VMReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder Config *ReconcilerConfig Metrics ReconcilerMetrics `exhaustruct:"optional"` }
VMReconciler reconciles a VirtualMachine object
func (*VMReconciler) Reconcile ¶ added in v0.30.0
It is essential for the controller's reconciliation loop to be idempotent. By following the Operator pattern you will create Controllers which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster. Breaking this recommendation goes against the design principles of controller-runtime. and may lead to unforeseen consequences such as resources becoming stuck and requiring manual intervention. For further info: - About Operator Pattern: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ - About Controllers: https://kubernetes.io/docs/concepts/architecture/controller/ - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile
func (*VMReconciler) SetupWithManager ¶ added in v0.30.0
func (r *VMReconciler) SetupWithManager(mgr ctrl.Manager) (ReconcilerWithMetrics, error)
SetupWithManager sets up the controller with the Manager. Note that the Runner Pod will be also watched in order to ensure its desirable state on the cluster
type VirtualMachineMigrationReconciler ¶
type VirtualMachineMigrationReconciler struct { client.Client Scheme *runtime.Scheme Recorder record.EventRecorder Config *ReconcilerConfig Metrics ReconcilerMetrics }
VirtualMachineMigrationReconciler reconciles a VirtualMachineMigration object
func (*VirtualMachineMigrationReconciler) Reconcile ¶
func (r *VirtualMachineMigrationReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error)
It is essential for the controller's reconciliation loop to be idempotent. By following the Operator pattern you will create Controllers which provide a reconcile function responsible for synchronizing resources until the desired state is reached on the cluster. Breaking this recommendation goes against the design principles of controller-runtime. and may lead to unforeseen consequences such as resources becoming stuck and requiring manual intervention. For further info: - About Operator Pattern: https://kubernetes.io/docs/concepts/extend-kubernetes/operator/ - About Controllers: https://kubernetes.io/docs/concepts/architecture/controller/ - https://pkg.go.dev/sigs.k8s.io/controller-runtime@v0.13.0/pkg/reconcile
func (*VirtualMachineMigrationReconciler) SetupWithManager ¶
func (r *VirtualMachineMigrationReconciler) SetupWithManager(mgr ctrl.Manager) (ReconcilerWithMetrics, error)
SetupWithManager sets up the controller with the Manager. Note that the Pods will be also watched in order to ensure its desirable state on the cluster