After v9.1.0-rc1~116 we track whether it's us who created a
macvtap or not. But when updating a vNIC its definition might be
replaced with a new one (though, ifname is not allowed to
change), e.g. to reflect new QoS, link state, etc.
Now, the fact whether we created macvtap for given vNIC is stored
in net->privateData->created. And replacing definition is done by
simply freeing the old definition and making the pointer point to
the new one. But this does not preserve the 'created' flag, which
in turn means when a domain is shutting off, the macvtap is not
removed (see loop inside of qemuProcessStop()).
Copy this flag into new definition and leave a note in
_qemuDomainNetworkPrivate struct.
Fixes: 61d1b9e6592660121aeda66bf7adbcd39de06aa8
Resolves:
https://issues.redhat.com/browse/RHEL-22714
Signed-off-by: Michal Privoznik <mprivozn(a)redhat.com>
---
I also contemplated idea of preserving whole privateData, e.g.:
virObjectUnref(newdev->privateData);
newdev->privateData = g_steal_pointer(&olddev->privateData);
but then decided against it. Looks like a heavy gun, though in my
debugging all members but 'created' were zero/NULL at point of calling
qemuDomainChangeNet(). Then there is qemuDomainNetworkPrivateFormat()
and qemuDomainNetworkPrivateParse() combo, but in order to use it I'd
need to create and then parse an XML doc (to get 'ctxt') and that looks
too much work for very little gain.
Does somebody have any other idea?
src/qemu/qemu_domain.h | 2 ++
src/qemu/qemu_hotplug.c | 5 +++++
2 files changed, 7 insertions(+)