You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Request]: Cloud Hypervisor backend: virtio-balloon config and vm.resize #978
The Cloud Hypervisor backend has no way to attach or drive a virtio-balloon. Cloud Hypervisor supports one (balloon in vm.create's VmConfig, and desired_balloon in vm.resize), but CloudHypervisor.VmConfig / DeviceConfigs have no balloon type and the client has no vm.resize endpoint, so even a CHInstanceExtension.configureCH cannot add one. The instance's REST client is internal, so a caller also can't resize it after boot.
#882 proposed balloon support across both backends together with a reclaim policy; it and its PRs (#893, #894) were closed without discussion. This request is only the mechanism on the Cloud Hypervisor side, which is additive and policy-free:
CloudHypervisor.BalloonConfig (size, deflate_on_oom, free_page_reporting) and VmConfig.balloon: BalloonConfig?
CloudHypervisor.VmResize and Client.vmResize(_:) → PUT /api/v1/vm.resize
CHVirtualMachineInstance.setBalloonSize(_:) and memoryActualSize() (from vm.info's memory_actual_size)
Usage:
structBalloon:CHInstanceExtension{funcconfigureCH(_config:inoutCloudHypervisor.VmConfig)throws{config.balloon=.init(size:0,deflateOnOom:false)}}
// ... after start:
tryawaitinstance.setBalloonSize(512*1024*1024)letactual=tryawaitinstance.memoryActualSize()
Checked on Cloud Hypervisor v52.0, x86_64 KVM, 1 GiB guest: a 512 MiB balloon takes memory_actual_size from 1152 to 640 MiB and the guest's MemTotal from 1122276 to 597988 KiB (exactly 512 MiB); setting it back to 0 restores both.
Implementation with unit tests (made against 0.47.0; cherry-picks cleanly onto main): kunalkushwaha@bc78926 — happy to open a PR against main if this is wanted.
Note the semantics differ from VZ's VZVirtioTraditionalMemoryBalloonDevice.targetVirtualMachineMemorySize (memory the guest keeps) — Cloud Hypervisor's balloon size is memory taken from the guest. A cross-backend API would need to convert; this request doesn't propose one.
Activity