mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-02-22 11:22:26 +00:00
vmm: memory_manager: Only send the GED notification for the ACPI method
Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
15d9ec0149
commit
41d7b3a387
@ -527,23 +527,24 @@ impl MemoryManager {
|
||||
}
|
||||
|
||||
pub fn resize(&mut self, desired_ram: u64) -> Result<bool, Error> {
|
||||
let mut notify_hotplug = false;
|
||||
let mut resized = false;
|
||||
match self.hotplug_method {
|
||||
HotplugMethod::VirtioMem => {
|
||||
if desired_ram >= self.boot_ram {
|
||||
self.virtiomem_resize(desired_ram - self.boot_ram)?;
|
||||
self.current_ram = desired_ram;
|
||||
resized = true;
|
||||
}
|
||||
}
|
||||
HotplugMethod::Acpi => {
|
||||
if desired_ram >= self.current_ram {
|
||||
self.hotplug_ram_region((desired_ram - self.current_ram) as usize)?;
|
||||
self.current_ram = desired_ram;
|
||||
notify_hotplug = true
|
||||
resized = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(notify_hotplug)
|
||||
Ok(resized)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ extern crate vm_allocator;
|
||||
extern crate vm_memory;
|
||||
extern crate vm_virtio;
|
||||
|
||||
use crate::config::{DeviceConfig, DiskConfig, PmemConfig, VmConfig};
|
||||
use crate::config::{DeviceConfig, DiskConfig, HotplugMethod, PmemConfig, VmConfig};
|
||||
use crate::cpu;
|
||||
use crate::device_manager::{get_win_size, Console, DeviceManager, DeviceManagerError};
|
||||
use crate::memory_manager::{get_host_cpu_phys_bits, Error as MemoryManagerError, MemoryManager};
|
||||
@ -563,11 +563,17 @@ impl Vm {
|
||||
.update_memory()
|
||||
.map_err(Error::DeviceManager)?;
|
||||
|
||||
self.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.notify_hotplug(HotPlugNotificationFlags::MEMORY_DEVICES_CHANGED)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
let memory_config = &self.config.lock().unwrap().memory;
|
||||
match memory_config.hotplug_method {
|
||||
HotplugMethod::Acpi => {
|
||||
self.device_manager
|
||||
.lock()
|
||||
.unwrap()
|
||||
.notify_hotplug(HotPlugNotificationFlags::MEMORY_DEVICES_CHANGED)
|
||||
.map_err(Error::DeviceManager)?;
|
||||
}
|
||||
HotplugMethod::VirtioMem => {}
|
||||
}
|
||||
}
|
||||
|
||||
// We update the VM config regardless of the actual guest resize operation
|
||||
|
Loading…
x
Reference in New Issue
Block a user