From nobody Sat Feb 7 13:59:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607087511; cv=none; d=zohomail.com; s=zohoarc; b=Dss6fbwNXCnvdxhuSkox4GtmOOd7YYc4mt3WmDtf7NffNFvjzCE7nKMsSW0w0XRm3upgOKH4Sjs/eh3nn1XKwtNECz9LFNx3HfKMok22eFprVeXn1yeHbnpxVwfRU1yAb4o1u/LOydiA/zTLXKRXHaozgazvn/3mfHPcrak1rUI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607087511; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=obB9pUdEd/LEQhGHUmRQRoJf7NIRpVcLUPNjEgOEnlM=; b=EsNoF/JsUz990LpAd+Ky3PkCnX2oWvZACwyu7msX7Xzp7GrupUgYMoY/En+1dAzluWRPvsjtb6/ZKIpVX5Dxwm5EjoSfESMSKbAeFy1tfHMjqjm0j+J+Nhm1nKmbkmvQP8arZ1EzTxwd2VnWQ4K7wWr2QnH7ctAwSdSMbB/8mVA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607087510865890.1370149170499; Fri, 4 Dec 2020 05:11:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-51-DiHaQkIJMUe2-mQnIlgL3A-1; Fri, 04 Dec 2020 08:11:41 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6EB60802B47; Fri, 4 Dec 2020 13:11:35 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D4375D6CF; Fri, 4 Dec 2020 13:11:35 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D46944A7C6; Fri, 4 Dec 2020 13:11:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4DBY0Z018020 for ; Fri, 4 Dec 2020 08:11:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id 10EB1189A5; Fri, 4 Dec 2020 13:11:34 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 875F5620D7 for ; Fri, 4 Dec 2020 13:11:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607087504; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=obB9pUdEd/LEQhGHUmRQRoJf7NIRpVcLUPNjEgOEnlM=; b=dZ0lJgCw0C0ai5ghiNKQkfUT8nn6r61XMFF4fcEg/wQ1PY69lGJjxb/E6YGK8cmlYZn29C 4vrUqAGAXma0eEL1/nozbwfSEmrVT2xGt9tprVZb8kWdWGTbCvgmeD+/ibBZ9y5YJsEh1N hfP/48khkSwaEf66BVNySb+UyRPJWUI= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607087506; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=obB9pUdEd/LEQhGHUmRQRoJf7NIRpVcLUPNjEgOEnlM=; b=X+EpI7nt2MaAp6fqmhxVONVZ0rz4wyG8YyyiYoAMu5b9Sqa3dcHYwxksWeEhSxWKCyDPsx M2auP0Cuf/28PVfnYkkKksha4LSxNvQFxEVc1Qva2aWa3m1XwRxabXJFJ7YsER/q0a25sk nhh5z74e9nWzIRrT/Pg/jV+PPUE0uPY= X-MC-Unique: DiHaQkIJMUe2-mQnIlgL3A-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/2] qemu: Set default qdisc before setting bandwidth Date: Fri, 4 Dec 2020 14:11:23 +0100 Message-Id: <3c480620292cf680e9175208c5ec4ec5ac638ed3.1607087441.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) (identity @redhat.com) Content-Type: text/plain; charset="utf-8" While the code that's setting default qdisc is clever enough to not overwrite any bandwidth (potentially) set by virNetDevBandwidthSet() (and thus the root qdisc htb is not replaced with noqueue), it does print a debug message when that's the case. It's needless. We can set the root qdisc beforehand and let virNetDevBandwidthSet() overwrite it. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_command.c | 4 ++-- src/qemu/qemu_hotplug.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 5aff89188a..ece7f6a4d3 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -8127,6 +8127,8 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, break; } =20 + qemuDomainInterfaceSetDefaultQDisc(driver, net); + /* Set bandwidth or warn if requested and not supported. */ actualBandwidth =3D virDomainNetGetActualBandwidth(net); if (actualBandwidth) { @@ -8141,8 +8143,6 @@ qemuBuildInterfaceCommandLine(virQEMUDriverPtr driver, } } =20 - qemuDomainInterfaceSetDefaultQDisc(driver, net); - if (net->mtu && virNetDevSetMTU(net->ifname, net->mtu) < 0) goto cleanup; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 2c12ef60af..235e9e177a 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -1361,6 +1361,8 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, if (qemuInterfaceStartDevice(net) < 0) goto cleanup; =20 + qemuDomainInterfaceSetDefaultQDisc(driver, net); + /* Set bandwidth or warn if requested and not supported. */ actualBandwidth =3D virDomainNetGetActualBandwidth(net); if (actualBandwidth) { @@ -1379,8 +1381,6 @@ qemuDomainAttachNetDevice(virQEMUDriverPtr driver, virNetDevSetMTU(net->ifname, net->mtu) < 0) goto cleanup; =20 - qemuDomainInterfaceSetDefaultQDisc(driver, net); - for (i =3D 0; i < tapfdSize; i++) { if (qemuSecuritySetTapFDLabel(driver->securityManager, vm->def, tapfd[i]) < 0) --=20 2.26.2 From nobody Sat Feb 7 13:59:14 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1607087508; cv=none; d=zohomail.com; s=zohoarc; b=XMlH9NpQJ5FzjuoeXSuj262/FpxvBehXHfn8XhYhdgyJMXJHgFOtskD2zuAL/PV2WSYEun40x7rAalBFtKoBhjX+7eu+dCnfJhP8Z3D3aLIHpqomyd9ixK4S6QcL74f0N/nPrwGU0Tcp3GsDSExufleXAXDdQ+eKvKz33J3QFFI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607087508; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=nMenvdbjhqDW75Sr+MUu2AXHaPsfRUAQmGlVhxMxuZY=; b=JwEEiDbV21qMKUbvJttmjRdToLSD+UjyLhDejlq1oyavKscRRWv1zSk9nP3J1W8gdo7ToAEU9H44M3wMj+9QsGYPUWhy23H8RTqdiO4rDE7Qf+gEIP/92/Uq4a/+a+xnf25vEvPMJgF4ZhF7bbyQE5tIhyo1He9lT2WGLycNeGE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1607087508621267.7892057879253; Fri, 4 Dec 2020 05:11:48 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-505--AEfA53mPcuQyI_54D7dew-1; Fri, 04 Dec 2020 08:11:42 -0500 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D974C8049C3; Fri, 4 Dec 2020 13:11:36 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B269910016FA; Fri, 4 Dec 2020 13:11:36 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7C03E4E58E; Fri, 4 Dec 2020 13:11:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 0B4DBYKV018032 for ; Fri, 4 Dec 2020 08:11:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id E0FA8189A5; Fri, 4 Dec 2020 13:11:34 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.194.49]) by smtp.corp.redhat.com (Postfix) with ESMTP id 628CF18AD6 for ; Fri, 4 Dec 2020 13:11:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607087506; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=nMenvdbjhqDW75Sr+MUu2AXHaPsfRUAQmGlVhxMxuZY=; b=XP291sunad5MjXhxzt80sy7TNXqf0Q0zl8PuIMpdtp+ZweSiGZQJAMJ1X3MXSF9UaNEec4 F5L43rf/ZjSGBR+sIo0P8hR2aMIjnSwpBzoGwWMii6ykP8kGo7xixRGWxartACsXii2taF ZWsgQYu+/Nl3r2Iff8iDGMbKJRuwD2E= X-MC-Unique: -AEfA53mPcuQyI_54D7dew-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/2] qemu: Restore default root qdisc when QoS is cleared out Date: Fri, 4 Dec 2020 14:11:24 +0100 Message-Id: <79d567db1743e08e1ed40dbf483b9b3cc75479a5.1607087441.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When an interface has some bandwidth limitation set (it's root qdisc is htb in that case) but this gets cleared out via public API call (virDomainSetInterfaceParameters() or virDomainUpdateDeviceFlags()) then virNetDevBandwidthSet() clears out whatever qdiscs were set on the interface and kernel places the default qdisc at the root. What we need to do next is to replace the root qdisc with the one we want. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1329644 Fixes: 0b66196d86ea375234cb0ee99289c486f9921820 Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- src/qemu/qemu_driver.c | 9 +++++++++ src/qemu/qemu_hotplug.c | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 4fd70ed300..6eca2645de 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -10358,6 +10358,15 @@ qemuDomainSetInterfaceParameters(virDomainPtr dom, goto endjob; } =20 + /* If the old bandwidth was cleared out, restore qdisc. */ + if (virDomainNetTypeSharesHostView(net)) { + if (!newBandwidth->out || newBandwidth->out->average =3D=3D 0) + qemuDomainInterfaceSetDefaultQDisc(driver, net); + } else { + if (!newBandwidth->in || newBandwidth->in->average =3D=3D 0) + qemuDomainInterfaceSetDefaultQDisc(driver, net); + } + virNetDevBandwidthFree(net->bandwidth); if (newBandwidth->in || newBandwidth->out) { net->bandwidth =3D newBandwidth; diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index 235e9e177a..3aa6fb8a27 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -3871,6 +3871,15 @@ qemuDomainChangeNet(virQEMUDriverPtr driver, */ virNetDevBandwidthClear(newdev->ifname); } + + /* If the old bandwidth was cleared out, restore qdisc. */ + if (virDomainNetTypeSharesHostView(newdev)) { + if (!newb->out || newb->out->average =3D=3D 0) + qemuDomainInterfaceSetDefaultQDisc(driver, newdev); + } else { + if (!newb->in || newb->in->average =3D=3D 0) + qemuDomainInterfaceSetDefaultQDisc(driver, newdev); + } needReplaceDevDef =3D true; } =20 --=20 2.26.2