(source_url: &str)
| 47 | } |
| 48 | |
| 49 | pub fn recv_vm_config(source_url: &str) -> std::result::Result<VmConfig, MigratableError> { |
| 50 | let mut vm_config_path = url_to_path(source_url)?; |
| 51 | |
| 52 | vm_config_path.push(SNAPSHOT_CONFIG_FILE); |
| 53 | |
| 54 | // Try opening the snapshot file |
| 55 | let mut vm_config_file = |
| 56 | File::open(vm_config_path).map_err(|e| MigratableError::MigrateReceive(e.into()))?; |
| 57 | let mut bytes = Vec::new(); |
| 58 | vm_config_file |
| 59 | .read_to_end(&mut bytes) |
| 60 | .map_err(|e| MigratableError::MigrateReceive(e.into()))?; |
| 61 | |
| 62 | serde_json::from_slice(&bytes).map_err(|e| MigratableError::MigrateReceive(e.into())) |
| 63 | } |
| 64 | |
| 65 | pub fn recv_vm_state(source_url: &str) -> std::result::Result<Snapshot, MigratableError> { |
| 66 | let mut vm_state_path = url_to_path(source_url)?; |
no test coverage detected