From 9fea9b854c82af06f17830c5e1fb585fdf78fff8 Mon Sep 17 00:00:00 2001 Message-Id: <9fea9b854c82af06f17830c5e1fb585fdf78fff8.1381871411.git.jdenemar@redhat.com> From: Michal Privoznik Date: Wed, 2 Oct 2013 11:04:08 +0200 Subject: [PATCH] qemu_hotplug: Allow QoS update in qemuDomainChangeNet https://bugzilla.redhat.com/show_bug.cgi?id=1014503 The qemuDomainChangeNet() is called when 'virsh update-device' is invoked on a NIC. Currently, we fail to update the QoS even though we have routines for that. Signed-off-by: Michal Privoznik (cherry picked from commit 9fa10d3901a14997f724fe50ad8a33d7f0d23abe) Signed-off-by: Jiri Denemark --- src/qemu/qemu_hotplug.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 83e193b..7e884c0 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1677,6 +1677,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, bool needFilterChange = false; bool needLinkStateChange = false; bool needReplaceDevDef = false; + bool needBandwidthSet = false; int ret = -1; if (!devslot || !(olddev = *devslot)) { @@ -1940,8 +1941,6 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, virDomainNetGetActualDirectMode(olddev) != virDomainNetGetActualDirectMode(olddev) || !virNetDevVPortProfileEqual(virDomainNetGetActualVirtPortProfile(olddev), virDomainNetGetActualVirtPortProfile(newdev)) || - !virNetDevBandwidthEqual(virDomainNetGetActualBandwidth(olddev), - virDomainNetGetActualBandwidth(newdev)) || !virNetDevVlanEqual(virDomainNetGetActualVlan(olddev), virDomainNetGetActualVlan(newdev))) { needReconnect = true; @@ -1950,6 +1949,10 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, if (olddev->linkstate != newdev->linkstate) needLinkStateChange = true; + if (!virNetDevBandwidthEqual(virDomainNetGetActualBandwidth(olddev), + virDomainNetGetActualBandwidth(newdev))) + needBandwidthSet = true; + /* FINALLY - actually perform the required actions */ if (needReconnect) { @@ -1959,6 +1962,18 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, goto cleanup; } + if (needBandwidthSet) { + if (virNetDevBandwidthSet(newdev->ifname, + virDomainNetGetActualBandwidth(newdev), + false) < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("cannot set bandwidth limits on %s"), + newdev->ifname); + goto cleanup; + } + needReplaceDevDef = true; + } + if (needBridgeChange) { if (qemuDomainChangeNetBridge(dom->conn, vm, olddev, newdev) < 0) goto cleanup; -- 1.8.3.2