Why host device disappear in libvirt doman xml?

Michal Prívozník mprivozn at redhat.com
Mon Sep 26 14:10:04 UTC 2022


On 9/26/22 15:06, 陈新隆 wrote:
> 
> <https://stackoverflow.com/posts/73854544/timeline>
> 
> I'm using Kubevirt to manage my virtual machine instances. When I using
> Kubevirt to create a vm(with two GPUs), kubevirt will generate a libvirt
> guest domain xml for this vm which includes two GPUs, the domain xml as
> follow :
> 
> |<hostdev mode='subsystem' type='pci' managed='no'> <driver
> name='vfio'/> <source> <address domain='0x0000' bus='0x83' slot='0x00'
> function='0x0'/> </source> <alias name='ua-gpu-gpu0'/> <address
> type='pci' domain='0x0000' bus='0x06' slot='0x00' function='0x0'/>
> </hostdev> <hostdev mode='subsystem' type='pci' managed='no'> <driver
> name='vfio'/> <source> <address domain='0x0000' bus='0x84' slot='0x00'
> function='0x0'/> </source> <alias name='ua-gpu-gpu1'/> <address
> type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>
> </hostdev> |
> 
> No one ever edit this domain xml, but these two |hostdev| element
> disappeared in the domain xml. During this time, I've run
> the |gpu_burn| command to do a stress test for these two GPUs.
> 
> My question is :
> 
>   * when will libvirtd change the guest domain xml ?
>   * why libvirtd delete these two |hostdev| from domain xml ?
> 

Libvirt does not remove anything from domain XML (except for the
elements it does not understand, but this is not the case). My suspicion
is that you're looking at live XML instead of inactive XML or vice
versa. Libvirt allows guests to be defined (i.e. libvirt manages their
inactive definition). However, a guest can be started with wildly
different configuration (e.g. without those two <hostdev/>-s). OR, they
might have been hot-unplugged.


This article can explain more details:
https://wiki.libvirt.org/page/VM_lifecycle

Michal



More information about the libvirt-users mailing list