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

Function recv_vm_state

vmm/src/migration.rs:65–79  ·  view source on GitHub ↗
(source_url: &str)

Source from the content-addressed store, hash-verified

63}
64
65pub fn recv_vm_state(source_url: &str) -> std::result::Result<Snapshot, MigratableError> {
66 let mut vm_state_path = url_to_path(source_url)?;
67
68 vm_state_path.push(SNAPSHOT_STATE_FILE);
69
70 // Try opening the snapshot file
71 let mut vm_state_file =
72 File::open(vm_state_path).map_err(|e| MigratableError::MigrateReceive(e.into()))?;
73 let mut bytes = Vec::new();
74 vm_state_file
75 .read_to_end(&mut bytes)
76 .map_err(|e| MigratableError::MigrateReceive(e.into()))?;
77
78 serde_json::from_slice(&bytes).map_err(|e| MigratableError::MigrateReceive(e.into()))
79}
80
81pub fn get_vm_snapshot(snapshot: &Snapshot) -> std::result::Result<VmSnapshot, MigratableError> {
82 if let Some(snapshot_data) = snapshot.snapshot_data.as_ref() {

Callers 1

vm_restoreMethod · 0.85

Calls 3

url_to_pathFunction · 0.85
newFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected