kvm-guest-drivers-windows icon indicating copy to clipboard operation
kvm-guest-drivers-windows copied to clipboard

virtiofs ignoring CLI arguments when created as a service

Open kantlivelong opened this issue 10 months ago • 6 comments

Describe the bug When creating an additional service VirtioFsSvc-TAG the CLI arguments appear to be ignored.

To Reproduce

  1. Create multiple virtiofs filesystems
  2. Disable the built in VirtioFsSvc service
  3. Create a tag specific service;
sc create VirtioFsSvc-data binPath="\"C:\Program Files\Virtio-Win\VioFS\virtiofs.exe\" -t data -m D:" start=auto depend=VirtioFsDrv
  1. Start

Expected behavior Tag data should be mounted to D: but instead the reg values are being used.

Screenshots If applicable, add screenshots to help explain your problem.

Host:

  • Disto: Ubuntu 24.04.4
  • Kernel version: 6.5.0-26-generic
  • QEMU version: QEMU emulator version 6.2.0 (Debian 1:6.2+dfsg-2ubuntu6.17)
  • QEMU command line
/usr/bin/qemu-system-x86_64 -name guest=REDACTED,debug-threads=on -S -object {"qom-type":"secret","id":"masterKey0","format":"raw","file":"/var/lib/libvirt/qemu/domain-33-REDACTED/master-key.aes"} -machine pc-q35-6.2,usb=off,vmport=off,dump-guest-core=off,memory-backend=pc.ram -accel kvm -cpu host,migratable=on,hv-time=on,hv-relaxed=on,hv-vapic=on,hv-spinlocks=0x1fff -m 16384 -object {"qom-type":"memory-backend-memfd","id":"pc.ram","share":true,"x-use-canonical-path-for-ramblock-id":false,"size":17179869184} -overcommit mem-lock=off -smp 8,sockets=8,cores=1,threads=1 -uuid 4d2acb50-959a-4782-867f-0154205fb982 -no-user-config -nodefaults -chardev socket,id=charmonitor,fd=95,server=on,wait=off -mon chardev=charmonitor,id=monitor,mode=control -rtc base=localtime,driftfix=slew -global kvm-pit.lost_tick_policy=delay -no-hpet -no-shutdown -global ICH9-LPC.disable_s3=1 -global ICH9-LPC.disable_s4=1 -boot menu=off,strict=on -device pcie-root-port,port=16,chassis=1,id=pci.1,bus=pcie.0,multifunction=on,addr=0x2 -device pcie-root-port,port=17,chassis=2,id=pci.2,bus=pcie.0,addr=0x2.0x1 -device pcie-root-port,port=18,chassis=3,id=pci.3,bus=pcie.0,addr=0x2.0x2 -device pcie-root-port,port=19,chassis=4,id=pci.4,bus=pcie.0,addr=0x2.0x3 -device pcie-root-port,port=20,chassis=5,id=pci.5,bus=pcie.0,addr=0x2.0x4 -device pcie-root-port,port=21,chassis=6,id=pci.6,bus=pcie.0,addr=0x2.0x5 -device pcie-root-port,port=22,chassis=7,id=pci.7,bus=pcie.0,addr=0x2.0x6 -device pcie-root-port,port=23,chassis=8,id=pci.8,bus=pcie.0,addr=0x2.0x7 -device pcie-root-port,port=24,chassis=9,id=pci.9,bus=pcie.0,multifunction=on,addr=0x3 -device pcie-root-port,port=25,chassis=10,id=pci.10,bus=pcie.0,addr=0x3.0x1 -device pcie-root-port,port=26,chassis=11,id=pci.11,bus=pcie.0,addr=0x3.0x2 -device pcie-root-port,port=27,chassis=12,id=pci.12,bus=pcie.0,addr=0x3.0x3 -device pcie-root-port,port=28,chassis=13,id=pci.13,bus=pcie.0,addr=0x3.0x4 -device pcie-root-port,port=29,chassis=14,id=pci.14,bus=pcie.0,addr=0x3.0x5 -device qemu-xhci,p2=15,p3=15,id=usb,bus=pci.2,addr=0x0 -device virtio-serial-pci,id=virtio-serial0,bus=pci.3,addr=0x0 -blockdev {"driver":"file","filename":"/var/lib/libvirt/images/REDACTED.qcow2","node-name":"libvirt-2-storage","auto-read-only":true,"discard":"unmap"} -blockdev {"node-name":"libvirt-2-format","read-only":false,"discard":"unmap","driver":"qcow2","file":"libvirt-2-storage","backing":null} -device ide-hd,bus=ide.0,drive=libvirt-2-format,id=sata0-0-0,bootindex=1 -device ide-cd,bus=ide.1,id=sata0-0-1 -chardev socket,id=chr-vu-fs0,path=/var/lib/libvirt/qemu/domain-33-REDACTED/fs0-fs.sock -device vhost-user-fs-pci,id=fs0,chardev=chr-vu-fs0,tag=data,bus=pci.7,addr=0x0 -netdev tap,fd=96,id=hostnet0 -device e1000e,netdev=hostnet0,id=net0,mac=52:54:00:0f:63:74,bus=pci.1,addr=0x0 -chardev pty,id=charserial0 -device isa-serial,chardev=charserial0,id=serial0 -chardev spicevmc,id=charchannel0,name=vdagent -device virtserialport,bus=virtio-serial0.0,nr=1,chardev=charchannel0,id=channel0,name=com.redhat.spice.0 -device usb-tablet,id=input0,bus=usb.0,port=1 -audiodev {"id":"audio1","driver":"spice"} -spice port=5913,addr=127.0.0.1,disable-ticketing=on,seamless-migration=on -device qxl-vga,id=video0,ram_size=67108864,vram_size=67108864,vram64_size_mb=0,vgamem_mb=16,max_outputs=1,bus=pcie.0,addr=0x1 -device ich9-intel-hda,id=sound0,bus=pcie.0,addr=0x1b -device hda-duplex,id=sound0-codec0,bus=sound0.0,cad=0,audiodev=audio1 -chardev spicevmc,id=charredir0,name=usbredir -device usb-redir,chardev=charredir0,id=redir0,bus=usb.0,port=2 -chardev spicevmc,id=charredir1,name=usbredir -device usb-redir,chardev=charredir1,id=redir1,bus=usb.0,port=3 -device vfio-pci,id=hostdev0,sysfsdev=/sys/bus/mdev/devices/4d2acb50-959a-4782-867f-0154205fb982,display=off,bus=pci.5,addr=0x0 -device virtio-balloon-pci,id=balloon0,bus=pci.4,addr=0x0 -sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny -msg timestamp=on
  • libvirt version 8.0.0-1ubuntu7.8
  • libvirt XML file
