Dear Openstack community,
I recently setup pci-passthrough against nvme drives to directly attach the disks to the vm as a block device.
I created 2 vms on the same physical host and I can see the disks (nvme0n1) on both of them:
[centos@test-nvme-small ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 10G 0 disk
„€vda1 253:1 0 10G 0 part /
nvme0n1 259:0 0 1.8T 0 disk
[centos@test-nvme-small-2 ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
vda 253:0 0 10G 0 disk
„€vda1 253:1 0 10G 0 part /
nvme0n1 259:0 0 1.8T 0 disk
So I wanted to check which nvme device was attached to which vm. I thought one option would be to dump the vm xml file from virsh which can be found below (I am only putting the information between the disks section but happy to attach
the hole file if needed):
Device/disk configuration for instance-00000094
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/nova/instances/fd95cc45-1501-4693-8643-944be2ff4625/disk'/>
<backingStore type='file' index='1'>
<format type='raw'/>
<source file='/var/lib/nova/instances/_base/4cc6eebe175e35178cb81853818a1eb103cea937'/>
<backingStore/>
</backingStore>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
Device/disk configuration for instance-00000093
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2' cache='none'/>
<source file='/var/lib/nova/instances/7e6a055c-1b4e-458c-89cd-cb8c1d10e939/disk'/>
<backingStore type='file' index='1'>
<format type='raw'/>
<source file='/var/lib/nova/instances/_base/4cc6eebe175e35178cb81853818a1eb103cea937'/>
<backingStore/>
</backingStore>
<target dev='vda' bus='virtio'/>
<alias name='virtio-disk0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
Based on this output and If I am not mistaken I am under the impression that the host pci device attached to both vms is 0000:00:04.0
Questions:
Is there an Openstack way to check which pci devices are attached to which vms instead of having to dump the vm xml file?
Am I right assuming that the same disk is attached to both vms? If yes, how can that happen?
Thank you very much