|
|
43618d |
From d519f225d79a61451cfa62b463ea3083e9367353 Mon Sep 17 00:00:00 2001
|
|
|
43618d |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
43618d |
Date: Tue, 1 Oct 2013 15:04:48 +0200
|
|
|
43618d |
Subject: [PATCH] qemu_hotplug: Allow QoS update in qemuDomainChangeNet
|
|
|
43618d |
|
|
|
43618d |
The qemuDomainChangeNet() is called when 'virsh update-device' is
|
|
|
43618d |
invoked on a NIC. Currently, we fail to update the QoS even though
|
|
|
43618d |
we have routines for that.
|
|
|
43618d |
|
|
|
43618d |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
43618d |
(cherry picked from commit 9fa10d3901a14997f724fe50ad8a33d7f0d23abe)
|
|
|
43618d |
---
|
|
|
43618d |
src/qemu/qemu_hotplug.c | 19 +++++++++++++++++--
|
|
|
43618d |
1 file changed, 17 insertions(+), 2 deletions(-)
|
|
|
43618d |
|
|
|
43618d |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
43618d |
index f06930e..818c726 100644
|
|
|
43618d |
--- a/src/qemu/qemu_hotplug.c
|
|
|
43618d |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
43618d |
@@ -1799,6 +1799,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
|
|
43618d |
bool needFilterChange = false;
|
|
|
43618d |
bool needLinkStateChange = false;
|
|
|
43618d |
bool needReplaceDevDef = false;
|
|
|
43618d |
+ bool needBandwidthSet = false;
|
|
|
43618d |
int ret = -1;
|
|
|
43618d |
|
|
|
43618d |
if (!devslot || !(olddev = *devslot)) {
|
|
|
43618d |
@@ -2062,8 +2063,6 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
|
|
43618d |
virDomainNetGetActualDirectMode(olddev) != virDomainNetGetActualDirectMode(olddev) ||
|
|
|
43618d |
!virNetDevVPortProfileEqual(virDomainNetGetActualVirtPortProfile(olddev),
|
|
|
43618d |
virDomainNetGetActualVirtPortProfile(newdev)) ||
|
|
|
43618d |
- !virNetDevBandwidthEqual(virDomainNetGetActualBandwidth(olddev),
|
|
|
43618d |
- virDomainNetGetActualBandwidth(newdev)) ||
|
|
|
43618d |
!virNetDevVlanEqual(virDomainNetGetActualVlan(olddev),
|
|
|
43618d |
virDomainNetGetActualVlan(newdev))) {
|
|
|
43618d |
needReconnect = true;
|
|
|
43618d |
@@ -2072,6 +2071,10 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
|
|
43618d |
if (olddev->linkstate != newdev->linkstate)
|
|
|
43618d |
needLinkStateChange = true;
|
|
|
43618d |
|
|
|
43618d |
+ if (!virNetDevBandwidthEqual(virDomainNetGetActualBandwidth(olddev),
|
|
|
43618d |
+ virDomainNetGetActualBandwidth(newdev)))
|
|
|
43618d |
+ needBandwidthSet = true;
|
|
|
43618d |
+
|
|
|
43618d |
/* FINALLY - actually perform the required actions */
|
|
|
43618d |
|
|
|
43618d |
if (needReconnect) {
|
|
|
43618d |
@@ -2081,6 +2084,18 @@ qemuDomainChangeNet(virQEMUDriverPtr driver,
|
|
|
43618d |
goto cleanup;
|
|
|
43618d |
}
|
|
|
43618d |
|
|
|
43618d |
+ if (needBandwidthSet) {
|
|
|
43618d |
+ if (virNetDevBandwidthSet(newdev->ifname,
|
|
|
43618d |
+ virDomainNetGetActualBandwidth(newdev),
|
|
|
43618d |
+ false) < 0) {
|
|
|
43618d |
+ virReportError(VIR_ERR_INTERNAL_ERROR,
|
|
|
43618d |
+ _("cannot set bandwidth limits on %s"),
|
|
|
43618d |
+ newdev->ifname);
|
|
|
43618d |
+ goto cleanup;
|
|
|
43618d |
+ }
|
|
|
43618d |
+ needReplaceDevDef = true;
|
|
|
43618d |
+ }
|
|
|
43618d |
+
|
|
|
43618d |
if (needBridgeChange) {
|
|
|
43618d |
if (qemuDomainChangeNetBridge(dom->conn, vm, olddev, newdev) < 0)
|
|
|
43618d |
goto cleanup;
|