[libvirt] [PATCH 0/2] qemu: Fix QoS for vhostuser

Setting QoS on the fly does work for vhostuser. However, it doesn't when starting a domain. So when looking into this, I realized that we should be more explicit about types of interface that do support QoS. Michal Privoznik (2): qemuDomainSetInterfaceParameters: Explicitly reject unsupported net types virNetDevSupportBandwidth: Enable QoS for vhostuser src/conf/netdev_bandwidth_conf.h | 2 +- src/qemu/qemu_driver.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) -- 2.13.6

For instance, NET_TYPE_MCAST doesn't support setting QoS. Instead of claiming success and doing nothing, we should be explicit about that and report an error. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/qemu/qemu_driver.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 32a416f9e..54a93711a 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -108,6 +108,7 @@ #include "virnuma.h" #include "dirname.h" #include "network/bridge_driver.h" +#include "netdev_bandwidth_conf.h" #define VIR_FROM_THIS VIR_FROM_QEMU @@ -11106,6 +11107,8 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, virNetDevBandwidthPtr bandwidth = NULL, newBandwidth = NULL; virQEMUDriverConfigPtr cfg = NULL; bool inboundSpecified = false, outboundSpecified = false; + int actualType; + bool qosSupported = true; virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | VIR_DOMAIN_AFFECT_CONFIG, -1); @@ -11149,6 +11152,24 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, !(persistentNet = virDomainNetFind(persistentDef, device))) goto endjob; + if (net) { + actualType = virDomainNetGetActualType(net); + qosSupported = virNetDevSupportBandwidth(actualType); + } + + if (qosSupported && persistentNet) { + actualType = virDomainNetGetActualType(persistentNet); + qosSupported = virNetDevSupportBandwidth(actualType); + } + + if (!qosSupported) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("setting bandwidth on interfaces of " + "type '%s' is not implemented yet"), + virDomainNetTypeToString(actualType)); + goto endjob; + } + if ((VIR_ALLOC(bandwidth) < 0) || (VIR_ALLOC(bandwidth->in) < 0) || (VIR_ALLOC(bandwidth->out) < 0)) -- 2.13.6

Since vhostuser type is really a tap that is just plugged into different type of bridge, supporting QoS is trivial. Signed-off-by: Michal Privoznik <mprivozn@redhat.com> --- src/conf/netdev_bandwidth_conf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf/netdev_bandwidth_conf.h b/src/conf/netdev_bandwidth_conf.h index 30f988953..c37828065 100644 --- a/src/conf/netdev_bandwidth_conf.h +++ b/src/conf/netdev_bandwidth_conf.h @@ -46,9 +46,9 @@ static inline bool virNetDevSupportBandwidth(virDomainNetType type) case VIR_DOMAIN_NET_TYPE_NETWORK: case VIR_DOMAIN_NET_TYPE_DIRECT: case VIR_DOMAIN_NET_TYPE_ETHERNET: + case VIR_DOMAIN_NET_TYPE_VHOSTUSER: return true; case VIR_DOMAIN_NET_TYPE_USER: - case VIR_DOMAIN_NET_TYPE_VHOSTUSER: case VIR_DOMAIN_NET_TYPE_SERVER: case VIR_DOMAIN_NET_TYPE_CLIENT: case VIR_DOMAIN_NET_TYPE_MCAST: -- 2.13.6

On 10/25/2017 12:48 PM, Michal Privoznik wrote:
Setting QoS on the fly does work for vhostuser. However, it doesn't when starting a domain. So when looking into this, I realized that we should be more explicit about types of interface that do support QoS.
Michal Privoznik (2): qemuDomainSetInterfaceParameters: Explicitly reject unsupported net types virNetDevSupportBandwidth: Enable QoS for vhostuser
src/conf/netdev_bandwidth_conf.h | 2 +- src/qemu/qemu_driver.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
Ping? I'd be nice to have this bug fix in the release. Michal

On Wed, Oct 25, 2017 at 12:48:08PM +0200, Michal Privoznik wrote:
Setting QoS on the fly does work for vhostuser. However, it doesn't when starting a domain. So when looking into this, I realized that we should be more explicit about types of interface that do support QoS.
ACK & SFF
Michal Privoznik (2): qemuDomainSetInterfaceParameters: Explicitly reject unsupported net types virNetDevSupportBandwidth: Enable QoS for vhostuser
src/conf/netdev_bandwidth_conf.h | 2 +- src/qemu/qemu_driver.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
-- 2.13.6
-- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On 10/30/2017 11:44 AM, Martin Kletzander wrote:
On Wed, Oct 25, 2017 at 12:48:08PM +0200, Michal Privoznik wrote:
Setting QoS on the fly does work for vhostuser. However, it doesn't when starting a domain. So when looking into this, I realized that we should be more explicit about types of interface that do support QoS.
ACK & SFF
Thanks, pushed. Michal
participants (2)
-
Martin Kletzander
-
Michal Privoznik