On Mon, Oct 19, 2020 at 4:07 PM Peter Krempa <[email protected]> wrote:

> 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" <[email protected]>
> > > To: "daggs" <[email protected]>
> > > Cc: [email protected]
> > > 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.
>
> You can emulate it by scsi_debug:
➜  ~ modprobe scsi_debug ptype=5
➜  ~ lsscsi
[2:0:0:0]    cd/dvd  Linux    scsi_debug       0188  /dev/sr0

Reply via email to