[libvirt] [PATCH] qemu: fix tc old rules will be cleaned after set tc new rules fail

Luyao Huang lhuang at redhat.com
Tue Dec 30 09:00:03 UTC 2014


https://bugzilla.redhat.com/show_bug.cgi?id=1177723

If tc cmd failed when we use qemuDomainSetInterfaceParameters, the old
rules will be clean. Restore the old rules if tc failed.

Signed-off-by: Luyao Huang <lhuang at redhat.com>
---
 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 c01da6c..810bd35 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9915,8 +9915,12 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
 
         if (virNetDevBandwidthSet(net->ifname, newBandwidth, false) < 0) {
             virReportError(VIR_ERR_INTERNAL_ERROR,
-                           _("cannot set bandwidth limits on %s"),
+                           _("cannot set bandwidth limits on %s"
+                             "- attempting to restore old settings"),
                            device);
+            ignore_value(virNetDevBandwidthSet(net->ifname,
+                                               net->bandwidth,
+                                               false));
             goto cleanup;
         }
 
-- 
1.8.3.1




More information about the libvir-list mailing list