Serialize and send the VM configuration payload.
(
socket: &mut SocketStream,
config: &VmMigrationConfig,
)
| 848 | |
| 849 | /// Serialize and send the VM configuration payload. |
| 850 | pub(crate) fn send_config( |
| 851 | socket: &mut SocketStream, |
| 852 | config: &VmMigrationConfig, |
| 853 | ) -> Result<(), MigratableError> { |
| 854 | let config_data = serde_json::to_vec(config) |
| 855 | .context("Error serializing VM migration config") |
| 856 | .map_err(MigratableError::MigrateSend)?; |
| 857 | Request::config(config_data.len() as u64).write_to(socket)?; |
| 858 | socket |
| 859 | .write_all(&config_data) |
| 860 | .map_err(MigratableError::MigrateSocket)?; |
| 861 | expect_ok_response( |
| 862 | socket, |
| 863 | MigratableError::MigrateSend(anyhow!("Error during config migration")), |
| 864 | ) |
| 865 | } |
| 866 | |
| 867 | /// Serialize and send the VM snapshot payload. |
| 868 | pub(crate) fn send_state( |
no test coverage detected