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

Peter Krempa pkrempa at redhat.com
Mon Oct 19 08:06:04 UTC 2020


On Mon, Oct 19, 2020 at 09:45:31 +0200, daggs wrote:
> Greetings Peter,
> 
> > Sent: Monday, October 19, 2020 at 10:17 AM
> > From: "Peter Krempa" <pkrempa at redhat.com>
> > To: "daggs" <daggs at gmx.com>
> > Cc: libvir-list at redhat.com
> > Subject: Re: [PATCH 0/6] qemu: Fix cdrom as SCSI hostdev via -blockdev
> >
> > On Sun, Oct 18, 2020 at 14:34:16 +0200, daggs wrote:
> >
> > This is purely for tests, to force a cdrom since we can't probe the
> > host. Using it for a VM will fail.
> >
> >
> > Yup, this is expected, you need to use a real 'adapterN' here.
> >
> >
> 
> so there is a bug in my xml? if so, where is the error?

Well, you used an XML from our tests, with following config:

    <hostdev mode='subsystem' type='scsi' managed='yes'>
      <source>
       	<adapter name='cdrom'/>

If you look into patch 5/6 for the change to tests/qemuxml2argvtest.c
you'll see that using 'cdrom' as an adapter name is a hack made for just
tests. That will _not_ work anywhere else.

You should use the XML that you've used before with the adapter name
corresponding to the adapter the cdrom is on.

The command line you've posted:

-blockdev '{"driver":"host_device","filename":"/dev/sg0","node-name":"libvirt-2-backend","read-only":true}' \
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=libvirt-2-backend,id=hostdev0 \

Shows that nothing has changed, but unfortunately doesn't show enough
for me to debug it. Unfortunately the cdrom detection code doesn't log
anything so debug logs won't help either.

I'll need to try it in a nested virtualization environment since I don't
have a physical CD drive handy.




More information about the libvir-list mailing list