[PATCH 0/6] qemu: Fix cdrom as SCSI hostdev via -blockdev

Peter Krempa pkrempa at redhat.com
Mon Oct 19 16:35:51 UTC 2020

On Thu, Oct 15, 2020 at 17:25:08 +0200, Peter Krempa wrote:
> -drive detects whether a device is a cdrom automatically but we need to
> use 'host_cdrom' when using blockdev explicitly. Fix the hostdev code
> which was recently converted to -blockdev.
> Warning:
> I _don't_ have a box with a CDROM handy so this code is not tested in action!

I've tried this a bit more in a virtual environment ...

> Peter Krempa (6):
>   qemuProcessCreatePretendCmd: Split up preparation and command building
>   qemu: hostdev: Prepare definition bits in qemuDomainPrepareHostdev
>   qemu: Prepare hostdev data which depends on the host state separately
>   qemuxml2argvmock: Remove mocking of 'virSCSIDeviceGetSgName'

These above are pure refactors which are IMO worth keeping, so somebody,
please review.

>   qemu: Detect whether a SCSI hostdev is a cdrom
>   qemu: Add test cases for 'host_cdrom' blockdev backend via <disk>

(self) NACK to those above 'host_cdrom' doesn't work with /dev/sg* as it
doesn't detect that its a generic device for passthrough. Using
'host_device' is needed here, so the code we have currently is correct.

I've tried this in nested virtual environment and the passthrough works
fine for me.


I need to start over, could you please post the following info. (please
gather it again, so that it's all consistent):

host OS side:

libvirt version
VM XML file
VM command line

guest OS side:



More information about the libvir-list mailing list