Thanks.

 -device usb-bot,id=bot0
 -device scsi-{cd,hd},bus=bot0.0,drive=drive0

Qemu implements virtio scsi to emulate scsi controller, but if the virtual machine(for example windows guest os) don't install the virtio scsi driver, it don't work i need the function: emulate cdrom in guest, support hotplug and unplug, not depend on virtio driver

have a better idea?

在 2022/12/7 16:39, Paolo Bonzini 写道:
It should be like this:

-device usb-bot,id=bot0
-device scsi-{cd,hd},bus=bot0.0,drive=drive0

Libvirt has the code to generate the options for SCSI controllers, but usb-bot only allows one disk attached to it so it's easier to make it a <drive> element.

Paolo

Il sab 3 dic 2022, 13:52 Zhipeng Lu <luzhip...@cestc.cn <mailto:luzhip...@cestc.cn>> ha scritto:

    Could you give the detail qemu cmdline about usb-bot?

    在 2022/12/2 17:40, Paolo Bonzini 写道:
     > On 12/2/22 03:26, Zhipeng Lu wrote:
     >> NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
     >> sda             8:0    0  100M  1 disk
     >> vda           252:0    0   10G  0 disk
     >> ├─vda1        252:1    0    1G  0 part /boot
     >> └─vda2        252:2    0    9G  0 part
     >>    ├─rhel-root 253:0    0    8G  0 lvm  /
     >>    └─rhel-swap 253:1    0    1G  0 lvm  [SWAP]
     >> lshw -short|grep cdrom -i
     >> No cdrom.
     >>
     >> My patch is to solve this problem, usb cdrom emulated as cdrom.
     >
     > This is a libvirt bug, it should use usb-bot instead of usb-storage
     > together with -blockdev.  Then it can add a scsi-cd device below
    usb-bot.
     >
     > Paolo
     >
     >>
     >>
     >> 在 2022/12/1 23:35, Markus Armbruster 写道:
     >>> luzhipeng <luzhip...@cestc.cn <mailto:luzhip...@cestc.cn>> writes:
     >>>
     >>>> From: zhipeng Lu <luzhip...@cestc.cn <mailto:luzhip...@cestc.cn>>
     >>>>
     >>>> The drive interface supports media=cdrom so that the usb cdrom
     >>>> can be emulated as cdrom in qemu, but libvirt deprived the drive
     >>>> interface, so media=cdrom is added to the blockdev interface to
     >>>> support usb cdrom emulated as cdrom
     >>>>
     >>>> Signed-off-by: zhipeng Lu <luzhip...@cestc.cn
    <mailto:luzhip...@cestc.cn>>
     >>>
     >>> What problem are you trying to solve?
     >>>
     >>>
     >>>
     >>
     >>
     >>
     >
     >
     >





Reply via email to