<domain type='kvm'>
 <name>REDACTED</name>
 <uuid>4d2acb50-959a-4782-867f-0154205fb982</uuid>
 <metadata>
   <libosinfo:libosinfo xmlns:libosinfo="http://libosinfo.org/xmlns/libvirt/domain/1.0">
     <libosinfo:os id="http://microsoft.com/win/2k22"/>
   </libosinfo:libosinfo>
 </metadata>
 <memory unit='KiB'>16777216</memory>
 <currentMemory unit='KiB'>16777216</currentMemory>
 <memoryBacking>
   <source type='memfd'/>
   <access mode='shared'/>
 </memoryBacking>
 <vcpu placement='static'>8</vcpu>
 <os>
   <type arch='x86_64' machine='pc-q35-6.2'>hvm</type>
   <bootmenu enable='no'/>
 </os>
 <features>
   <acpi/>
   <apic/>
   <hyperv mode='custom'>
     <relaxed state='on'/>
     <vapic state='on'/>
     <spinlocks state='on' retries='8191'/>
   </hyperv>
   <vmport state='off'/>
 </features>
 <cpu mode='host-passthrough' check='none' migratable='on'/>
 <clock offset='localtime'>
   <timer name='rtc' tickpolicy='catchup'/>
   <timer name='pit' tickpolicy='delay'/>
   <timer name='hpet' present='no'/>
   <timer name='hypervclock' present='yes'/>
 </clock>
 <on_poweroff>destroy</on_poweroff>
 <on_reboot>restart</on_reboot>
 <on_crash>destroy</on_crash>
 <pm>
   <suspend-to-mem enabled='no'/>
   <suspend-to-disk enabled='no'/>
 </pm>
 <devices>
   <emulator>/usr/bin/qemu-system-x86_64</emulator>
   <disk type='file' device='disk'>
     <driver name='qemu' type='qcow2' discard='unmap'/>
     <source file='/var/lib/libvirt/images/REDACTED.qcow2'/>
     <target dev='sda' bus='sata'/>
     <boot order='1'/>
     <address type='drive' controller='0' bus='0' target='0' unit='0'/>
   </disk>
   <disk type='file' device='cdrom'>
     <driver name='qemu' type='raw'/>
     <target dev='sdb' bus='sata'/>
     <readonly/>
     <address type='drive' controller='0' bus='0' target='0' unit='1'/>
   </disk>
   <controller type='usb' index='0' model='qemu-xhci' ports='15'>
     <address type='pci' domain='0x0000' bus='0x02' slot='0x00' function='0x0'/>
   </controller>
   <controller type='pci' index='0' model='pcie-root'/>
   <controller type='pci' index='1' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='1' port='0x10'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0' multifunction='on'/>
   </controller>
   <controller type='pci' index='2' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='2' port='0x11'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x1'/>
   </controller>
   <controller type='pci' index='3' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='3' port='0x12'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x2'/>
   </controller>
   <controller type='pci' index='4' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='4' port='0x13'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x3'/>
   </controller>
   <controller type='pci' index='5' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='5' port='0x14'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x4'/>
   </controller>
   <controller type='pci' index='6' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='6' port='0x15'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x5'/>
   </controller>
   <controller type='pci' index='7' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='7' port='0x16'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x6'/>
   </controller>
   <controller type='pci' index='8' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='8' port='0x17'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x7'/>
   </controller>
   <controller type='pci' index='9' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='9' port='0x18'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0' multifunction='on'/>
   </controller>
   <controller type='pci' index='10' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='10' port='0x19'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x1'/>
   </controller>
   <controller type='pci' index='11' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='11' port='0x1a'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x2'/>
   </controller>
   <controller type='pci' index='12' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='12' port='0x1b'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x3'/>
   </controller>
   <controller type='pci' index='13' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='13' port='0x1c'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x4'/>
   </controller>
   <controller type='pci' index='14' model='pcie-root-port'>
     <model name='pcie-root-port'/>
     <target chassis='14' port='0x1d'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x5'/>
   </controller>
   <controller type='sata' index='0'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x1f' function='0x2'/>
   </controller>
   <controller type='virtio-serial' index='0'>
     <address type='pci' domain='0x0000' bus='0x03' slot='0x00' function='0x0'/>
   </controller>
   <filesystem type='mount' accessmode='passthrough'>
     <driver type='virtiofs'/>
     <source dir='/mnt/storage/Temp/REDACTED_Test'/>
     <target dir='data'/>
     <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
   </filesystem>
   <interface type='bridge'>
     <mac address='52:54:00:0f:63:74'/>
     <source bridge='br12'/>
     <model type='e1000e'/>
     <address type='pci' domain='0x0000' bus='0x01' slot='0x00' function='0x0'/>
   </interface>
   <serial type='pty'>
     <target type='isa-serial' port='0'>
       <model name='isa-serial'/>
     </target>
   </serial>
   <console type='pty'>
     <target type='serial' port='0'/>
   </console>
   <channel type='spicevmc'>
     <target type='virtio' name='com.redhat.spice.0'/>
     <address type='virtio-serial' controller='0' bus='0' port='1'/>
   </channel>
   <input type='tablet' bus='usb'>
     <address type='usb' bus='0' port='1'/>
   </input>
   <input type='mouse' bus='ps2'/>
   <input type='keyboard' bus='ps2'/>
   <graphics type='spice' autoport='yes' listen='127.0.0.1'>
     <listen type='address' address='127.0.0.1'/>
   </graphics>
   <sound model='ich9'>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x1b' function='0x0'/>
   </sound>
   <audio id='1' type='spice'/>
   <video>
     <model type='qxl' ram='65536' vram='65536' vgamem='16384' heads='1' primary='yes'/>
     <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x0'/>
   </video>
   <hostdev mode='subsystem' type='mdev' managed='yes' model='vfio-pci' display='off' ramfb='off'>
     <source>
       <address uuid='4d2acb50-959a-4782-867f-0154205fb982'/>
     </source>
     <address type='pci' domain='0x0000' bus='0x05' slot='0x00' function='0x0'/>
   </hostdev>
   <redirdev bus='usb' type='spicevmc'>
     <address type='usb' bus='0' port='2'/>
   </redirdev>
   <redirdev bus='usb' type='spicevmc'>
     <address type='usb' bus='0' port='3'/>
   </redirdev>
   <memballoon model='virtio'>
     <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>
   </memballoon>
 </devices>
