Some confusion about lsilogic controller

Hello, I have been confused by such a phenomenon recently. Libvirt is the master branch , and the VM is centos8.2(kernel is 4.18.0-193.el8.aarch64). When I hot-plug the scsi disk for a virtual machine without a virtio-scsi controller, libvirt will automatically generate an lsilogic controller for the scsi disk. <disk type='file' device='disk'> <driver name='qemu' type='qcow2' cache='none' io='native'/> <source file='/Images/xcc/tmp.img'/> <backingStore/> <target dev='sdt' bus='scsi'/> <address type='drive' controller='0' bus='0' target='0' unit='0'/> </disk> linux-upcHIq:/Images/xcc # virsh list Id Name State ---------------------- 12 g1 running linux-upcHIq:/Images/xcc # virsh attach-device g1 disk.xml Device attached successfully linux-upcHIq:/Images/xcc # virsh dumpxml g1 | grep scsi <target dev='sdt' bus='scsi'/> <alias name='scsi0-0-0'/> <controller type='scsi' index='0' model='lsilogic'> <alias name='scsi0'/> But this scsi disk cannot be found through the lsblk command inside the virtual machine. [root@localhost ~]# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT vda 252:0 0 20G 0 disk ├─vda1 252:1 0 600M 0 part /boot/efi ├─vda2 252:2 0 1G 0 part /boot └─vda3 252:3 0 18.4G 0 part ├─cl-root 253:0 0 16.4G 0 lvm / └─cl-swap 253:1 0 2G 0 lvm [SWAP] After hot unplugging the scsi disk, I performed the hot unplug operation of the lsilogic controller. libvirt shows "Device detached successfully", but in fact, the lsilogic controller is not removed from the live XML and persistent XML. Through "virsh dumpxml vmname" and "virsh edit vmname", I can see <controller type='scsi' index='0' model='lsilogic'> is always there. linux-upcHIq:/Images/xcc # virsh detach-device g1 disk.xml Device detached successfully linux-upcHIq:/Images/xcc # virsh dumpxml g1 | grep scsi <controller type='scsi' index='0' model='lsilogic'> <alias name='scsi0'/> linux-upcHIq:/Images/xcc # linux-upcHIq:/Images/xcc # cat lsi.xml <controller type='scsi' index='0' model='lsilogic'> <alias name='scsi0'/> <address type='pci' domain='0x0000' bus='0x03' slot='0x05' function='0x0'/> </controller> linux-upcHIq:/Images/xcc # virsh detach-device g1 lsi.xml Device detached successfully linux-upcHIq:/Images/xcc # virsh dumpxml g1 | grep scsi <controller type='scsi' index='0' model='lsilogic'> <alias name='scsi0'/> I am confused, why libvirt chooses to generate an lsilogic controller for the scsi disk when there is no scsi controller, instead of directly reporting an error and exiting the hot plug operation. After all, the scsi disk based on the lsilogic controller is not perceived inside the virtual machine, and lsilogic will remain in the XML file of the virtual machine.

On Wed, Feb 24, 2021 at 09:11:03AM +0000, xingchaochao wrote:
Hello, I have been confused by such a phenomenon recently. Libvirt is the master branch , and the VM is centos8.2(kernel is 4.18.0-193.el8.aarch64). When I hot-plug the scsi disk for a virtual machine without a virtio-scsi controller, libvirt will automatically generate an lsilogic controller for the scsi disk.
snip
I am confused, why libvirt chooses to generate an lsilogic controller for the scsi disk when there is no scsi controller, instead of directly reporting an error and exiting the hot plug operation. After all, the scsi disk based on the lsilogic controller is not perceived inside the virtual machine, and lsilogic will remain in the XML file of the virtual machine.
libvirt has no knowledge of what devices the guest OS is able to support. In this case RHEL8 doesn't support lsilogic, but libvirt doesn't know this. Generally a libvirt mgmt application will not rely on the defaults for choosing devices, and instead use libosinfo to figure out what devices are likely to be supported and explicitly use those. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|

Thank you for your kind reply. This issue involves a qemu bug, and the patch has been queued by the qemu community on March 2. https://patchwork.kernel.org/project/qemu-devel/patch/20210302133016.1221081... Regards, Xingchaochao -----邮件原件----- 发件人: Daniel P. Berrangé [mailto:berrange@redhat.com] 发送时间: 2021年2月24日 19:07 收件人: xingchaochao <xingchaochao@huawei.com> 抄送: libvir-list@redhat.com; libvirt-users@redhat.com; liangpeng (H) <liangpeng10@huawei.com>; Zhangbo (Oscar) <oscar.zhangbo@huawei.com>; Xiexiangyou <xiexiangyou@huawei.com> 主题: Re: Some confusion about lsilogic controller On Wed, Feb 24, 2021 at 09:11:03AM +0000, xingchaochao wrote:
Hello, I have been confused by such a phenomenon recently. Libvirt is the master branch , and the VM is centos8.2(kernel is 4.18.0-193.el8.aarch64). When I hot-plug the scsi disk for a virtual machine without a virtio-scsi controller, libvirt will automatically generate an lsilogic controller for the scsi disk.
snip
I am confused, why libvirt chooses to generate an lsilogic controller for the scsi disk when there is no scsi controller, instead of directly reporting an error and exiting the hot plug operation. After all, the scsi disk based on the lsilogic controller is not perceived inside the virtual machine, and lsilogic will remain in the XML file of the virtual machine.
libvirt has no knowledge of what devices the guest OS is able to support. In this case RHEL8 doesn't support lsilogic, but libvirt doesn't know this. Generally a libvirt mgmt application will not rely on the defaults for choosing devices, and instead use libosinfo to figure out what devices are likely to be supported and explicitly use those. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
participants (2)
-
Daniel P. Berrangé
-
xingchaochao