From nobody Mon Feb 9 00:07:35 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=1628780195; cv=none; d=zohomail.com; s=zohoarc; b=Vnz+TVv2YutsqOtk4/pKkyjb39R7bWCIg7/p1SlTPamCZevyZMHspZA9Ma6B6q+fBrg43txMerOIdpHipdbuE0Uu0R7MUf/MWCruRIsqxG+bV2OWqofIOXwP0uwuquCwbWtLBCDJOv9pEmMrkLdC+mNqLfiPrVauP5DmKQ5hINU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1628780195; 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=GPwhDopBt34iVuFNd49WdkLziG92A22l+vBG8QCzZ6U=; b=k+xRE3YOqFtyFZVrrXABeAaUyetWS5OB0Ql5wKVBi6EROY3KepXlqPNt+D12kiodhp/j2gPBzwfoMykUkGQQbbG1C6gY0aSY3in9cXAaS37af8wS6sZ+r3scdrtw64cfU2IHt7be5++1qUgODsKbRtJ2ebYjpgiWDSzZOaQ9SD0= 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) 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 16287801950881015.6628135179257; Thu, 12 Aug 2021 07:56:35 -0700 (PDT) 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-89-qyRaad0vPB-1F-epuxOvXg-1; Thu, 12 Aug 2021 10:56:32 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7E5C21082922; Thu, 12 Aug 2021 14:56:26 +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 6239484621; Thu, 12 Aug 2021 14:56:26 +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 2DAD54A708; Thu, 12 Aug 2021 14:56:26 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 17CEnWfQ008468 for ; Thu, 12 Aug 2021 10:49:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6FEAD19D9F; Thu, 12 Aug 2021 14:49:32 +0000 (UTC) Received: from speedmetal.redhat.com (unknown [10.40.208.33]) by smtp.corp.redhat.com (Postfix) with ESMTP id CFC6919C44 for ; Thu, 12 Aug 2021 14:49:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1628780194; 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=GPwhDopBt34iVuFNd49WdkLziG92A22l+vBG8QCzZ6U=; b=i4aQh588M+xIoE8/LHjYD4GxIS5+IciBq0KyhGXOdyJ/nBFkwUo6kmnPM0yJff5Ww6Qq5+ gMspXA0y/J/JH2Z/mQJ6Ver4GNNzeu9PIOyCIBcCmy/Os0xyyVs+Zkzdpg6TOGStD6oRP6 6ymSZgkromD2/5GPgw1Yjmlc+rVQ5Hs= X-MC-Unique: qyRaad0vPB-1F-epuxOvXg-1 From: Peter Krempa To: libvir-list@redhat.com Subject: [PATCH 10/22] qemu: Always assume that qemu supports drive throttling Date: Thu, 12 Aug 2021 16:49:03 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 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.13 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) X-ZM-MESSAGEID: 1628780196654100001 Content-Type: text/plain; charset="utf-8" All currently supported qemu versions support all throttling capabilities. It is unlikely that any of the fields will be removed in the future and if it will we will need to do specific probing which is possible via the 'throttle' object which is the replacement for the legacy way to configure throttling. Signed-off-by: Peter Krempa --- src/qemu/qemu_driver.c | 55 +++------------------------------------- src/qemu/qemu_validate.c | 33 ++---------------------- 2 files changed, 5 insertions(+), 83 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index a7d76dd00f..fc7cbc8c86 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15928,9 +15928,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, virDomainDiskDef *conf_disk =3D NULL; virDomainDiskDef *disk; qemuBlockIoTuneSetFlags set_fields =3D 0; - bool supportMaxOptions =3D true; - bool supportGroupNameOption =3D true; - bool supportMaxLengthOptions =3D true; g_autoptr(virQEMUDriverConfig) cfg =3D NULL; virObjectEvent *event =3D NULL; virTypedParameterPtr eventParams =3D NULL; @@ -16115,40 +16112,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, virDomainBlockIoTuneInfoCopy(&info, &conf_info); if (def) { - supportMaxOptions =3D virQEMUCapsGet(priv->qemuCaps, - QEMU_CAPS_DRIVE_IOTUNE_MAX); - supportGroupNameOption =3D virQEMUCapsGet(priv->qemuCaps, - QEMU_CAPS_DRIVE_IOTUNE_GRO= UP); - supportMaxLengthOptions =3D - virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENG= TH); - - if (!supportMaxOptions && - (set_fields & (QEMU_BLOCK_IOTUNE_SET_BYTES_MAX | - QEMU_BLOCK_IOTUNE_SET_IOPS_MAX | - QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("a block I/O throttling parameter is not " - "supported with this QEMU binary")); - goto endjob; - } - - if (!supportGroupNameOption && - (set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the block I/O throttling group parameter is = not " - "supported with this QEMU binary")); - goto endjob; - } - - if (!supportMaxLengthOptions && - (set_fields & (QEMU_BLOCK_IOTUNE_SET_BYTES_MAX_LENGTH | - QEMU_BLOCK_IOTUNE_SET_IOPS_MAX_LENGTH))) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("a block I/O throttling length parameter is n= ot " - "supported with this QEMU binary")); - goto endjob; - } - if (!(disk =3D qemuDomainDiskByName(def, path))) goto endjob; @@ -16216,9 +16179,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret =3D qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, q= devid, - &info, supportMaxOptions, + &info, true, set_fields & QEMU_BLOCK_IO= TUNE_SET_GROUP_NAME, - supportMaxLengthOptions); + true); if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; if (ret < 0) @@ -16323,19 +16286,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) goto endjob; - if (def) { - /* If the VM is running, we can check if the current VM can use - * optional parameters or not. */ - maxparams =3D QEMU_NB_BLOCK_IO_TUNE_BASE_PARAMS; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) - maxparams +=3D QEMU_NB_BLOCK_IO_TUNE_MAX_PARAMS; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) - maxparams +=3D QEMU_NB_BLOCK_IO_TUNE_GROUP_PARAMS; - if (virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENG= TH)) - maxparams +=3D QEMU_NB_BLOCK_IO_TUNE_LENGTH_PARAMS; - } else { - maxparams =3D QEMU_NB_BLOCK_IO_TUNE_ALL_PARAMS; - } + maxparams =3D QEMU_NB_BLOCK_IO_TUNE_ALL_PARAMS; if (*nparams =3D=3D 0) { *nparams =3D maxparams; diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index a964c8593d..e5c4e3af26 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2876,15 +2876,13 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDo= mainDiskDef *disk, /** * qemuValidateDomainDeviceDefDiskBlkdeviotune: * @disk: disk configuration - * @qemuCaps: qemu capabilities, NULL if checking cold-configuration * * Checks whether block io tuning settings make sense. Returns -1 on error= and * reports a proper libvirt error. */ static int qemuValidateDomainDeviceDefDiskBlkdeviotune(const virDomainDiskDef *disk, - const virDomainDef *def, - virQEMUCaps *qemuCaps) + const virDomainDef *def) { /* group_name by itself is ignored by qemu */ if (disk->blkdeviotune.group_name && @@ -2936,33 +2934,6 @@ qemuValidateDomainDeviceDefDiskBlkdeviotune(const vi= rDomainDiskDef *disk, return -1; } - /* block I/O throttling 1.7 */ - if (virDomainBlockIoTuneInfoHasMax(&disk->blkdeviotune) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("there are some block I/O throttling parameters " - "that are not supported with this QEMU binary")); - return -1; - } - - /* block I/O group 2.4 */ - if (disk->blkdeviotune.group_name && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_GROUP)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("the block I/O throttling group parameter is " - "not supported with this QEMU binary")); - return -1; - } - - /* block I/O throttling length 2.6 */ - if (virDomainBlockIoTuneInfoHasMaxLength(&disk->blkdeviotune) && - !virQEMUCapsGet(qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENGTH)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("there are some block I/O throttling length param= eters " - "that are not supported with this QEMU binary")); - return -1; - } - return 0; } @@ -3052,7 +3023,7 @@ qemuValidateDomainDeviceDefDisk(const virDomainDiskDe= f *disk, if (qemuValidateDomainDeviceDefDiskFrontend(disk, def, qemuCaps) < 0) return -1; - if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def, qemuCaps) <= 0) + if (qemuValidateDomainDeviceDefDiskBlkdeviotune(disk, def) < 0) return -1; if (qemuValidateDomainDeviceDefDiskTransient(disk, qemuCaps) < 0) --=20 2.31.1