Xen with libvirt and SR-IOV

Jim Fehlig jfehlig at suse.com
Wed Mar 22 01:35:00 UTC 2023


On 3/21/23 11:05, nospam at godawa.de wrote:
> Hi everybody,
> 
> since long time, I'm using Xen on CentOS with XL, currently latest CentOS 7 with 
> Xen 4.15 from the CentOS-Xen-Project. For several VMs I have to use SR-IOV, to 
> lower the CPU-usage on Dom0 on the host.
> 
> CentOS 7 comes to an end, Xen is not supported by RHEL nor RockyLinux anymore, 
> so unfortunately I have to switch to KVM.
> 
> First step will be now, converting all the scripts for managing and running VMs, 
> that they run with the additional libvirt-layer.

What is the libvirt version?

> Mostly everything is working, but I do not get a network interface in the VM, 
> when I start it with "virsh start ..." instead of "xl create ...".
> 
> 
> First of all, is there documentation how to configure the VMs in the 
> dom-definition for XEN (all docs I found are KVM-related)?

I know it's not complete, but https://libvirt.org/formatdomain.html makes an 
attempt to identify hypervisor support for the various configuration settings.

> The converted xl-config does not do the job:
> 
> virsh -c xen:/// domxml-from-native --format xen-xl vm > vm.xml
> 
> These are some none working examples I tried out:
> 
>      ...
>      <interface type='hostdev' managed='yes'>
>        <mac address='02:16:32:10:20:30'/>
>        <driver name='xen'/>
>        <source>
>          <address type='pci' domain='0x0000' bus='0x81' slot='0x02' 
> function='0x6'/>
>        </source>
>        <vlan>
>          <tag id='11'/>
>        </vlan>
>      </interface>
>      ...
> 
> 
>      ...
>      <hostdev mode='subsystem' type='pci' managed='yes'>
>        <driver name='xen'/>
>        <source>
>          <address domain='0x0000' bus='0x81' slot='0x02' function='0x6'/>
>        </source>
>        <address type='pci' domain='0x0000' bus='0x81' slot='0x02' function='0x6'/>
>      </hostdev>
>      ...
> 

I've used both configurations successfully. Has the sriov virtual function been 
unbound from the native driver and bound to xen-pciback? You can check which 
driver is in use with something like

ls /sys/bus/pci/devices/0000\:81\:02.6/driver

If bound to xen-pciback, it vf should also appear in the output of 'xl 
pci-assignable-list'.

Regards,
Jim



More information about the libvirt-users mailing list