Add support for sharing host directories into the VM via QEMU 9p (virtio-9p). The --mount flag can be repeated. The format is `<host-path>` or `<host-path>:<guest-path>` Relative guest paths are relative to the configured WORKDIR. Design: - QEMU: each --mount gets a short 9p tag (slim0, slim1, …) via -virtfs local,path=…,mount_tag=slimN,security_model=mapped-xattr. Tags are kept short because 9p mount_tag has a ~31-byte limit. - Kernel cmdline: the full destination path is passed as slim.mount=<tag>:<base64(path)> so the init script knows where to mount each tag. Base64 avoids issues with spaces/special chars. - slim-init.sh: after networking, parse slim.mount= entries, mkdir -p the destination, and mount -t 9p <tag> <dest> -o trans=virtio,version=9p2000.L Tests verify: 9p share detection via sysfs mount_tag, 9p entry in mount output, file content accessible at the expected path, and clean VM exit.
This commit is contained in:
+6
-1
@@ -78,7 +78,12 @@ fn build_inner(
|
||||
let command = cmd.unwrap_or_else(|| inject::infer_command(&config));
|
||||
let exec_script =
|
||||
inject::build_exec_script(&command, &config.env, config.working_dir.as_deref());
|
||||
inject::inject(mount_path, &exec_script, config.user.as_deref())?;
|
||||
inject::inject(
|
||||
mount_path,
|
||||
&exec_script,
|
||||
config.user.as_deref(),
|
||||
config.working_dir.as_deref(),
|
||||
)?;
|
||||
println!("Injected /slim/ (init + exec)");
|
||||
|
||||
match kind {
|
||||
|
||||
Reference in New Issue
Block a user