mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-07-03 18:47:03 +00:00
virtcontainers: Add function supportGuestMemoryHotplug
This PR defines a new function supportGuestMemoryHotplug that clearly defines if the architecture supports memory hotplug. The function can be reimplemented in virtcontainers/qemu_$arch.go file for each architecture. Fixes: #910 Signed-off-by: Alice Frosi <afrosi@de.ibm.com>
This commit is contained in:
parent
d73f27c612
commit
0796f2e5a0
@ -1070,6 +1070,10 @@ func (q *qemu) hotplugRemoveCPUs(amount uint32) (uint32, error) {
|
||||
}
|
||||
|
||||
func (q *qemu) hotplugMemory(memDev *memoryDevice, op operation) (int, error) {
|
||||
|
||||
if !q.arch.supportGuestMemoryHotplug() {
|
||||
return 0, fmt.Errorf("guest memory hotplug not supported")
|
||||
}
|
||||
if memDev.sizeMB < 0 {
|
||||
return 0, fmt.Errorf("cannot hotplug negative size (%d) memory", memDev.sizeMB)
|
||||
}
|
||||
|
@ -93,6 +93,9 @@ type qemuArch interface {
|
||||
|
||||
// handleImagePath handles the Hypervisor Config image path
|
||||
handleImagePath(config HypervisorConfig)
|
||||
|
||||
// supportGuestMemoryHotplug returns if the guest supports memory hotplug
|
||||
supportGuestMemoryHotplug() bool
|
||||
}
|
||||
|
||||
type qemuArchBase struct {
|
||||
@ -559,3 +562,7 @@ func (q *qemuArchBase) handleImagePath(config HypervisorConfig) {
|
||||
q.kernelParamsDebug = append(q.kernelParamsDebug, kernelParamsSystemdDebug...)
|
||||
}
|
||||
}
|
||||
|
||||
func (q *qemuArchBase) supportGuestMemoryHotplug() bool {
|
||||
return true
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user