</domain>

VM:

  • Windows version: Windows Server 2022
  • Which driver has a problem: virtiofs
  • Driver version or commit hash that was used to build the driver: 0.1.240

Additional context Add any other context about the problem here.

kantlivelong avatar Apr 08 '24 14:04 kantlivelong

@kantlivelong Hi, You might parse the arguments from the registry, refer to the wiki https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/Virtiofs:-Shared-file-system#options .

xiagao avatar Apr 09 '24 09:04 xiagao

@kantlivelong Hi, You might parse the arguments from the registry, refer to the wiki https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/Virtiofs:-Shared-file-system#options .

This works for a single virtiofs tag but not multiple. The documentation also mentions using WinFSP for multiple but that is not persistent from what I can tell.

kantlivelong avatar Apr 09 '24 12:04 kantlivelong

Hi @kantlivelong, here is my steps with multiple virtiofs, it works from my side.

1. Config WinFsp.Launcher for multifs.
"C:\Program Files (x86)\WinFsp\bin\fsreg.bat" virtiofs "C:\virtiofs.exe" "-t %1 -m %2"
2. Start virtiofs instance with tag myfs1 to V:.
"C:\Program Files (x86)\WinFsp\bin\launchctl-x64.exe" start virtiofs viofsmyfs1 myfs1 V:
3. check the mapping volume inside guest
wmic logicaldisk where (VolumeName='myfs1') get DeviceID
C:\>
DeviceID
V:

