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:
Rob Bradford
2020-11-12 16:55:55 +00:00
parent c62e409827
commit 11a69450ba
3 changed files with 147 additions and 58 deletions

View File

@@ -10,14 +10,17 @@ use crate::MigratableError;
// (The establishment is out of scope.)
// 2: Source -> Dest : send "start command"
// 3: Dest -> Source : sends "ok response" when read to accept state data
// 4: Source -> Dest : sends "state command" followed by state data, length
// in command is length of state data
// 4: Source -> Dest : sends "config command" followed by config data, length
// in command is length of config data
// 5: Dest -> Source : sends "ok response" when ready to accept memory data
// 6: Source -> Dest : send "memory command" followed by table of u64 pairs (GPA, size)
// followed by the memory described in those pairs.
// !! length is size of table i.e. 16 * number of ranges !!
// 7: Dest -> Source : sends "ok response" when ready to accept more memory data
// 8..(n-2): Repeat steps 6 and 7 until source has no more memory to send
// 8..(n-4): Repeat steps 6 and 7 until source has no more memory to send
// (n-3): Source -> Dest : sends "state command" followed by state data, length
// in command is length of config data
// (n-2): Dest -> Source : sends "ok response"
// (n-1): Source -> Dest : send "complete command"
// n: Dest -> Source: sends "ok response"
@@ -31,6 +34,7 @@ use std::io::{Read, Write};
pub enum Command {
Invalid,
Start,
Config,
State,
Memory,
Complete,
@@ -82,6 +86,10 @@ impl Request {
Self::new(Command::State, length)
}
pub fn config(length: u64) -> Self {
Self::new(Command::Config, length)
}
pub fn memory(length: u64) -> Self {
Self::new(Command::Memory, length)
}