Serialize and send the VM snapshot payload.
(
socket: &mut SocketStream,
snapshot: &Snapshot,
)
| 866 | |
| 867 | /// Serialize and send the VM snapshot payload. |
| 868 | pub(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. |
no test coverage detected