On Sun, Oct 18, 2020 at 14:34:16 +0200, daggs wrote:
Greetings All,
> Sent: Thursday, October 15, 2020 at 6:25 PM
> From: "Peter Krempa" <pkrempa(a)redhat.com>
> To: libvir-list(a)redhat.com
> Cc: "daggs" <daggs(a)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'/>
This is purely for tests, to force a cdrom since we can't probe the
host. Using it for a VM will fail.
<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'
Yup, this is expected, you need to use a real 'adapterN' here.