summary refs log tree commit diff
path: root/host/start-vmm/lib.rs
diff options
context:
space:
mode:
Diffstat (limited to 'host/start-vmm/lib.rs')
-rw-r--r--host/start-vmm/lib.rs17
1 files changed, 16 insertions, 1 deletions
diff --git a/host/start-vmm/lib.rs b/host/start-vmm/lib.rs
index 9c2b4b6..a9fb421 100644
--- a/host/start-vmm/lib.rs
+++ b/host/start-vmm/lib.rs
@@ -116,7 +116,7 @@ pub fn vm_config(vm_name: &str, config_root: &Path) -> Result<VmConfig, String>
 
                     Ok(FsConfig {
                         tag: entry.to_string(),
-                        socket: format!("../fs-{vm_name}-{entry}/env/virtiofsd.sock"),
+                        socket: format!("../fs-{vm_name}:{entry}/env/virtiofsd.sock"),
                     })
                 })
                 .collect::<Result<_, String>>()?,
@@ -207,6 +207,10 @@ pub fn create_vm(dir: &Path, config_root: &Path) -> Result<(), String> {
         return Err("not running from a VM service directory".to_string());
     }
 
+    if vm_name.contains(':') {
+        return Err(format!("VM name may not contain a colon: {:?}", vm_name));
+    }
+
     let vm_name = &vm_name[3..];
     let config = vm_config(vm_name, config_root)?;
 
@@ -228,3 +232,14 @@ pub fn vm_command(api_socket_fd: RawFd) -> Result<Command, String> {
 
     Ok(command)
 }
+
+#[cfg(test)]
+mod tests {
+    use super::*;
+
+    #[test]
+    fn test_vm_name_colon() {
+        let e = create_vm(Path::new("/vm-:"), Path::new("/")).unwrap_err();
+        assert!(e.contains("colon"), "unexpected error: {:?}", e);
+    }
+}