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

Function url_to_path

vmm/src/migration.rs:20–35  ·  view source on GitHub ↗
(url: &str)

Source from the content-addressed store, hash-verified

18pub const SNAPSHOT_CONFIG_FILE: &str = "config.json";
19
20pub fn url_to_path(url: &str) -> std::result::Result<PathBuf, MigratableError> {
21 let path: PathBuf = url
22 .strip_prefix("file://")
23 .ok_or_else(|| {
24 MigratableError::MigrateSend(anyhow!("Could not extract path from URL: {url}"))
25 })
26 .map(|s| s.into())?;
27
28 if !path.is_dir() {
29 return Err(MigratableError::MigrateSend(anyhow!(
30 "Destination is not a directory: {path:?}"
31 )));
32 }
33
34 Ok(path)
35}
36
37#[cfg(all(target_arch = "x86_64", feature = "guest_debug"))]
38pub fn url_to_file(url: &str) -> std::result::Result<PathBuf, GuestDebuggableError> {

Callers 5

recv_vm_configFunction · 0.85
recv_vm_stateFunction · 0.85
new_from_snapshotMethod · 0.85
sendMethod · 0.85
sendMethod · 0.85

Calls 1

mapMethod · 0.45

Tested by

no test coverage detected