On 10/02/2013 03:34 AM, Michal Privoznik wrote: > 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 <mprivozn@xxxxxxxxxx> > --- > src/qemu/qemu_hotplug.c | 20 ++++++++++++++++++-- > 1 file changed, 18 insertions(+), 2 deletions(-) > > diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c > index f06930e..275284d 100644 > --- a/src/qemu/qemu_hotplug.c > +++ b/src/qemu/qemu_hotplug.c > @@ -1799,6 +1799,7 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, > bool needFilterChange = false; > bool needLinkStateChange = false; > bool needReplaceDevDef = false; > + bool needBandwidthSet = false; > int ret = -1; > > if (!devslot || !(olddev = *devslot)) { > @@ -2062,8 +2063,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; > @@ -2072,6 +2071,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) { > @@ -2081,6 +2084,19 @@ 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; ACK -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list