vDPA devices and random MAC address assignment

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

I am trying to find a solution to an issue related to vhost-vdpa devices
and random mac addresses being assigned to them, if not set by the user.

vDPA devices are assigned a MAC address the time they are created. That
happens before creating the VM with qemu or libvirt. If the mac address
of the vdpa device in the qemu command line does not match the mac
address that was assigned to the vdpa device at creation time, the
network traffic will not work.

If the user does not explicitly configure a mac address for the vdpa
device in the domain xml, libvirt will generate a random one and use it
instead in the qemu command line. This leads to an interface that does
not work.

If I understood correctly, qemu is not able to update the mac address of
the vdpa device based on the command line configuration, so setting the
mac address generated by libvirt is not an option. Currently, a patch
that introduces a set of checks comparing cmdline and device mac
addresses is under review:

    https://lore.kernel.org/qemu-devel/20250417102522.4125379-1-lulu@xxxxxxxxxx/

The implementation also adds the logic to configure the vdpa device mac
address in the virtio net device if a mac address was not provided in
the command line.

I was trying to write a patch such that it would allow vdpa devices to
have an empty mac address in the domain xml as an exception. The draft
allowed such case in virDomainNetDefParseXML and virDomainNetDefFormat
and avoided writing an empty mac address in the qemu command line by
modifying the logic in qemuBuildNicDevProps. However, there are plenty
of other functions and places that would expect the mac address to be
there. Guarding against the empty mac addr case in all those places, is
not desirable, I think.

I'm not sure if libvirt could read the mac address of the device being
assigned to the VM instead of generating a random mac address in the
case of vdpa devices. It could probably require some code from qemu
being duplicated. Could that be an acceptable alternative?  I am also
looking for any other recommendation on how I could look into this
issue.

Thanks a lot.

Regards,
Beñat




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux