[vfio-users] optical eject issue

leesteken at pm.me leesteken at pm.me
Sat May 23 18:54:05 UTC 2020


> Hello,
>
> On 5/23/20 12:12 AM, Roger Lawhorn wrote:
>
> > ok, sorry, did a reply instead of a reply to all....
> > I have used the -cdrom /dev/sr0 option.
> > When you say 'virtual' optical drive, are you talking about an iso or a physical
> > optical drive?
> > I am adding a physical optical drive.
>
> To pass through a physical optical drive, you need to use qemu's SCSI generic
> device, not a SCSI CD device. In this case, qemu will forward SCSI commands
> as-is instead of adding its own emulation layer on top. This means that an
> "eject" command will be handled by your physical drive, and not by qemu.
>
> For example, from one of my own qemu scripts:
>
> -device virtio-scsi-pci,bus=pcie.0 \
> -device scsi-hd,drive=hd0 \
> -drive file=/dev/sdc,format=raw,id=hd0,if=none,unit=0 \
> -device scsi-generic,drive=cd0 \
> -drive file=/dev/sg2,format=raw,id=cd0,if=none,unit=1 \
>
> I've successfully used this arrangement to rip dozens of CD-ROMs using CUETools.
> Attempting to eject sometimes takes 3 or 4 tries, especially if the device is
> still in use, but it does eventually work. Another thing you can do is run
> `eject /dev/sr0` on the host, even while the VM is running, which always ejected
> immediately.

Thank you for this example! I just tried this and eject works fine for me (on Linux).
I'm quite confident that this will help Roger resolve his problem.

Personally, I won't be using it because it does not allow for (CSS-encrypted) DVD playback.

kind regards, Arjen






More information about the vfio-users mailing list