]> xenbits.xensource.com Git - libvirt.git/commit
qemu: don't reject interface update when switching to/from bridged network
authorLaine Stump <laine@redhat.com>
Thu, 28 May 2020 22:04:24 +0000 (18:04 -0400)
committerLaine Stump <laine@redhat.com>
Fri, 5 Jun 2020 02:46:26 +0000 (22:46 -0400)
commitbc85c34ea91c46588423fa24e56e09ca5aab31dd
tree835d8bef972eccf8a236f8ef782817b68925e4e9
parentdc9692dcdc04cdcc87a7eae59ded41fb0c57a684
qemu: don't reject interface update when switching to/from bridged network

If virDomainUpdateDeviceFlags() was used to update an <interface>, and
the interface type changed from type='network' where the network was
an unmanaged bridge (so actualType == bridge) to type='bridge'
(i.e. actualType *also* == bridge), the update would fail due to the
perceived change in type.

In practice it is okay to switch between any interface types that end
up using a tap device, since libvirt just needs to attach the device
to a new bridge. But in this case we were erroneously rejecting it due
to a conditional that was too restrictive. This is what the code was doing:

  if (old->type != new->type)
     [allow update]
  else
     if ((oldActual == bridge and newActual == network)
         || (oldActual == network and newActual == bridge)) {
         [allow update]
     else
         [error]

In the case described above though, old->type and new->type don't match,
but oldActual and newActual are both 'bridge', so we get an error.

This patch changes the inner conditional so that any combination of
'network' and 'bridge' for oldActual and newActual, since they both
use a tap device connected to a bridge.

Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
src/qemu/qemu_hotplug.c