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.