From 337c6eec1b15ac409aaaaa5a93f493a0bfbb95d5 Mon Sep 17 00:00:00 2001 From: Jianwei Hu Date: Mon, 11 Aug 2014 14:41:33 +0800 Subject: [PATCH] qemu: Actually clear bandwidth settings The virDomainSetInterfaceParameters implementation in qemu over VIR_DOMAIN_AFFECT_CONFIG doesn't work as expected. When trying to clear out the bandwidth settings for an interface, it has no actual effect: virsh # domiftune --config $domain $interface inbound.average: 100 inbound.peak : 0 inbound.burst : 0 outbound.average: 10 outbound.peak : 0 outbound.burst : 0 virsh domiftune --config $domain $interface 0 0 virsh # domiftune --config $domain $interface inbound.average: 100 inbound.peak : 0 inbound.burst : 0 outbound.average: 10 outbound.peak : 0 outbound.burst : 0 But according to virsh man page: To clear inbound or outbound settings, use --inbound or --outbound respectfully with average value of zero. Signed-off-by: Michal Privoznik --- src/qemu/qemu_driver.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 82a82aa1f8..2c3f179aed 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -9983,11 +9983,15 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, VIR_FREE(persistentNet->bandwidth->in); persistentNet->bandwidth->in = bandwidth->in; bandwidth->in = NULL; + } else if (inboundSpecified) { + VIR_FREE(persistentNet->bandwidth->in); } if (bandwidth->out) { VIR_FREE(persistentNet->bandwidth->out); persistentNet->bandwidth->out = bandwidth->out; bandwidth->out = NULL; + } else if (outboundSpecified) { + VIR_FREE(persistentNet->bandwidth->out); } }