libvirt issue: https://gitlab.com/libvirt/libvirt/-/issues/261
1、start vm with usb cdrom
<disk type="file" device="cdrom">
<driver name="qemu" type="raw" discard="unmap"/>
<source file="/tmp/cdrom"/>
<target dev="sda" bus="usb"/>
<readonly/>
<address type="usb" bus="0" port="1"/>
</disk>
2、 get qemu cmdline
qemu ... -blockdev
{"driver":"file","filename":"/tmp/cdrom","node-name":"libvirt-1-storage","auto-read-only":true,"discard":"unmap"}
-blockdev
{"node-name":"libvirt-1-format","read-only":true,"discard":"unmap","driver":"raw","file":"libvirt-1-storage"}
-device
{"driver":"usb-storage","bus":"usb.0","port":"1","drive":"libvirt-1-format","id":"usb-disk0","removable":false}
3、 in vm
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.
在 2022/12/1 23:35, Markus Armbruster 写道:
luzhipeng <luzhip...@cestc.cn> writes:
From: zhipeng Lu <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>
What problem are you trying to solve?