[PATCH 1/2] img/app: change virtio-fs tag to "host"

Alyssa Ross
2025-12-12T21:54:45Z

It doesn't seem likely to me that we'll have multiple virtio-fs
devices from the host, so let's use something a bit more clear and
precise.

Signed-off-by: Alyssa Ross <hi@alyssa.is>
---
Documentation/using-spectrum/creating-custom-vms.adoc | 2 +-
img/app/Makefile | 4 ++--
img/app/image/etc/mdev/virtiofs | 2 +-
img/app/scripts/start-virtiofsd.elb | 2 +-
release/checks/wayland/default.nix | 4 ++--
tools/start-vmm/lib.rs | 2 +-
tools/start-vmm/tests/vm_command-basic.rs | 2 +-
7 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/Documentation/using-spectrum/creating-custom-vms.adoc b/Documentation/using-spectrum/creating-custom-vms.adoc
index a397ac50..8d915e1a 100644
--- a/Documentation/using-spectrum/creating-custom-vms.adoc
+++ b/Documentation/using-spectrum/creating-custom-vms.adoc
@@ -91,7 +91,7 @@ should configure `eth0` with the IPv4 address `100.64.165.70` (because
=== Filesystem

Every VM has a virtio-fs device that exposes the /run/vm/by-id/_VM
-ID_/fs directory on the host, with the tag "virtiofs0". The VM cannot
+ID_/fs directory on the host, with the tag "host". The VM cannot
write directly into that directory, but it's possible to create a
subdirectory on the host and bind mount a directory from a writeable
filesystem into it to provide the VM with access to shared storage.
diff --git a/img/app/Makefile b/img/app/Makefile
index 7354f892..69c85bba 100644
--- a/img/app/Makefile
+++ b/img/app/Makefile
@@ -99,7 +99,7 @@ run-qemu: $(imgdir)/appvm/blk/root.img start-vhost-user-net start-virtiofsd
-netdev vhost-user,id=net0,chardev=vhost-user-net \
-device virtio-net,netdev=net0,mac=02:00:00:00:00:01 \
-chardev socket,id=virtiofsd,path=build/virtiofsd.sock \
- -device vhost-user-fs-pci,chardev=virtiofsd,tag=virtiofs0 \
+ -device vhost-user-fs-pci,chardev=virtiofsd,tag=host \
-device virtio-gpu-rutabaga-pci,cross-domain=on,hostmem=8G \
-audio driver=pipewire,model=virtio \
-object memory-backend-memfd,id=mem,size=256M,share=on \
@@ -117,7 +117,7 @@ run-cloud-hypervisor: $(imgdir)/appvm/blk/root.img start-vhost-user-gpu start-vh
--api-socket path=build/vmm.sock \
--memory size=1G,shared=on \
--disk path=$(imgdir)/appvm/blk/root.img,readonly=on \
- --fs tag=virtiofs0,socket=build/virtiofsd.sock \
+ --fs tag=host,socket=build/virtiofsd.sock \
--gpu socket=build/vhost-user-gpu.sock \
--vsock cid=3,socket=build/vsock.sock \
--net mac=02:00:00:00:00:01,vhost_user=on,socket=build/vhost-user-net.sock \
diff --git a/img/app/image/etc/mdev/virtiofs b/img/app/image/etc/mdev/virtiofs
index b6e505bc..bda77483 100755
--- a/img/app/image/etc/mdev/virtiofs
+++ b/img/app/image/etc/mdev/virtiofs
@@ -7,6 +7,6 @@ background {
# virtiofs filesystems, so we only supported a single, hardcoded
# filesystem tag for now.
if { mkdir -p /run/virtiofs/virtiofs0 }
- if { mount -t virtiofs -o nodev virtiofs0 /run/virtiofs/virtiofs0 }
+ if { mount -t virtiofs -o nodev host /run/virtiofs/virtiofs0 }
/etc/mdev/listen virtiofs0
}
diff --git a/img/app/scripts/start-virtiofsd.elb b/img/app/scripts/start-virtiofsd.elb
index fa3a234e..9efb436b 100755
--- a/img/app/scripts/start-virtiofsd.elb
+++ b/img/app/scripts/start-virtiofsd.elb
@@ -11,5 +11,5 @@ background {
if { importas -Si CONFIG mount --rbind -- ${CONFIG}/fs build/fs/config }
unshare --map-user 1000 --map-group 1000
importas -SsD virtiofsd VIRTIOFSD
- $VIRTIOFSD --fd 0 --shared-dir build/fs --tag virtiofs0
+ $VIRTIOFSD --fd 0 --shared-dir build/fs --tag host
}
diff --git a/release/checks/wayland/default.nix b/release/checks/wayland/default.nix
index a053e605..55c7d6d1 100644
--- a/release/checks/wayland/default.nix
+++ b/release/checks/wayland/default.nix
@@ -32,7 +32,7 @@ testers.nixosTest ({ lib, pkgs, ... }: {
systemd.services.cloud-hypervisor = {
after = [ "crosvm-gpu.service" "weston.service" ];
requires = [ "crosvm-gpu.service" "weston.service" ];
- serviceConfig.ExecStart = "${lib.getExe pkgs.cloud-hypervisor} --memory shared=on --disk path=${appvm}/lib/spectrum/img/appvm/blk/root.img,readonly=on --cmdline \"console=ttyS0 root=PARTLABEL=root\" --fs socket=/run/virtiofsd.sock,tag=virtiofs0 --gpu socket=/run/crosvm-gpu.sock --vsock cid=3,socket=/run/vsock.sock --serial tty --console null --kernel ${appvm}/lib/spectrum/img/appvm/vmlinux";
+ serviceConfig.ExecStart = "${lib.getExe pkgs.cloud-hypervisor} --memory shared=on --disk path=${appvm}/lib/spectrum/img/appvm/blk/root.img,readonly=on --cmdline \"console=ttyS0 root=PARTLABEL=root\" --fs socket=/run/virtiofsd.sock,tag=host --gpu socket=/run/crosvm-gpu.sock --vsock cid=3,socket=/run/vsock.sock --serial tty --console null --kernel ${appvm}/lib/spectrum/img/appvm/vmlinux";
};

systemd.services.crosvm = {
@@ -79,7 +79,7 @@ testers.nixosTest ({ lib, pkgs, ... }: {
};

systemd.services.virtiofsd = {
- serviceConfig.ExecStart = "${lib.getExe pkgs.virtiofsd} --fd 3 --shared-dir /shared --tag virtiofs0";
+ serviceConfig.ExecStart = "${lib.getExe pkgs.virtiofsd} --fd 3 --shared-dir /shared --tag host";
serviceConfig.Restart = "on-success";
requires = [ "shared-config.mount" ];
after = [ "shared-config.mount" ];
diff --git a/tools/start-vmm/lib.rs b/tools/start-vmm/lib.rs
index b44e0375..4b2aedda 100644
--- a/tools/start-vmm/lib.rs
+++ b/tools/start-vmm/lib.rs
@@ -81,7 +81,7 @@ pub fn vm_config(vm_dir: &Path) -> Result<VmConfig, String> {
Err(e) => return Err(format!("reading directory {blk_dir:?}: {e}")),
},
fs: [FsConfig {
- tag: "virtiofs0",
+ tag: "host",
socket: format!(
"/run/service/vm-services/instance/{vm_name}/data/service/vhost-user-fs/env/virtiofsd.sock"
),
diff --git a/tools/start-vmm/tests/vm_command-basic.rs b/tools/start-vmm/tests/vm_command-basic.rs
index 866a6e19..533e2d2d 100644
--- a/tools/start-vmm/tests/vm_command-basic.rs
+++ b/tools/start-vmm/tests/vm_command-basic.rs
@@ -28,7 +28,7 @@ fn main() -> std::io::Result<()> {
assert!(disk1.readonly);
assert_eq!(config.fs.len(), 1);
let fs1 = &config.fs[0];
- assert_eq!(fs1.tag, "virtiofs0");
+ assert_eq!(fs1.tag, "host");
let expected =
"/run/service/vm-services/instance/testvm/data/service/vhost-user-fs/env/virtiofsd.sock";
assert_eq!(fs1.socket, expected);

base-commit: 814a589b2b0fb4eeed06e1a1a9ce536f6b5ee91d
--
2.51.0