https://bugzilla.redhat.com/show_bug.cgi?id=1177723
If tc cmd failed (maybe value too large) when we use virDomainSetInterfaceParameters
, the old rules will be clean. Restore the old rules if tc failed.
Signed-off-by: Luyao Huang <lhuang(a)redhat.com>
---
v1 make a big mistake that i used a old libvirt
src/qemu/qemu_driver.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 73a825d..650e0dd 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -10494,8 +10494,12 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
sizeof(*newBandwidth->out));
}
- if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0)
+ if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0) {
+ ignore_value(virNetDevBandwidthSet(net->ifname,
+ net->bandwidth,
+ false));
goto endjob;
+ }
virNetDevBandwidthFree(net->bandwidth);
if (newBandwidth->in || newBandwidth->out) {