<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Oct 19, 2020 at 4:07 PM Peter Krempa <<a href="mailto:pkrempa@redhat.com">pkrempa@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Mon, Oct 19, 2020 at 09:45:31 +0200, daggs wrote:<br>
> Greetings Peter,<br>
> <br>
> > Sent: Monday, October 19, 2020 at 10:17 AM<br>
> > From: "Peter Krempa" <<a href="mailto:pkrempa@redhat.com" target="_blank">pkrempa@redhat.com</a>><br>
> > To: "daggs" <<a href="mailto:daggs@gmx.com" target="_blank">daggs@gmx.com</a>><br>
> > Cc: <a href="mailto:libvir-list@redhat.com" target="_blank">libvir-list@redhat.com</a><br>
> > Subject: Re: [PATCH 0/6] qemu: Fix cdrom as SCSI hostdev via -blockdev<br>
> ><br>
> > On Sun, Oct 18, 2020 at 14:34:16 +0200, daggs wrote:<br>
> ><br>
> > This is purely for tests, to force a cdrom since we can't probe the<br>
> > host. Using it for a VM will fail.<br>
> ><br>
> ><br>
> > Yup, this is expected, you need to use a real 'adapterN' here.<br>
> ><br>
> ><br>
> <br>
> so there is a bug in my xml? if so, where is the error?<br>
<br>
Well, you used an XML from our tests, with following config:<br>
<br>
    <hostdev mode='subsystem' type='scsi' managed='yes'><br>
      <source><br>
        <adapter name='cdrom'/><br>
<br>
If you look into patch 5/6 for the change to tests/qemuxml2argvtest.c<br>
you'll see that using 'cdrom' as an adapter name is a hack made for just<br>
tests. That will _not_ work anywhere else.<br>
<br>
You should use the XML that you've used before with the adapter name<br>
corresponding to the adapter the cdrom is on.<br>
<br>
The command line you've posted:<br>
<br>
-blockdev '{"driver":"host_device","filename":"/dev/sg0","node-name":"libvirt-2-backend","read-only":true}' \<br>
-device scsi-generic,bus=scsi0.0,channel=0,scsi-id=0,lun=0,drive=libvirt-2-backend,id=hostdev0 \<br>
<br>
Shows that nothing has changed, but unfortunately doesn't show enough<br>
for me to debug it. Unfortunately the cdrom detection code doesn't log<br>
anything so debug logs won't help either.<br>
<br>
I'll need to try it in a nested virtualization environment since I don't<br>
have a physical CD drive handy.<br>
<br></blockquote><div>You can emulate it by scsi_debug:</div><div>➜  ~ modprobe scsi_debug ptype=5<br></div><div>➜  ~ lsscsi<br>[2:0:0:0]    cd/dvd  Linux    scsi_debug       0188  /dev/sr0 </div></div></div>