qemu_hotplug: Clear QoS if required in qemuDomainChangeNet()

In one of my recent commits, I've introduced
virDomainInterfaceClearQoS() which is a helper that either calls
virNetDevBandwidthClear() ('tc' implementation) or
virNetDevOpenvswitchInterfaceClearQos() (for ovs ifaces). But I
made a micro optimization which leads to a bug: the function
checks whether passed iface has any QoS set and returns early if
it has none. In majority of cases this is right thing to do, but
when removing QoS on virDomainUpdateDeviceFlags() this is
problematic. The new definition (passed as argument to
virDomainInterfaceClearQoS()) contains no QoS (because user
requested its removal) and thus instead of removing the old QoS
setting nothing is done.

Fortunately, the fix is simple - pass olddev which contains the
old QoS setting.

Fixes: 812a146dfe
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
This commit is contained in:
Michal Privoznik 2024-05-30 11:51:07 +02:00
parent 2ea493598f
commit 805b1eec7d

View File

@ -4071,7 +4071,7 @@ qemuDomainChangeNet(virQEMUDriver *driver,
goto cleanup; goto cleanup;
} }
} else { } else {
if (virDomainInterfaceClearQoS(vm->def, newdev) < 0) if (virDomainInterfaceClearQoS(vm->def, olddev) < 0)
goto cleanup; goto cleanup;
} }