vmm: memory: Extend new() to support external backing files

Whenever a MemoryManager is restored from a snapshot, the memory regions
associated with it might need to directly back the mapped memory for
increased performances. If that's the case, a list of external regions
is provided and the MemoryManager should simply ignore what's coming
from the MemoryConfig.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
This commit is contained in:
Sebastien Boeuf
2020-04-07 11:19:28 +02:00
parent ee5a041a0f
commit d771223b2f
2 changed files with 35 additions and 11 deletions

View File

@@ -360,8 +360,9 @@ impl Vm {
vmm_path: PathBuf,
) -> Result<Self> {
let (kvm, fd) = Vm::kvm_new()?;
let memory_manager = MemoryManager::new(fd.clone(), &config.lock().unwrap().memory.clone())
.map_err(Error::MemoryManager)?;
let memory_manager =
MemoryManager::new(fd.clone(), &config.lock().unwrap().memory.clone(), None)
.map_err(Error::MemoryManager)?;
Vm::new_from_memory_manager(
config,