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

Function recv_vm_config

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

Source from the content-addressed store, hash-verified

47}
48
49pub 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
65pub fn recv_vm_state(source_url: &str) -> std::result::Result<Snapshot, MigratableError> {
66 let mut vm_state_path = url_to_path(source_url)?;

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