Btw, I refer to Multiple virtiofs instances setup in the wiki https://github.com/virtio-win/kvm-guest-drivers-windows/wiki/Virtiofs:-Shared-file-system#multiple-virtiofs-instances

Hope this is helpful.

xiagao avatar Apr 12 '24 10:04 xiagao

I did see that part of the documentation and gave it a try before opening this ticket. While it did work I found that it did not persist on reboot.

Is the expectation that a bat be created and run via task scheduler on boot?

kantlivelong avatar Apr 12 '24 12:04 kantlivelong

I did see that part of the documentation and gave it a try before opening this ticket. While it did work I found that it did not persist on reboot.

Is the expectation that a bat be created and run via task scheduler on boot?

Hi @YanVugenfirer , do we have any plan regarding @kantlivelong 's situation?

And for multiple shared dir, I don't think it works with "sc create VirtioFsSvc-data binPath=""C:\Program Files\Virtio-Win\VioFS\virtiofs.exe" -t data -m D:" start=auto depend=VirtioFsDrv", what's your opinion?

xiagao avatar Apr 15 '24 01:04 xiagao

Currently for the multiple mounts, a WinFSP launcher should be used. So, yes - the solution is batch files on boot to configure the mounts.

We still need to fix an issue of mismatch of the configuration in the registry and in CLI. @xiagao I suggest opening Jira for this.

YanVugenfirer avatar Apr 15 '24 08:04 YanVugenfirer