mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vmm: Update memory zones
We consume `zone_updates` from `VmReceiveMigrationData` and `RestoreConfig` to remap already existing `MemoryZone`s to different host NUMA nodes. For now, we do not support further changes, such as altering the size of the respective `MemoryZone`s. These changes allow to migrate a VM to a host that has the capacity to host the same `MemoryZone`s on a different NUMA layout. Signed-off-by: Pascal Scholz <pascal.scholz@cyberus-technology.de> On-behalf-of: SAP pascal.scholz@sap.com
This commit is contained in:
committed by
Rob Bradford
parent
9198fcf833
commit
ad3790a0ea
@@ -1178,6 +1178,7 @@ impl Vmm {
|
||||
T: Read,
|
||||
{
|
||||
let mode = receive_data_migration.memory_mode;
|
||||
let zone_updates = &receive_data_migration.zone_updates;
|
||||
|
||||
// Read in config data along with memory manager data
|
||||
let mut data: Vec<u8> = Vec::new();
|
||||
@@ -1222,6 +1223,10 @@ impl Vmm {
|
||||
&vm_migration_config.common_cpuid,
|
||||
)?;
|
||||
|
||||
update_memory_zones(zone_updates, &vm_migration_config.vm_config).map_err(|e| {
|
||||
MigratableError::MigrateReceive(anyhow!("Error updating memory zones: {e:?}"))
|
||||
})?;
|
||||
|
||||
let config = vm_migration_config.vm_config.clone();
|
||||
self.vm_config = Some(vm_migration_config.vm_config);
|
||||
self.console_info = Some(
|
||||
@@ -2518,6 +2523,11 @@ impl RequestHandler for Vmm {
|
||||
.iommufd_fd = Some(iommufd_fd);
|
||||
}
|
||||
|
||||
update_memory_zones(&restore_cfg.zone_updates, &vm_config).map_err(|e| {
|
||||
error!("VM Restore failed: {e:?}");
|
||||
VmError::ApplyMemoryZoneUpdate(e)
|
||||
})?;
|
||||
|
||||
self.vm_restore(
|
||||
source_url,
|
||||
vm_config,
|
||||
|
||||
@@ -120,7 +120,7 @@ use crate::vm_config::{
|
||||
};
|
||||
use crate::{
|
||||
CPU_MANAGER_SNAPSHOT_ID, DEVICE_MANAGER_SNAPSHOT_ID, GuestMemoryMmap,
|
||||
MEMORY_MANAGER_SNAPSHOT_ID, PciDeviceInfo, acpi, cpu,
|
||||
MEMORY_MANAGER_SNAPSHOT_ID, MemoryZoneUpdateError, PciDeviceInfo, acpi, cpu,
|
||||
};
|
||||
|
||||
/// Errors associated with VM management
|
||||
@@ -399,6 +399,10 @@ pub enum Error {
|
||||
#[cfg(feature = "fw_cfg")]
|
||||
#[error("Error using fw_cfg while disabled")]
|
||||
FwCfgDisabled,
|
||||
|
||||
/// Cannot apply NUMA memory zone updates
|
||||
#[error("Error applying memory zone updates")]
|
||||
ApplyMemoryZoneUpdate(#[source] MemoryZoneUpdateError),
|
||||
}
|
||||
pub type Result<T> = result::Result<T, Error>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user