MCPcopy Create free account
hub / github.com/cloud-hypervisor/cloud-hypervisor / send_state

Function send_state

vmm/src/migration_transport.rs:868–883  ·  view source on GitHub ↗

Serialize and send the VM snapshot payload.

(
    socket: &mut SocketStream,
    snapshot: &Snapshot,
)

Source from the content-addressed store, hash-verified

866
867/// Serialize and send the VM snapshot payload.
868pub(crate) fn send_state(
869 socket: &mut SocketStream,
870 snapshot: &Snapshot,
871) -> Result<(), MigratableError> {
872 let snapshot_data = serde_json::to_vec(snapshot)
873 .context("Error serializing VM snapshot")
874 .map_err(MigratableError::MigrateSend)?;
875 Request::state(snapshot_data.len() as u64).write_to(socket)?;
876 socket
877 .write_all(&snapshot_data)
878 .map_err(MigratableError::MigrateSocket)?;
879 expect_ok_response(
880 socket,
881 MigratableError::MigrateSend(anyhow!("Error during state migration")),
882 )
883}
884
885/// Transmits the given [`MemoryRangeTable`] and the corresponding guest memory
886/// content over the wire if there is at least one range.

Callers 1

send_migrationMethod · 0.85

Calls 4

expect_ok_responseFunction · 0.85
contextMethod · 0.80
write_toMethod · 0.45
lenMethod · 0.45

Tested by

no test coverage detected