Problem/Justification
When installing Windows VM on virtio-scsi drive (Incus default disk controller) the installer doesnt see the drive because its missing vioscsi driver. I could easily solve this by mounting ISO containing virtio drivers from which I could install required driver and can continue installation on virtio-scsi drive.
But currently I cant mount the ISO in a way for Windows installer to be able to see it. Windows installer can only see cdrom device if its IDE, SATA or similar.
Impact
User will be simply able to mount additional ISO containing virtio drivers for their Windows installation on virtio-scsi drive. They will install vioscsi driver from the ISO and this will allow them to complete the installation.
Implementation and notes
Simplest way to mount ISO as legacy cdrom into VMs is by using raw.qemu
option in Incus.
For IDE (oldest and most compatible):
-drive file=/home/truenas_admin/virtio.iso,media=cdrom,if=ide,file.locking=off
For SATA device:
-device ich9-ahci,id=ahci
-device ide-cd,bus=ahci.0,drive=cdrom
-drive id=cdrom,if=none,media=cdrom,file=/home/truenas_admin/virtio.iso,file.locking=off
Normally QEMU attempts to lock the file but it didnt work for me in any location other than /run/incus/instance
so I added file.locking=off
to get around it.
Edit: After some more reading we actually want file.locking=off
either way. Without this the ISO file would be locked only to single VM and unusable for any other. But we want to have single ISO with drivers potentially mounted to multiple VMs. So we need file.locking=off
.
Edit2: These configurations should be also doable by QMP via raw.qemu.qmp
options if thats preferable to polluting QEMU init command line. Instance options - Incus documentation
Or for the most advanced use case there is raw.qemu.scriptlet
which uses Starlark (Python dialect) for custom scripts.