From nobody Sun Feb 8 17:47:05 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) client-ip=8.43.85.245; envelope-from=devel-bounces@lists.libvirt.org; helo=lists.libvirt.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass(p=reject dis=none) header.from=lists.libvirt.org ARC-Seal: i=1; a=rsa-sha256; t=1770044934; cv=none; d=zohomail.com; s=zohoarc; b=ORuW2mCMSmjD3aDMtaVSqMDxUTt4YLw24S0VF9qoZ/hXekYD3SVQunje8af2Mzyry4QNk/BWNsg7YwuchMSq0hlCBpSwxpte8HP2P3B4pRN3hpuoYLr/qG+9KtasA935AwmaTqt6PVQ0eydEVOzcVp21k607n4cdZnDSzfunTLQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1770044934; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Reply-To:References:Subject:Subject:To:To:Message-Id:Cc; bh=76/wHdpCe0Xawi/xm6Cpv7UcGbliuIwFtWEjNUh06jg=; b=oGbAz4L9d5Gmb5pzRfEc3QOhox1GxX8Q2tfQgA7vZ79TqGd0lwFXON9Cbqzn7Dnbt/LzdkDmhK0LQGA2zG/iY/Wcl73hdR+piTfl4PxMxs05rXiWJHHw2bpWRYJcTEesU4ABV1KclhYSBa2/qeHAj7XBaaqkZkgJlFRAtOMg7WM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; spf=pass (zohomail.com: domain of lists.libvirt.org designates 8.43.85.245 as permitted sender) smtp.mailfrom=devel-bounces@lists.libvirt.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.libvirt.org (lists.libvirt.org [8.43.85.245]) by mx.zohomail.com with SMTPS id 1770044934802113.33191956688847; Mon, 2 Feb 2026 07:08:54 -0800 (PST) Received: by lists.libvirt.org (Postfix, from userid 993) id 94A5C43E5E; Mon, 2 Feb 2026 10:08:53 -0500 (EST) Received: from [172.19.199.6] (lists.libvirt.org [8.43.85.245]) by lists.libvirt.org (Postfix) with ESMTP id 39EC643F18; Mon, 2 Feb 2026 10:07:01 -0500 (EST) Received: by lists.libvirt.org (Postfix, from userid 993) id 25C8D41B21; Mon, 2 Feb 2026 10:06:53 -0500 (EST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (3072 bits) server-digest SHA256) (No client certificate requested) by lists.libvirt.org (Postfix) with ESMTPS id 89F3041B52 for ; Mon, 2 Feb 2026 10:06:52 -0500 (EST) Received: from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-671-iQJ5unhpNcuo9XaxuGUJFw-1; Mon, 02 Feb 2026 10:06:50 -0500 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 0C47D180035C for ; Mon, 2 Feb 2026 15:06:50 +0000 (UTC) Received: from speedmetal.lan (unknown [10.45.242.3]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 54EA018002A6 for ; Mon, 2 Feb 2026 15:06:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on lists.libvirt.org X-Spam-Level: X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED,RCVD_IN_VALIDITY_RPBL_BLOCKED, RCVD_IN_VALIDITY_SAFE_BLOCKED,SPF_PASS autolearn=unavailable autolearn_force=no version=4.0.1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1770044812; h=from:from: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; bh=76/wHdpCe0Xawi/xm6Cpv7UcGbliuIwFtWEjNUh06jg=; b=ii/H+86at+bXqFrtfabzw/tez2WCNgBLL1O//pDKGjCvqjgQPzp5NjqFfFeL1+Cv296nBk X1lXg4iM1meD75NGTY9ApNSDAi5t8uzR/ER/gEBI/dvlHG5N/3WDMUqq5DlHCKGq/J8qzh kDIK+h+9DtVLuKd0ymX+iSuUAszmltc= X-MC-Unique: iQJ5unhpNcuo9XaxuGUJFw-1 X-Mimecast-MFC-AGG-ID: iQJ5unhpNcuo9XaxuGUJFw_1770044810 To: devel@lists.libvirt.org Subject: [PATCH 1/9] qemu: Extract disk setup done via QMP into a separate helper Date: Mon, 2 Feb 2026 16:06:38 +0100 Message-ID: <99fa853e4cfffee168a9a8f81b8a2b50f87be8f3.1770044532.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: JE5Ah3cFxeK3G-CouurysrBTCBCjyeziC19Wj0WkOp0_1770044810 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Message-ID-Hash: J2KTSA7EWJXGOHAN6RIRUOYELP5UN6BP X-Message-ID-Hash: J2KTSA7EWJXGOHAN6RIRUOYELP5UN6BP X-MailFrom: pkrempa@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; header-match-devel.lists.libvirt.org-0; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Development discussions about the libvirt library & tools Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Peter Krempa via Devel Reply-To: Peter Krempa X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZM-MESSAGEID: 1770044938483158500 Content-Type: text/plain; charset="utf-8" From: Peter Krempa Introduce 'qemuProcessSetupDiskPropsRuntime' helper function which will collect all code used for runtime setup of a disk. This is currently old-style throttling. Signed-off-by: Peter Krempa --- src/qemu/qemu_hotplug.c | 23 +++++------------------ src/qemu/qemu_process.c | 37 +++++++++++++++++++++++++++---------- src/qemu/qemu_process.h | 3 +++ 3 files changed, 35 insertions(+), 28 deletions(-) diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c index f786248e70..ffd7795b66 100644 --- a/src/qemu/qemu_hotplug.c +++ b/src/qemu/qemu_hotplug.c @@ -567,13 +567,8 @@ qemuDomainChangeMediaBlockdev(virDomainObj *vm, } /* set throttling for the new image */ - if (rc =3D=3D 0 && - !virStorageSourceIsEmpty(newsrc) && - qemuDiskConfigBlkdeviotuneEnabled(disk)) { - rc =3D qemuMonitorSetBlockIoThrottle(priv->mon, - diskPriv->qomName, - &disk->blkdeviotune); - } + if (rc =3D=3D 0) + rc =3D qemuProcessSetupDiskPropsRuntime(priv->mon, disk); if (rc =3D=3D 0) rc =3D qemuMonitorBlockdevTrayClose(priv->mon, diskPriv->qomName); @@ -793,21 +788,13 @@ qemuDomainAttachDiskGeneric(virDomainObj *vm, if (rc =3D=3D 0) rc =3D qemuMonitorAddDeviceProps(priv->mon, &devprops); - /* Setup throttling of disk via block_set_io_throttle QMP command. This - * is a hack until the 'throttle' blockdev driver will support modific= ation - * of the trhottle group. See also qemuProcessSetupDiskThrottlingBlock= dev. - * As there isn't anything sane to do if this fails, let's just return - * success. - */ if (rc =3D=3D 0) { qemuDomainDiskPrivate *diskPriv =3D QEMU_DOMAIN_DISK_PRIVATE(disk); g_autoptr(GHashTable) blockinfo =3D NULL; - if (qemuDiskConfigBlkdeviotuneEnabled(disk)) { - if (qemuMonitorSetBlockIoThrottle(priv->mon, diskPriv->qomName, - &disk->blkdeviotune) < 0) - VIR_WARN("failed to set blkdeviotune for '%s' of '%s'", di= sk->dst, vm->def->name); - } + /* There isn't anything sane to do if this fails (rollback would + * require hot-unplug), let's just return success. */ + ignore_value(qemuProcessSetupDiskPropsRuntime(priv->mon, disk)); if ((blockinfo =3D qemuMonitorGetBlockInfo(priv->mon))) { struct qemuDomainDiskInfo *diskinfo; diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index c5b2a5fda8..8708c2d66b 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -7936,6 +7936,32 @@ qemuProcessGenID(virDomainObj *vm, } +/** + * qemuProcessSetupDiskPropsRuntime: + * @mon: qemu monitor object + * @disk: disk definition + * + * This function expects that caller already entered 'monitor' context. + * + * Sets up disk properties which are only possible to be set in runtime. + */ +int +qemuProcessSetupDiskPropsRuntime(qemuMonitor *mon, + virDomainDiskDef *disk) +{ + if (virStorageSourceIsEmpty(disk->src)) + return 0; + + if (qemuDiskConfigBlkdeviotuneEnabled(disk) && + qemuMonitorSetBlockIoThrottle(mon, + QEMU_DOMAIN_DISK_PRIVATE(disk)->qomN= ame, + &disk->blkdeviotune) < 0) + return -1; + + return 0; +} + + /** * qemuProcessSetupDiskThrottling: * @@ -7959,16 +7985,7 @@ qemuProcessSetupDiskThrottling(virDomainObj *vm, for (i =3D 0; i < vm->def->ndisks; i++) { virDomainDiskDef *disk =3D vm->def->disks[i]; - /* Setting throttling for empty drives fails */ - if (virStorageSourceIsEmpty(disk->src)) - continue; - - if (!qemuDiskConfigBlkdeviotuneEnabled(disk)) - continue; - - if (qemuMonitorSetBlockIoThrottle(qemuDomainGetMonitor(vm), - QEMU_DOMAIN_DISK_PRIVATE(disk)->= qomName, - &disk->blkdeviotune) < 0) + if (qemuProcessSetupDiskPropsRuntime(qemuDomainGetMonitor(vm), dis= k) < 0) goto cleanup; } diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 426e11d79e..df78b00abb 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -146,6 +146,9 @@ int qemuProcessPrepareHostStorageSourceChain(virDomainO= bj *vm, int qemuProcessPrepareHostStorageDisk(virDomainObj *vm, virDomainDiskDef *disk); +int qemuProcessSetupDiskPropsRuntime(qemuMonitor *mon, + virDomainDiskDef *disk); + int qemuProcessDeleteThreadContext(virDomainObj *vm); int qemuProcessLaunch(virConnectPtr conn, --=20 2.52.0