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

daggs daggs at gmx.com
Mon Oct 19 05:39:23 UTC 2020


Greetings All,

> Sent: Thursday, October 15, 2020 at 6:25 PM
> From: "Peter Krempa" <pkrempa at redhat.com>
> To: libvir-list at redhat.com
> Cc: "daggs" <daggs at gmx.com>
> Subject: [PATCH 0/6] qemu: Fix cdrom as SCSI hostdev via -blockdev
>
> -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!
>
> 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'
>   qemu: Detect whether a SCSI hostdev is a cdrom
>   qemu: Add test cases for 'host_cdrom' blockdev backend via <disk>

I've tested the bellow on libvirt 6.8.0, I wasn't able to get it to work, with the same entry as the example, e.g.:
    <hostdev mode='subsystem' type='scsi' managed='yes'>
      <source>
        <adapter name='cdrom'/>
        <address bus='0' target='0' unit='0'/>
      </source>
      <readonly/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </hostdev>
I get this error:
error: XML error: SCSI host device doesn't support managed mode.

if I mark the managed as no (like other pci pass-through devices I have in the vm), I get this error:
error: internal error: Cannot parse adapter 'cdrom'

looks like the commit is missing the cdrom validation at https://gitlab.com/libvirt/libvirt/-/blob/master/src/util/virscsi.c#L90

full machine xml can be found at https://dpaste.com/G32WWAJA2

Dagg.





More information about the libvir-list mailing list