[libvirt] [PATCH] Clear bandwidth settings for a shutoff domain using domiftune

Jianwei Hu jiahu at redhat.com
Mon Aug 11 06:41:33 UTC 2014


qemu: To clear bandwidth settings for a shutoff domain by using domiftune.

After applying this patch, we can use virsh domiftune command to clear inbound
or/and outbound setting for a shutoff domain.

for example:
virsh domiftune $domain $interface 0 0

Please refer to below virsh help message:

man virsh:

To clear inbound or outbound settings, use --inbound or --outbound respectfully with average value of zero.
---
 src/qemu/qemu_driver.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index 82a82aa..7db2e9c 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -9983,11 +9983,17 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom,
                 VIR_FREE(persistentNet->bandwidth->in);
                 persistentNet->bandwidth->in = bandwidth->in;
                 bandwidth->in = NULL;
+            } else {
+                VIR_FREE(persistentNet->bandwidth->in);
+                persistentNet->bandwidth->in = 0;
             }
             if (bandwidth->out) {
                 VIR_FREE(persistentNet->bandwidth->out);
                 persistentNet->bandwidth->out = bandwidth->out;
                 bandwidth->out = NULL;
+            } else {
+                VIR_FREE(persistentNet->bandwidth->out);
+                persistentNet->bandwidth->out = 0;
             }
         }
 
-- 
1.8.3.1




More information about the libvir-list mailing list