mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2026-08-05 02:19:16 +00:00
vm-migration, vmm: Send configuration in separate step
Prior to sending the memory the full state is not needed only the configuration. This is sufficient to create the appropriate structures in the guest and have the memory allocations ready for filling. Update the protocol documentation to add a separate config step and move the state to after the memory is transferred. As the VM is created in a separate step to restoring it the requires a slightly different constructor as well as saving the VM object for the subsequent commands. Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
@@ -732,6 +732,40 @@ impl Vm {
|
||||
)
|
||||
}
|
||||
|
||||
pub fn new_from_migration(
|
||||
config: Arc<Mutex<VmConfig>>,
|
||||
exit_evt: EventFd,
|
||||
reset_evt: EventFd,
|
||||
seccomp_action: &SeccompAction,
|
||||
hypervisor: Arc<dyn hypervisor::Hypervisor>,
|
||||
) -> Result<Self> {
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
hypervisor.check_required_extensions().unwrap();
|
||||
let vm = hypervisor.create_vm().unwrap();
|
||||
#[cfg(target_arch = "x86_64")]
|
||||
vm.enable_split_irq().unwrap();
|
||||
let phys_bits = physical_bits(config.lock().unwrap().cpus.max_phys_bits);
|
||||
|
||||
let memory_manager = MemoryManager::new(
|
||||
vm.clone(),
|
||||
&config.lock().unwrap().memory.clone(),
|
||||
false,
|
||||
phys_bits,
|
||||
)
|
||||
.map_err(Error::MemoryManager)?;
|
||||
|
||||
Vm::new_from_memory_manager(
|
||||
config,
|
||||
memory_manager,
|
||||
vm,
|
||||
exit_evt,
|
||||
reset_evt,
|
||||
seccomp_action,
|
||||
hypervisor,
|
||||
None,
|
||||
)
|
||||
}
|
||||
|
||||
fn load_initramfs(&mut self, guest_mem: &GuestMemoryMmap) -> Result<arch::InitramfsConfig> {
|
||||
let mut initramfs = self.initramfs.as_ref().unwrap();
|
||||
let size: usize = initramfs
|
||||
|
||||
Reference in New Issue
Block a user