]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: Reflect MAC address change in live domain XML
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 27 Jun 2023 15:13:33 +0000 (17:13 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 25 Mar 2025 10:49:30 +0000 (11:49 +0100)
commitac95617d3dfe663b26242fe538d8371ad1154eff
treeee8f4f65edf4516f6441b079b31d5e8337414808
parentd5666b3c2e74fc11e8599d0afb75da346ef25204
qemu: Reflect MAC address change in live domain XML

If a guest changes MAC address on its vNIC, then QEMU emits
NIC_RX_FILTER_CHANGED event (the event is emitted in other cases
too, but that's not important right now). Now, domain XML allows
users to chose whether to trust these events or not:

  <interface trustGuestRxFilters='yes|no'/>

For the 'no' case no action is performed and the event is
ignored. But for the 'yes' case, some host side features of
corresponding vNIC (well tap/macvtap device) are tweaked to
reflect changed MAC address. But what is missing is reflecting
this new MAC address in domain XML.

Basically, what happens is: the host sees traffic with new MAC
address, all tools inside the guest see the new MAC address
(including 'virsh domifaddr --source agent') which makes it
harder to match device in the guest with the one in the domain
XML.

Therefore, report this new MAC address as another attribute of
the <mac/> element:

  <mac address="52:54:00:a4:6f:91" currentAddress="00:11:22:33:44:55"/>

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
docs/formatdomain.rst
src/conf/domain_conf.c
src/conf/domain_conf.h
src/conf/schemas/domaincommon.rng
src/qemu/qemu_domain.c
src/qemu/qemu_driver.c