]> git.ipfire.org Git - thirdparty/libvirt.git/commit
lib: Fix calling of virNetworkUpdate() driver callback
authorMichal Privoznik <mprivozn@redhat.com>
Tue, 16 Mar 2021 09:33:26 +0000 (10:33 +0100)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 25 Mar 2021 09:10:23 +0000 (10:10 +0100)
commitb0f78d626a18bcecae3a4d165540ab88bfbfc9ee
treeab61af683785e576d7d69ab567b4a0077a71ed11
parent94741bc53e9b9a405fae8f2e96b780c2891b2ff0
lib: Fix calling of virNetworkUpdate() driver callback

The order in which virNetworkUpdate() accepts @section and
@command arguments is not the same as in which it passes them
onto networkUpdate() callback. Until recently, it did not really
matter, because calling the API on client side meant arguments
were encoded in reversed order (compared to the public API), but
then on the server it was fixed again - because the server
decoded RPC (still swapped), called public API (still swapped)
and in turn called the network driver callback (with reversing
the order - so magically fixing the order).

Long story short, if the public API is called even number of
times those swaps cancel each other out. The problem is when the
API is called an odd numbed of times - which happens with split
daemons and the right URI. There's one call in the client (e.g.
virsh net-update), the other in a hypervisor daemon (say
virtqemud) which ends up calling the API in the virnetworkd.

The fix is obvious - fix the order in which arguments are passed
to the callback.

But, to maintain compatibility with older, yet unfixed, daemons
new connection feature is introduced. The feature is detected
just before calling the callback and allows client to pass
arguments in correct order (talking to fixed daemon) or in
reversed order (talking to older daemon).

Unfortunately, older client talking to newer daemon can't be
fixed. Let's hope that it's less frequent scenario.

Fixes: 574b9bc66b6b10cc4cf50f299c3f0ff55f2cbefb
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1870552
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/esx/esx_driver.c
src/libvirt-network.c
src/libvirt_internal.h
src/libxl/libxl_driver.c
src/lxc/lxc_driver.c
src/network/bridge_driver.c
src/openvz/openvz_driver.c
src/qemu/qemu_driver.c
src/remote/remote_daemon_dispatch.c
src/test/test_driver.c