From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610358781; cv=none; d=zohomail.com; s=zohoarc; b=GrSN+Okcp6oZX9FCBuzMmw59cZmGMqdBDbrAeOdNG80xfHhnsLLRblq/rbYhdr9cH/qGBBzeNl0xzF3bbbvSQiMHjrPqvwWDtcF9Mb9nqGqRVi8EsdY7hLp0umr9FndSnuf9X8eL+RfxRipyAEdWttRrsYBSccmj+NqIYOOcW8o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610358781; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=rLDY/TH0TJyjcfWRPijBqX6a6LERPaGRPjsr8ceobY0=; b=E0jIbbrYnVrM3NefBLhQxUw4rqrOft0ZhpFlEAbIV5FMuoXBW3uQHuVN/7sDCLf8arNBCvBX0Pa+heP4QISRl8ylNtDHcLuETkDbfPoHuBpCAs2BmWOgYQNPNIm1RSCl2tsECbBC3PnfUOhzZFwDpcAh3477ueGqL9cKYyYLDrI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 161035878130167.90939923587189; Mon, 11 Jan 2021 01:53:01 -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-329-ffolUScyPEON-uf-hfTzLg-1; Mon, 11 Jan 2021 04:52:58 -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 EE2208144E6; Mon, 11 Jan 2021 09:52:51 +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 C89A46A900; Mon, 11 Jan 2021 09:52:51 +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 914D44BB7B; Mon, 11 Jan 2021 09:52:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9qniK014435 for ; Mon, 11 Jan 2021 04:52:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5667F2026D5D; Mon, 11 Jan 2021 09:52:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 51F4D2026D49 for ; Mon, 11 Jan 2021 09:52:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 28C488008A5 for ; Mon, 11 Jan 2021 09:52:46 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-545-OR-TWQBvNXayv_cRKwVvcQ-1; Mon, 11 Jan 2021 04:52:43 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytrL-00GBOE-H3 for libvir-list@redhat.com; Mon, 11 Jan 2021 12:51:35 +0300 X-MC-Unique: ffolUScyPEON-uf-hfTzLg-1 X-MC-Unique: OR-TWQBvNXayv_cRKwVvcQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 01/23] qemu: pass supportGroupNameOption as expected Date: Mon, 11 Jan 2021 12:49:54 +0300 Message-Id: <1610358616-567804-2-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" supportGroupNameOption was originally passed before the below patch. To sol= ve the issue of that patch this change is not necessary and it make sense to pass supportGroupNameOption because of qemuMonitorSetBlockIoThrottle signature. With patch group_name is passed to qemu if disk in iotune group but group is not passed explicitly in parametes. For qemu it does not make a differen= ce. I'm preparing here for the next patch where another usage of supportGroupNameOption will gone and instead of deleting supportGroupNameOp= tion variable altogether I guess it is better to restore it's proper usage. commit e9d75343d4cf552575a3b305fa00a36ee71e9309 Author: Martin Kletzander Date: Tue Jan 24 15:50:00 2017 +0100 qemu: Only set group_name when actually requested Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 027617d..b7f22c2 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16310,7 +16310,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, qemuDomainObjEnterMonitor(driver, vm); ret =3D qemuMonitorSetBlockIoThrottle(priv->mon, drivealias, q= devid, &info, supportMaxOptions, - set_fields & QEMU_BLOCK_IO= TUNE_SET_GROUP_NAME, + supportGroupNameOption, supportMaxLengthOptions); if (qemuDomainObjExitMonitor(driver, vm) < 0) ret =3D -1; --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610358840; cv=none; d=zohomail.com; s=zohoarc; b=FgeH/w+1hhX2s1/ufwGmEj4A/krIyBUD03gOOK0lEuy1x2Rl8DjH7Gy/8AHrvkc/ZZ4K8r+S2BLVf9Fn65plHwVV+4ydrGz/4LzbvvO40TzoPKJtreSiyxOnLRxLegSZ31O/TZ7gd1q47l902he1d6H/xKh2c2EdPGsHx2l8ND4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610358840; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=ILn5/LlgXa+IDtmqm4BT5eO3kBoNlYd2x1TJHD+0Q/c=; b=W/+GuNrmRLFKfsPledg9dCXFLBJCbdzQKAyyLQ1JVfdCxGvDmY6KeffrzEmuW07juMSJqiPKYsc2+XlK/gJwoOXEliREh5ycfBbOmLpjD04KNch+vPa4gxfJ0tued0D5Y1sCNPe+pMslO8FzbWvpZCq7tFdPCQzLWh+YYUO+Xlg= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610358840294546.4788698991365; Mon, 11 Jan 2021 01:54:00 -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-1-gh0m1D9-PPOuiVYi7LCdPA-1; Mon, 11 Jan 2021 04:53:56 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 828FA1015C81; Mon, 11 Jan 2021 09:53:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 616E760C87; Mon, 11 Jan 2021 09:53:50 +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 2A4A6180954D; Mon, 11 Jan 2021 09:53:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9rnlF014529 for ; Mon, 11 Jan 2021 04:53:49 -0500 Received: by smtp.corp.redhat.com (Postfix) id 16B0B112D439; Mon, 11 Jan 2021 09:53:49 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast05.extmail.prod.ext.rdu2.redhat.com [10.11.55.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 12FAE112D435 for ; Mon, 11 Jan 2021 09:53:46 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AA540803DCE for ; Mon, 11 Jan 2021 09:53:46 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-268-dpxkPC6TNcO144tUF7Cgqw-1; Mon, 11 Jan 2021 04:53:43 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytsI-00GBOE-TF for libvir-list@redhat.com; Mon, 11 Jan 2021 12:52:34 +0300 X-MC-Unique: gh0m1D9-PPOuiVYi7LCdPA-1 X-MC-Unique: dpxkPC6TNcO144tUF7Cgqw-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 02/23] qemu: factor out qemuValidateDomainBlkdeviotune Date: Mon, 11 Jan 2021 12:49:55 +0300 Message-Id: <1610358616-567804-3-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It can also be used for validation of input in qemuDomainSetBlockIoTune. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_validate.c | 100 ++++++++++++++++++++++++++-----------------= ---- src/qemu/qemu_validate.h | 4 ++ 2 files changed, 60 insertions(+), 44 deletions(-) diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c index eadf3af..6a27565 100644 --- a/src/qemu/qemu_validate.c +++ b/src/qemu/qemu_validate.c @@ -2696,6 +2696,61 @@ qemuValidateDomainDeviceDefDiskFrontend(const virDom= ainDiskDef *disk, } =20 =20 +int +qemuValidateDomainBlkdeviotune(const virDomainBlockIoTuneInfo *iotune, + virQEMUCapsPtr qemuCaps) +{ + if (iotune->total_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || + iotune->read_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || + iotune->write_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || + iotune->total_iops_sec > QEMU_BLOCK_IOTUNE_MAX || + iotune->read_iops_sec > QEMU_BLOCK_IOTUNE_MAX || + iotune->write_iops_sec > QEMU_BLOCK_IOTUNE_MAX || + iotune->total_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || + iotune->read_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || + iotune->write_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || + iotune->total_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || + iotune->read_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || + iotune->write_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || + iotune->size_iops_sec > QEMU_BLOCK_IOTUNE_MAX) { + virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, + _("block I/O throttle limit must " + "be no more than %llu using QEMU"), + QEMU_BLOCK_IOTUNE_MAX); + return -1; + } + + /* block I/O throttling 1.7 */ + if (virDomainBlockIoTuneInfoHasMax(iotune) && + !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 (iotune->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(iotune) && + !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; +} + + /** * qemuValidateDomainDeviceDefDiskBlkdeviotune: * @disk: disk configuration @@ -2740,51 +2795,8 @@ qemuValidateDomainDeviceDefDiskBlkdeviotune(const vi= rDomainDiskDef *disk, } } =20 - if (disk->blkdeviotune.total_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_bytes_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.total_iops_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_iops_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_iops_sec > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.total_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_bytes_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.total_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.read_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.write_iops_sec_max > QEMU_BLOCK_IOTUNE_MAX || - disk->blkdeviotune.size_iops_sec > QEMU_BLOCK_IOTUNE_MAX) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, - _("block I/O throttle limit must " - "be no more than %llu using QEMU"), QEMU_BLOCK_IOT= UNE_MAX); - 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")); + if (qemuValidateDomainBlkdeviotune(&disk->blkdeviotune, qemuCaps) < 0) 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; - } =20 return 0; } diff --git a/src/qemu/qemu_validate.h b/src/qemu/qemu_validate.h index b6c5441..21e7986 100644 --- a/src/qemu/qemu_validate.h +++ b/src/qemu/qemu_validate.h @@ -26,6 +26,10 @@ #include "qemu_capabilities.h" #include "qemu_conf.h" =20 +int +qemuValidateDomainBlkdeviotune(const virDomainBlockIoTuneInfo *iotune, + virQEMUCapsPtr qemuCaps); + int qemuValidateDomainDef(const virDomainDef *def, void *opaque, void *parseOpaque); --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610358898; cv=none; d=zohomail.com; s=zohoarc; b=D/jngnjNoYLPsh+gSB2gNdQ/nB1ur7YvgGb+IubUN3mIPJdTtSy+CLCNNdm7U35W9vRgkEGNd0YbkvBzAPL1rt1Delp/uWyBx3CV3eVWkhTp+ChfH/sgAaH4VK2O6IY7G9uNGlvBEQovNflX0pei0l3x82PEf8LeB1ZoEAatuiM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610358898; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YL6PMvvFO15teL8BDhEoNfhRJXEWo0xY07dhU24qIjY=; b=R2gE23IRe76GHRVKJLjWV1hbYyYY2Z1q5YQujJHlk26yKQVP7P94ai+o0utrnDS8wiPeEdffoOGfjhBju9qv3h8NQncGmbSRuzWcV100UwHHnqaRN9kvgHtr/n+VuPLYWZ7rIkXsCxwUOY87+EcK8PVfXSXgXFN/DZ7D6SKVkT4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610358898781320.80879278090913; Mon, 11 Jan 2021 01:54:58 -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-313-dUc6tyR3Nv2OSYYRmaL4Dw-1; Mon, 11 Jan 2021 04:54:55 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E22E4612B0; Mon, 11 Jan 2021 09:54:49 +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 BF8DF5D9F4; Mon, 11 Jan 2021 09:54:49 +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 7DCB94BB7B; Mon, 11 Jan 2021 09:54:49 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9sm46014622 for ; Mon, 11 Jan 2021 04:54:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id 3FC1A2026D76; Mon, 11 Jan 2021 09:54:48 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BDFE2026D49 for ; Mon, 11 Jan 2021 09:54:45 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E79BB811E76 for ; Mon, 11 Jan 2021 09:54:44 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-260-phODWeJkMGCh4YtsGMz9tw-1; Mon, 11 Jan 2021 04:54:42 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyttG-00GBOE-4q for libvir-list@redhat.com; Mon, 11 Jan 2021 12:53:34 +0300 X-MC-Unique: dUc6tyR3Nv2OSYYRmaL4Dw-1 X-MC-Unique: phODWeJkMGCh4YtsGMz9tw-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 03/23] qemu: reuse validation in qemuDomainSetBlockIoTune Date: Mon, 11 Jan 2021 12:49:56 +0300 Message-Id: <1610358616-567804-4-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" There is a little difference though in removed and reused code in qemuDomainSetBlockIoTune. First, removed code checked 'set_fields' instead of tune itself. set_fields= is true whenever corresponding virDomainBlockIoTuneInfoHas* it true. But additionnaly it is true when 0 values are passed explicitly. So removed code also failed if reset value is passed and qemu does not support the resetted field. I guess this is not very useful check and can be dropped as result of this patch. If field is not supported then it is reported as 0 and resettin= g it to 0 is just NOP. Second, check for QEMU_BLOCK_IOTUNE_MAX is added but it is alredy checked above and I'm going to remove the above check. Third, now check of qemuDomainSetBlockIoTune is done also if changing only persistent config is requested. It is good because otherwise we will create invalid config which can not be created thru define API due to existing qemu validation code. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index b7f22c2..7337464 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -53,6 +53,7 @@ #include "qemu_namespace.h" #include "qemu_saveimage.h" #include "qemu_snapshot.h" +#include "qemu_validate.h" =20 #include "virerror.h" #include "virlog.h" @@ -16210,6 +16211,9 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, =20 virDomainBlockIoTuneInfoCopy(&info, &conf_info); =20 + if (qemuValidateDomainBlkdeviotune(&info, priv->qemuCaps) < 0) + goto endjob; + if (def) { supportMaxOptions =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX); @@ -16218,33 +16222,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, supportMaxLengthOptions =3D virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_DRIVE_IOTUNE_MAX_LENG= TH); =20 - 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; =20 --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610358959; cv=none; d=zohomail.com; s=zohoarc; b=gQKe+2xhJ/B2INZVK3eVdkXHAHBKKf06ryZAIuBRsobOPOlxpYBLA3Jty3e4D5qEyaBDQVsbnz2xg6+ZjUKnxVMKSrJfbNGlIhOK34yJVo3d529Y6d4IvL/S+EzbhRhiiVPQH2+32FjuXY4SiCrNImlVnzO0etSBjm/wvHmf/Vs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610358959; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=D8tTWOMJzAFMP18MWzxGFfailzi01mIm9LoAbwENEzU=; b=bzTbhYV2DBQuJ1sINQvOHfrVHOihmfVM6m0ujMYmhHBczdrirr2CgBr1LKHsZZ0A2GuOxccUq1lMKUfgUiva4nTRUR7e86m2fnNjXj4Q5rGecRnHF55n1gQIssG/HSA/EWg+8zo3ucvx3gwBIyX53b3tENspLWVEY32q0rcoN5g= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610358959260132.53593040721285; Mon, 11 Jan 2021 01:55:59 -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-42-m4IAilIKP5OtWEwHoM8sGw-1; Mon, 11 Jan 2021 04:55:55 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 860CF180A086; Mon, 11 Jan 2021 09:55:50 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 63C8E74449; Mon, 11 Jan 2021 09:55:50 +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 2B684180954D; Mon, 11 Jan 2021 09:55:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9tl0N014693 for ; Mon, 11 Jan 2021 04:55:48 -0500 Received: by smtp.corp.redhat.com (Postfix) id C529C2026D49; Mon, 11 Jan 2021 09:55:47 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C08132026D5D for ; Mon, 11 Jan 2021 09:55:44 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4C04A186E120 for ; Mon, 11 Jan 2021 09:55:44 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-257-YhJF9BEwOF2-qul8J4EM9A-1; Mon, 11 Jan 2021 04:55:41 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytuD-00GBOE-JK for libvir-list@redhat.com; Mon, 11 Jan 2021 12:54:33 +0300 X-MC-Unique: m4IAilIKP5OtWEwHoM8sGw-1 X-MC-Unique: YhJF9BEwOF2-qul8J4EM9A-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 04/23] qemu: remove extra check for QEMU_BLOCK_IOTUNE_MAX Date: Mon, 11 Jan 2021 12:49:57 +0300 Message-Id: <1610358616-567804-5-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is checked in below call to qemuValidateDomainBlkdeviotune now. Note t= hat qemuValidateDomainBlkdeviotune does not check *_max_length values as we do here. But I guess this is for good. I tried setting high _max_lengh values = and looks like their limits depend on *_max values and much less then 1000000000000000LL. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 7337464..984b45d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16121,13 +16121,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, for (i =3D 0; i < nparams; i++) { virTypedParameterPtr param =3D ¶ms[i]; =20 - if (param->value.ul > QEMU_BLOCK_IOTUNE_MAX) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, - _("block I/O throttle limit value must" - " be no more than %llu"), QEMU_BLOCK_IOTUNE_M= AX); - goto endjob; - } - SET_IOTUNE_FIELD(total_bytes_sec, BYTES, TOTAL_BYTES_SEC); SET_IOTUNE_FIELD(read_bytes_sec, BYTES, READ_BYTES_SEC); SET_IOTUNE_FIELD(write_bytes_sec, BYTES, WRITE_BYTES_SEC); --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359018; cv=none; d=zohomail.com; s=zohoarc; b=lXmIdUS3sXmYcEmovTXVek7olHvhc36fo7U+2Z3rfFNsqC0JB9qOJSNpEnlx2S3Gunq4OE7ITCKNjAd5Vtux3002sSgSvJmzo9UJKjGrn3K+tOG5pLeh+bdLHbi+rlJyT3YqEq3r8v0J72JCLmzbD+wE9ovf0iEqC4KcynAhwnQ= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359018; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=fMHv8OX1Q5YtrW3TCjwGvWPIcceFxj3gRI721iQyF68=; b=ZOWjtbiAhpmtJ9Dmr7OustUP29AMW7jR/bZB/14FizfWY7q0A9e308MZ6JPrMIYGnNWExUjS/7v7sAMjFtiy6oU04y9XJB4DqviIdQL8cEQpOVaKkmapLTc+jKjQghkR6AA427Ca8OlOzm8xcQir/hmZWWSamq2uxZxJ11p/XY8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 161035901877813.359868209946399; Mon, 11 Jan 2021 01:56:58 -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-429-LD73IvKqPgCMh1HE6BHqQg-1; Mon, 11 Jan 2021 04:56:55 -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 10FE2612A5; Mon, 11 Jan 2021 09:56:49 +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 E9F642C315; Mon, 11 Jan 2021 09:56:47 +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 21EF04BB7B; Mon, 11 Jan 2021 09:56:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9ujPK014773 for ; Mon, 11 Jan 2021 04:56:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id B264F9D46D; Mon, 11 Jan 2021 09:56:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD25B1C5BB for ; Mon, 11 Jan 2021 09:56:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 89ADB811E76 for ; Mon, 11 Jan 2021 09:56:43 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-23-ZNQt-gApOwG-aULHnWG98g-1; Mon, 11 Jan 2021 04:56:41 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytvA-00GBOE-T7 for libvir-list@redhat.com; Mon, 11 Jan 2021 12:55:32 +0300 X-MC-Unique: LD73IvKqPgCMh1HE6BHqQg-1 X-MC-Unique: ZNQt-gApOwG-aULHnWG98g-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 05/23] conf: factor out virDomainBlockIoTuneValidate Date: Mon, 11 Jan 2021 12:49:58 +0300 Message-Id: <1610358616-567804-6-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" virDomainBlockIoTuneValidate can be reused in virDomainSetBlockIoTune implementations. And also simplify if conditions. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/conf/domain_conf.c | 78 +++++++++++++++++++++++++-------------------= ---- src/conf/domain_conf.h | 3 ++ src/libvirt_private.syms | 1 + 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 349fc28..173424a 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8627,6 +8627,45 @@ virDomainDiskBackingStoreParse(xmlXPathContextPtr ct= xt, return 0; } =20 + +int +virDomainBlockIoTuneValidate(virDomainBlockIoTuneInfoPtr iotune) +{ + if (iotune->total_bytes_sec && + (iotune->read_bytes_sec || iotune->write_bytes_sec)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("total and read/write bytes_sec " + "cannot be set at the same time")); + return -1; + } + + if (iotune->total_iops_sec && + (iotune->read_iops_sec || iotune->write_iops_sec)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("total and read/write iops_sec " + "cannot be set at the same time")); + return -1; + } + + if (iotune->total_bytes_sec_max && + (iotune->read_bytes_sec_max || iotune->write_bytes_sec_max)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("total and read/write bytes_sec_max " + "cannot be set at the same time")); + return -1; + } + + if (iotune->total_iops_sec_max && + (iotune->read_iops_sec_max || iotune->write_iops_sec_max)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("total and read/write iops_sec_max " + "cannot be set at the same time")); + return -1; + } + + return 0; +} + #define PARSE_IOTUNE(val) \ if (virXPathULongLong("string(./iotune/" #val ")", \ ctxt, &def->blkdeviotune.val) =3D=3D -2) { \ @@ -8665,45 +8704,8 @@ virDomainDiskDefIotuneParse(virDomainDiskDefPtr def, def->blkdeviotune.group_name =3D virXPathString("string(./iotune/group_name)", ctxt); =20 - if ((def->blkdeviotune.total_bytes_sec && - def->blkdeviotune.read_bytes_sec) || - (def->blkdeviotune.total_bytes_sec && - def->blkdeviotune.write_bytes_sec)) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("total and read/write bytes_sec " - "cannot be set at the same time")); - return -1; - } - - if ((def->blkdeviotune.total_iops_sec && - def->blkdeviotune.read_iops_sec) || - (def->blkdeviotune.total_iops_sec && - def->blkdeviotune.write_iops_sec)) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("total and read/write iops_sec " - "cannot be set at the same time")); - return -1; - } - - if ((def->blkdeviotune.total_bytes_sec_max && - def->blkdeviotune.read_bytes_sec_max) || - (def->blkdeviotune.total_bytes_sec_max && - def->blkdeviotune.write_bytes_sec_max)) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("total and read/write bytes_sec_max " - "cannot be set at the same time")); + if (virDomainBlockIoTuneValidate(&def->blkdeviotune) < 0) return -1; - } - - if ((def->blkdeviotune.total_iops_sec_max && - def->blkdeviotune.read_iops_sec_max) || - (def->blkdeviotune.total_iops_sec_max && - def->blkdeviotune.write_iops_sec_max)) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("total and read/write iops_sec_max " - "cannot be set at the same time")); - return -1; - } =20 return 0; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index ec43bbe..3c42313 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3963,3 +3963,6 @@ virHostdevIsMdevDevice(const virDomainHostdevDef *hos= tdev) bool virHostdevIsVFIODevice(const virDomainHostdevDef *hostdev) ATTRIBUTE_NONNULL(1); + +int +virDomainBlockIoTuneValidate(virDomainBlockIoTuneInfoPtr iotune); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c325040..bfe3ee7 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -236,6 +236,7 @@ virDomainBlockIoTuneInfoHasAny; virDomainBlockIoTuneInfoHasBasic; virDomainBlockIoTuneInfoHasMax; virDomainBlockIoTuneInfoHasMaxLength; +virDomainBlockIoTuneValidate; virDomainBootTypeFromString; virDomainBootTypeToString; virDomainCapabilitiesPolicyTypeToString; --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359078; cv=none; d=zohomail.com; s=zohoarc; b=B89B7br7VQNpWI61RQHHXznDQJ56toqPX6aw3Nalzzi56T7GBJRCZ6z/+KLTUIODS8uGQ9kwam3qXiZDTSeRr39wD3BS8az4mKyAqjHzL0RkPBpE+uZCt+SeeKROGgi/b2hYHAe/UM5F5xah5KocqUop2AnDaIOU7Rt62gann1A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359078; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=5KCVxMUh1gcJmjOCSIAM+VhDhMryXMRpurBMJBxxKlU=; b=aLQnz/2XEEW70DJSQFsz+GZz5z1QmQQnf2M8b62jx4JNmkFbaa5NuheoP0h6zQWCzfumFSO1r3pti/+Q3VL8d6cgqQAh9I894mtzeV/p8nyg9nXv9rJMnvUHEQrVZMqhE1LtT6OzCrQo1DHwXqwce1bcRIUBBQPUGBkNs8ZxDY8= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161035907818347.91838761984354; Mon, 11 Jan 2021 01:57:58 -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-80-1sHZTNLDOQmdFG9ohRFe_g-1; Mon, 11 Jan 2021 04:57:53 -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 937DF180E469; Mon, 11 Jan 2021 09:57:48 +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 6A32F6A8FE; Mon, 11 Jan 2021 09:57:48 +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 2D79D5002D; Mon, 11 Jan 2021 09:57:48 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9vkGu015024 for ; Mon, 11 Jan 2021 04:57:46 -0500 Received: by smtp.corp.redhat.com (Postfix) id AA4442166B28; Mon, 11 Jan 2021 09:57:46 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A530E2166B2D for ; Mon, 11 Jan 2021 09:57:43 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 16381101A564 for ; Mon, 11 Jan 2021 09:57:43 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-473-_2WSC-VSPNiQ3cgSE6xenQ-1; Mon, 11 Jan 2021 04:57:40 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytw8-00GBOE-A8 for libvir-list@redhat.com; Mon, 11 Jan 2021 12:56:32 +0300 X-MC-Unique: 1sHZTNLDOQmdFG9ohRFe_g-1 X-MC-Unique: _2WSC-VSPNiQ3cgSE6xenQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 06/23] qemu: reuse virDomainBlockIoTuneValidate Date: Mon, 11 Jan 2021 12:49:59 +0300 Message-Id: <1610358616-567804-7-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 31 +------------------------------ 1 file changed, 1 insertion(+), 30 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 984b45d..117c7b7 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16170,37 +16170,8 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, =20 #undef SET_IOTUNE_FIELD =20 - if ((info.total_bytes_sec && info.read_bytes_sec) || - (info.total_bytes_sec && info.write_bytes_sec)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of bytes_sec " - "cannot be set at the same time")); - goto endjob; - } - - if ((info.total_iops_sec && info.read_iops_sec) || - (info.total_iops_sec && info.write_iops_sec)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of iops_sec " - "cannot be set at the same time")); - goto endjob; - } - - if ((info.total_bytes_sec_max && info.read_bytes_sec_max) || - (info.total_bytes_sec_max && info.write_bytes_sec_max)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of bytes_sec_max " - "cannot be set at the same time")); + if (virDomainBlockIoTuneValidate(&info) < 0) goto endjob; - } - - if ((info.total_iops_sec_max && info.read_iops_sec_max) || - (info.total_iops_sec_max && info.write_iops_sec_max)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of iops_sec_max " - "cannot be set at the same time")); - goto endjob; - } =20 virDomainBlockIoTuneInfoCopy(&info, &conf_info); =20 --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359396; cv=none; d=zohomail.com; s=zohoarc; b=GhU7DcTKAnjjJyWsUZ0V7o9RhAS61wRKfGhERvjjirKyzjDAV8+HuSlh2/D9OGar4Ahg1JEFdPZOCr2izgjuTwkZDJeXCVRmrpFprUHsGGK1mm6MwJuBXrZgYAxwUfleU40GcTK02QXJxyNRYT4bikbrJPNPRDaea+0Nr2bt3zA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359396; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=v4/PEMBIkr+ewaiakPlO4eXI3xd8B9DOYdNSPpF+aQU=; b=GiO8cZ6iDfzDRtQtKYa/6DInLofkKfjc4cARPwPJ/6SeOj8lztE2VTww2IiL0S5adZFNceXkvUPLU+h7c6XdJ2ivEDKG/wb/tVEZuYTvk+CscVxztKfv71N88N2f5+8K+JqpjsCNEZJdJUdLYihadry0OKzk/6G2AR6SljhRzDs= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610359396101612.6090755058761; Mon, 11 Jan 2021 02:03:16 -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-520-6zrXPtUIMuqYNi8wewh4pA-1; Mon, 11 Jan 2021 05:03:12 -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 A54A81896101; Mon, 11 Jan 2021 10:03:07 +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 759742C315; Mon, 11 Jan 2021 10:03:07 +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 D41714BB40; Mon, 11 Jan 2021 10:03:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9wjvq015168 for ; Mon, 11 Jan 2021 04:58:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id A69FA2166B2A; Mon, 11 Jan 2021 09:58:45 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A1CBE2166B28 for ; Mon, 11 Jan 2021 09:58:42 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 45DAF8007D9 for ; Mon, 11 Jan 2021 09:58:42 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-439-6cMXlKy_Ns60sRbeuEG6fg-1; Mon, 11 Jan 2021 04:58:39 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytx5-00GBOE-Oe for libvir-list@redhat.com; Mon, 11 Jan 2021 12:57:31 +0300 X-MC-Unique: 6zrXPtUIMuqYNi8wewh4pA-1 X-MC-Unique: 6cMXlKy_Ns60sRbeuEG6fg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 07/23] test driver: reuse virDomainBlockIoTuneValidate Date: Mon, 11 Jan 2021 12:50:00 +0300 Message-Id: <1610358616-567804-8-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/test/test_driver.c | 32 +------------------------------- 1 file changed, 1 insertion(+), 31 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 29c4c86..4eb04d6 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3780,38 +3780,8 @@ testDomainSetBlockIoTune(virDomainPtr dom, } #undef SET_IOTUNE_FIELD =20 - if ((info.total_bytes_sec && info.read_bytes_sec) || - (info.total_bytes_sec && info.write_bytes_sec)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of bytes_sec " - "cannot be set at the same time")); - goto cleanup; - } - - if ((info.total_iops_sec && info.read_iops_sec) || - (info.total_iops_sec && info.write_iops_sec)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of iops_sec " - "cannot be set at the same time")); + if (virDomainBlockIoTuneValidate(&info) < 0) goto cleanup; - } - - if ((info.total_bytes_sec_max && info.read_bytes_sec_max) || - (info.total_bytes_sec_max && info.write_bytes_sec_max)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of bytes_sec_max " - "cannot be set at the same time")); - goto cleanup; - } - - if ((info.total_iops_sec_max && info.read_iops_sec_max) || - (info.total_iops_sec_max && info.write_iops_sec_max)) { - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("total and read/write of iops_sec_max " - "cannot be set at the same time")); - goto cleanup; - } - =20 #define TEST_BLOCK_IOTUNE_MAX_CHECK(FIELD, FIELD_MAX) \ do { \ --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359198; cv=none; d=zohomail.com; s=zohoarc; b=T0nGrL2RiE6pX4hoOIns9LPeOZVvFlzgd0eryPEhdEDkFfdfZn/3UKsemjiz76KPRJo8EgSNhZW5nkzaw6Erf+bJD5VYEGo+IfmO4SM4iqfzhU5rwKqxcwn15hpgcG11LU88YwFTUuVQzsylYcHQZaokBOsePYPAs1OSniPD6K4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359198; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=SylsfZYIUwytB2Q9C5vugGwMcULIrFBQ1105QbeRanQ=; b=ClEqzm0ion3tWIUG/uyqMTpBVo9zf/aP2hxTkfXSNW2ZuDxOxuac0wZT7Td7DCjMIdxaWv3aSMZEA3B+scWQ+xSvozgoVuiGHG5JFTrb695ivGFtTzMp9IOXsG+p480FYJG2V+ydf1EKB0P0j3eqeYGayDwUssbg87yr63XZr8E= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610359198040871.7386685828972; Mon, 11 Jan 2021 01:59:58 -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-444-fQqmC2UwMqS6-BJkSdoPZA-1; Mon, 11 Jan 2021 04:59:52 -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 4D79D8049C2; Mon, 11 Jan 2021 09:59:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22F906A91D; Mon, 11 Jan 2021 09:59:47 +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 DBE181809CA1; Mon, 11 Jan 2021 09:59:46 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10B9xj2b015357 for ; Mon, 11 Jan 2021 04:59:45 -0500 Received: by smtp.corp.redhat.com (Postfix) id EAB072026D11; Mon, 11 Jan 2021 09:59:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E552E2026D5D for ; Mon, 11 Jan 2021 09:59:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A7B1F811E84 for ; Mon, 11 Jan 2021 09:59:41 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-389-9Uc7Rl2MMQOKx5tul8i77A-1; Mon, 11 Jan 2021 04:59:39 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyty3-00GBOE-6x for libvir-list@redhat.com; Mon, 11 Jan 2021 12:58:31 +0300 X-MC-Unique: fQqmC2UwMqS6-BJkSdoPZA-1 X-MC-Unique: 9Uc7Rl2MMQOKx5tul8i77A-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 08/23] qemu: reset max iotune setting when needed Date: Mon, 11 Jan 2021 12:50:01 +0300 Message-Id: <1610358616-567804-9-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Currenly API is not very convinient when switching from read/write to total tunes back and forth. read/write and total tunes can not be set simulaneous= ly so one need to choose one. Now if for example total_bytes_sec and total_bytes_sec_max are set and we set read_bytes_sec only then API fails. = The issue is new max settings are copied from the old ones in this case and as a result after defaults are applied we got settings for read_bytes_sec and total_bytes_sec_max which is incorrect. In order to handle such situation nicely let's reset max settings if appropriate avg settings is reseted explicitly or implicitly. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 117c7b7..9093baf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15901,6 +15901,22 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIoT= uneInfoPtr newinfo, SET_IOTUNE_DEFAULTS(IOPS_MAX, iops_sec_max); #undef SET_IOTUNE_DEFAULTS =20 +#define RESET_IOTUNE_MAX(BOOL, FIELD) \ + do { \ + if (set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) { \ + if (!newinfo->total_##FIELD) \ + newinfo->total_##FIELD##_max =3D 0; \ + if (!newinfo->read_##FIELD) \ + newinfo->read_##FIELD##_max =3D 0; \ + if (!newinfo->write_##FIELD) \ + newinfo->write_##FIELD##_max =3D 0; \ + } \ + } while (0) + + RESET_IOTUNE_MAX(BYTES, bytes_sec); + RESET_IOTUNE_MAX(IOPS, iops_sec); +#undef RESET_IOTUNE_MAX + if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS)) newinfo->size_iops_sec =3D oldinfo->size_iops_sec; if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME)) @@ -16210,17 +16226,10 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, do { \ if (info.val##_max) { \ if (!info.val) { \ - if (QEMU_BLOCK_IOTUNE_SET_##_bool) { \ - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ - _("cannot reset '%s' when " \ - "'%s' is set"), \ - #val, #val "_max"); \ - } else { \ - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ - _("value '%s' cannot be set if " \ - "'%s' is not set"), \ - #val "_max", #val); \ - } \ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ + _("value '%s' cannot be set if " \ + "'%s' is not set"), \ + #val "_max", #val); \ goto endjob; \ } \ if (info.val##_max < info.val) { \ --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359272; cv=none; d=zohomail.com; s=zohoarc; b=AwV3nyxMSbbrwmbW5S0itoaloCCU5RrJwmhO0v3iJRAUGnmPl3dDkermGrbyfki403Ctoy2Hz6TyCxFg1LA9FRSY2sCGHtvkC49vP8Pf518FyJfCgUsWQoTuyTM7R/a9IaOJKHONsTpFEbkWvt8zPctm3sSkbFT2+/xZYPUZAQo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359272; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=2QzSajbDzJmhkNz2xAujx5J8nbNoHdiOZdeuXKn7K8Q=; b=ANVu9/WkttcbJ5+b8bSabuI6W53wv4JFn/clZH4fxjfhKCg9OBmLk+0D+lpq2V3zj7gwb2liAULt1v3Jm4yJiPRGMpB9NNqIMPFQ0AXoWvBaOTDVj3QHZvW+dUznNTKcP5srhJS0lYl94kkf5aLt3oN34cUTx/QdvAMJbMQ6etI= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161035927224728.246330902954014; Mon, 11 Jan 2021 02:01:12 -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-60-GaiD1-wLMju4MLZlhGZ9pQ-1; Mon, 11 Jan 2021 05:01:08 -0500 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 6AAFD100F375; Mon, 11 Jan 2021 10:00:46 +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 0E95460C4D; Mon, 11 Jan 2021 10:00:46 +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 C7A0C4BB7B; Mon, 11 Jan 2021 10:00:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA0iJD015500 for ; Mon, 11 Jan 2021 05:00:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 8E63E2026D3A; Mon, 11 Jan 2021 10:00:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8A0592026D76 for ; Mon, 11 Jan 2021 10:00:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 31F7B858280 for ; Mon, 11 Jan 2021 10:00:41 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-200-JqpjvUUQPVeX9xpTbvIakA-1; Mon, 11 Jan 2021 05:00:38 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytz0-00GBOE-Fb for libvir-list@redhat.com; Mon, 11 Jan 2021 12:59:30 +0300 X-MC-Unique: GaiD1-wLMju4MLZlhGZ9pQ-1 X-MC-Unique: JqpjvUUQPVeX9xpTbvIakA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 09/23] qemu: add max iotune settings check to virDomainBlockIoTuneValidate Date: Mon, 11 Jan 2021 12:50:02 +0300 Message-Id: <1610358616-567804-10-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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.12 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now only qemu and test drivers support iotunes and for both of them this ch= eck makes sense. I guess there is little chance that this patch will break load= ing of some domains with incorrect config though. If this is the issue then we = can put this common check to a different place. Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 173424a..800bca5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8663,6 +8663,35 @@ virDomainBlockIoTuneValidate(virDomainBlockIoTuneInf= oPtr iotune) return -1; } =20 +#define CHECK_MAX(val) \ + do { \ + if (iotune->val##_max) { \ + if (!iotune->val) { \ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ + _("value '%s' cannot be set if " \ + "'%s' is not set"), \ + #val "_max", #val); \ + return -1; \ + } \ + if (iotune->val##_max < iotune->val) { \ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ + _("value '%s' cannot be " \ + "smaller than '%s'"), \ + #val "_max", #val); \ + return -1; \ + } \ + } \ + } while (false) + + CHECK_MAX(total_bytes_sec); + CHECK_MAX(read_bytes_sec); + CHECK_MAX(write_bytes_sec); + CHECK_MAX(total_iops_sec); + CHECK_MAX(read_iops_sec); + CHECK_MAX(write_iops_sec); + +#undef CHECK_MAX + return 0; } =20 --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359402; cv=none; d=zohomail.com; s=zohoarc; b=BSHzmIAT6C3s4Q2+AztzIwo6Eqcm3gJICvJeVd/kMzjDyuDgNJgcooaJfXU1COHnDaShUO0pLa2h9n4Pto5fhejo0hfBu+gHIPRH04jRWCTbYm5oYqAVy4RlmDIFb+Db1PFtjOshJZQKKrRtIzeW/Lte4h++PH2nWqfnvoAyLt8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359402; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=nytBxmsE23w2pHlqmcJr4PAJK7vC2aM03dJ1q6t5wpU=; b=LTKBKGNAG8yBleQEqws21ybAvOGcfUPTMzp2BjYbDTDuPCKQSwETVqv3Tdj2IMre7LevHvLglcq0g8LhlrDCVZreN41XM6e7uI22TzViKUyHX9R2/Qtl1BcamRcDVJtXR9cB7cLj+td0qYdKA/HhRg2p1cBpBqpBv4uekmxRBQU= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359402449517.0208058868334; Mon, 11 Jan 2021 02:03:22 -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-355-SI3_CUQqPWizMkxLAWAXJg-1; Mon, 11 Jan 2021 05:03:18 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E084880ED9B; Mon, 11 Jan 2021 10:03:12 +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 B1F8919714; Mon, 11 Jan 2021 10:03:12 +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 6BC8A5002F; Mon, 11 Jan 2021 10:03:12 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA1hUs015663 for ; Mon, 11 Jan 2021 05:01:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id 26F78112D43E; Mon, 11 Jan 2021 10:01:43 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 22552100414E for ; Mon, 11 Jan 2021 10:01:40 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B2D1B8007D9 for ; Mon, 11 Jan 2021 10:01:40 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-78-FoYk6qqiOhi5T0_pwXfaMQ-1; Mon, 11 Jan 2021 05:01:37 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kytzx-00GBOE-Mh for libvir-list@redhat.com; Mon, 11 Jan 2021 13:00:29 +0300 X-MC-Unique: SI3_CUQqPWizMkxLAWAXJg-1 X-MC-Unique: FoYk6qqiOhi5T0_pwXfaMQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 10/23] qemu: remove iotune max checks Date: Mon, 11 Jan 2021 12:50:03 +0300 Message-Id: <1610358616-567804-11-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These checks are now in the above call to virDomainBlockIoTuneValidate. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/qemu/qemu_driver.c | 29 ----------------------------- 1 file changed, 29 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9093baf..02b28f0 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16222,35 +16222,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if (qemuDomainCheckBlockIoTuneReset(disk, &info) < 0) goto endjob; =20 -#define CHECK_MAX(val, _bool) \ - do { \ - if (info.val##_max) { \ - if (!info.val) { \ - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ - _("value '%s' cannot be set if " \ - "'%s' is not set"), \ - #val "_max", #val); \ - goto endjob; \ - } \ - if (info.val##_max < info.val) { \ - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ - _("value '%s' cannot be " \ - "smaller than '%s'"), \ - #val "_max", #val); \ - goto endjob; \ - } \ - } \ - } while (false) - - CHECK_MAX(total_bytes_sec, BYTES); - CHECK_MAX(read_bytes_sec, BYTES); - CHECK_MAX(write_bytes_sec, BYTES); - CHECK_MAX(total_iops_sec, IOPS); - CHECK_MAX(read_iops_sec, IOPS); - CHECK_MAX(write_iops_sec, IOPS); - -#undef CHECK_MAX - /* blockdev-based qemu doesn't want to set the throttling when a c= drom * is empty. Skip the monitor call here since we will set the thro= ttling * once new media is inserted */ --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359377; cv=none; d=zohomail.com; s=zohoarc; b=j/K5S7jSf5Ag+fJ73oPQLByC4M2h10f72lCtOLhyZgAqLm1gW+e2ufkVXpyJt7SGIWtd8fRE2chRR1tbuJQmswZJQadQrv0fZvvOLRs5hcniUe+tJgIDp019+21VuAsI6NrvNl0CzV08RNl6j3SXy8oQIOinI1g+aNVsOUBLx2g= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359377; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=VVnKm5VgFYqOoKfI8mbfr6DZd60yJWWJCHZqQESuklY=; b=cdzmDmJod0EBnLfzRR47WtF9ubLsmj3AxqkNx3G3WCIC8UXlySyRXKRMeSdecAGFmF5ukqADJL3SKKFS3YXva00MnghM5wyLPNcm7y6n+qmjW3kJBenCkGIozy3yu4tra8NtpeVcEPHE6LBV2waR2MZTyxejjZ0t+chCd7Ft9B0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359377789141.35429104009404; Mon, 11 Jan 2021 02:02:57 -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-87-v33gSYXPMr64Ej5S5N1kuA-1; Mon, 11 Jan 2021 05:02:53 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 00B47802B42; Mon, 11 Jan 2021 10:02:47 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6D9C1349A; Mon, 11 Jan 2021 10:02:46 +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 3E2BA1809C9F; Mon, 11 Jan 2021 10:02:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA2h1J015804 for ; Mon, 11 Jan 2021 05:02:43 -0500 Received: by smtp.corp.redhat.com (Postfix) id F2E60112D43F; Mon, 11 Jan 2021 10:02:42 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EF48A112D43E for ; Mon, 11 Jan 2021 10:02:39 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A34C28015A8 for ; Mon, 11 Jan 2021 10:02:39 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-186-HqE67B6cNIq3f62QGUBVOQ-1; Mon, 11 Jan 2021 05:02:37 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu0v-00GBOE-1y for libvir-list@redhat.com; Mon, 11 Jan 2021 13:01:29 +0300 X-MC-Unique: v33gSYXPMr64Ej5S5N1kuA-1 X-MC-Unique: HqE67B6cNIq3f62QGUBVOQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 11/23] test driver: remove iotune max checks Date: Mon, 11 Jan 2021 12:50:04 +0300 Message-Id: <1610358616-567804-12-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" These checks are now in the above call to virDomainBlockIoTuneValidate. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/test/test_driver.c | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 4eb04d6..299be2a 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3783,25 +3783,6 @@ testDomainSetBlockIoTune(virDomainPtr dom, if (virDomainBlockIoTuneValidate(&info) < 0) goto cleanup; =20 -#define TEST_BLOCK_IOTUNE_MAX_CHECK(FIELD, FIELD_MAX) \ - do { \ - if (info.FIELD > info.FIELD_MAX) { \ - virReportError(VIR_ERR_INVALID_ARG, \ - _("%s cannot be set higher than %s "), \ - #FIELD, #FIELD_MAX); \ - goto cleanup; \ - } \ - } while (0); - - TEST_BLOCK_IOTUNE_MAX_CHECK(total_bytes_sec, total_bytes_sec_max); - TEST_BLOCK_IOTUNE_MAX_CHECK(read_bytes_sec, read_bytes_sec_max); - TEST_BLOCK_IOTUNE_MAX_CHECK(write_bytes_sec, write_bytes_sec_max); - TEST_BLOCK_IOTUNE_MAX_CHECK(total_iops_sec, total_iops_sec_max); - TEST_BLOCK_IOTUNE_MAX_CHECK(read_iops_sec, read_iops_sec_max); - TEST_BLOCK_IOTUNE_MAX_CHECK(write_iops_sec, write_iops_sec_max); - -#undef TEST_BLOCK_IOTUNE_MAX_CHECK - virDomainDiskSetBlockIOTune(conf_disk, &info); info.group_name =3D NULL; =20 --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359435; cv=none; d=zohomail.com; s=zohoarc; b=NXdCnlJbgfcAD1UGxzWYCAOEn1uIyXspwIRWXW2X0hzJMgqu0l4fi7mRPChhjCFWpTRtipXU/Q8TCv0m9JvpGEFO7oTMvJZZfcnZZ9wuvinBZPKKihB6QuEOkmoECTxaELKFznbsh88a3sku/q98kuYL84i/MpXjJ0tgEet8p6c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359435; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=3+X04AflSEs0J9giG+NlnYv19vHupQEfhe092dzua8Q=; b=dgMO2ztxEkFG0ffXVxdjj8+j9jbfcWyoCqJ+9t/IfjoaA5OI0ZVPK5eLXTCgwQoIZlrhTyprLWuVE8fjQeOtqcUZqxBrfS6emqUbuSNygkEtJyXFZCnJ9Cz+XgPm8eix/8wWWNYiC53FC4iyB9Uqs5dAZUTMtGaUbR5EwOpU79Q= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359435663317.40078855555726; Mon, 11 Jan 2021 02:03:55 -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-225-_Qb30rgFPbmXFIvBgbVdAw-1; Mon, 11 Jan 2021 05:03:52 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7B58A8030C0; Mon, 11 Jan 2021 10:03:46 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 582061349A; Mon, 11 Jan 2021 10:03:46 +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 E0565180954D; Mon, 11 Jan 2021 10:03:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA3itF016013 for ; Mon, 11 Jan 2021 05:03:44 -0500 Received: by smtp.corp.redhat.com (Postfix) id 511632026D11; Mon, 11 Jan 2021 10:03:44 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4C8062026D5D for ; Mon, 11 Jan 2021 10:03:41 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id D5441858EEC for ; Mon, 11 Jan 2021 10:03:41 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-535-Iq3yeFNRP4CJOUS9ESkdvg-1; Mon, 11 Jan 2021 05:03:37 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu1s-00GBOE-HO for libvir-list@redhat.com; Mon, 11 Jan 2021 13:02:28 +0300 X-MC-Unique: _Qb30rgFPbmXFIvBgbVdAw-1 X-MC-Unique: Iq3yeFNRP4CJOUS9ESkdvg-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 12/23] qemu: prepare for removing qemuBlockIoTuneSetFlags Date: Mon, 11 Jan 2021 12:50:05 +0300 Message-Id: <1610358616-567804-13-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We need extra variable in macros thus let's add do {} while (0) wrapping. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 02b28f0..15ccf90 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15889,11 +15889,13 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIo= TuneInfoPtr newinfo, qemuBlockIoTuneSetFlags set_fields) { #define SET_IOTUNE_DEFAULTS(BOOL, FIELD) \ - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) { \ - newinfo->total_##FIELD =3D oldinfo->total_##FIELD; \ - newinfo->read_##FIELD =3D oldinfo->read_##FIELD; \ - newinfo->write_##FIELD =3D oldinfo->write_##FIELD; \ - } + do { \ + if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) { \ + newinfo->total_##FIELD =3D oldinfo->total_##FIELD; \ + newinfo->read_##FIELD =3D oldinfo->read_##FIELD; \ + newinfo->write_##FIELD =3D oldinfo->write_##FIELD; \ + } \ + } while (0) =20 SET_IOTUNE_DEFAULTS(BYTES, bytes_sec); SET_IOTUNE_DEFAULTS(BYTES_MAX, bytes_sec_max); @@ -15935,13 +15937,15 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIo= TuneInfoPtr newinfo, * our newinfo is clearing, then set max_length based on whether we * have a value in the family set/defined. */ #define SET_MAX_LENGTH(BOOL, FIELD) \ - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) \ - newinfo->FIELD##_max_length =3D oldinfo->FIELD##_max_length; \ - else if ((set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) && \ - oldinfo->FIELD##_max_length && \ - !newinfo->FIELD##_max_length) \ - newinfo->FIELD##_max_length =3D (newinfo->FIELD || \ - newinfo->FIELD##_max) ? 1 : 0; + do { \ + if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) \ + newinfo->FIELD##_max_length =3D oldinfo->FIELD##_max_length; \ + else if ((set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) && \ + oldinfo->FIELD##_max_length && \ + !newinfo->FIELD##_max_length) \ + newinfo->FIELD##_max_length =3D (newinfo->FIELD || \ + newinfo->FIELD##_max) ? 1 : 0; \ + } while (0) =20 SET_MAX_LENGTH(BYTES_MAX_LENGTH, total_bytes_sec); SET_MAX_LENGTH(BYTES_MAX_LENGTH, read_bytes_sec); --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359493; cv=none; d=zohomail.com; s=zohoarc; b=FFBykCn+01CAR4AbpKDp+ZLxioR0ienT0xNWuJZJST6FtO/MZ47GxPN5NvFIyXZCzzXLkWqDHdO4SGbEXu25ANFEbYUgZ/56U8fHLhNltz41OjE9o1s3mbHFck2ubaj75DW9gyTBNdRxjWuPXwe4/V+DUf29sfRi3MoD/w0rVKE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359493; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YUFdjMFwdwnsb/sWqpbYuvN8GvZRpq0IiXvIoLQGVi8=; b=SfTqWO7ChpC213ukRXafOUEPqE7ZevNtQtynaFcwk62dsCvEhAY2YNyxbgTLcT3UMa7wA/EP8GR3wm1mP8/yOnXHPV4mWrBS2xzWeuynJQ0QxP0O3dACA3aDPchLD6Q3iJIS2UZTKvi8VjNQIyJ8xFsjWWBbpqZjQUz9Ctzg7V0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359493012494.20767942220255; Mon, 11 Jan 2021 02:04:53 -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-11-rA6NwhItN16wiaUh1BPWOA-1; Mon, 11 Jan 2021 05:04:49 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C35F4190A7A1; Mon, 11 Jan 2021 10:04:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DF4919813; Mon, 11 Jan 2021 10:04:42 +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 5E2AF1809C9F; Mon, 11 Jan 2021 10:04:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA4eZu016120 for ; Mon, 11 Jan 2021 05:04:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id B2DFA2026D5D; Mon, 11 Jan 2021 10:04:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEC722026D49 for ; Mon, 11 Jan 2021 10:04:38 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B3BD811E84 for ; Mon, 11 Jan 2021 10:04:38 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-138-flm1blZtORuLbUaIkT0y6A-1; Mon, 11 Jan 2021 05:04:36 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu2p-00GBOE-SF for libvir-list@redhat.com; Mon, 11 Jan 2021 13:03:27 +0300 X-MC-Unique: rA6NwhItN16wiaUh1BPWOA-1 X-MC-Unique: flm1blZtORuLbUaIkT0y6A-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 13/23] qemu: use group_name instead of QEMU_BLOCK_IOTUNE_SET_GROUP_NAME Date: Mon, 11 Jan 2021 12:50:06 +0300 Message-Id: <1610358616-567804-14-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We need qemuBlockIoTuneSetFlags to distinguish cases when some tune is not = set from tune is set explicitly to 0. We don't have the latter case for the gro= up name and don't need QEMU_BLOCK_IOTUNE_SET_GROUP_NAME. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 15ccf90..61be425 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15921,7 +15921,7 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIoTu= neInfoPtr newinfo, =20 if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS)) newinfo->size_iops_sec =3D oldinfo->size_iops_sec; - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_GROUP_NAME)) + if (!newinfo->group_name) newinfo->group_name =3D g_strdup(oldinfo->group_name); =20 /* The length field is handled a bit differently. If not defined/set, @@ -16165,7 +16165,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, /* NB: Cannot use macro since this is a value.s not a value.ul */ if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME)) { info.group_name =3D g_strdup(param->value.s); - set_fields |=3D QEMU_BLOCK_IOTUNE_SET_GROUP_NAME; if (virTypedParamsAddString(&eventParams, &eventNparams, &eventMaxparams, VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NA= ME, --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359551; cv=none; d=zohomail.com; s=zohoarc; b=lfoyTYfzorgLOZe3AkPWnVtJrbBYVzEJBQgMRzg8Pi9jfphUPRrPNqFbIDw0xWHcgLca5x3H4o7rfLaBh+Fe8gTm4mdVmbnLeLI0Vpq+6y2yw+NlcruKWrZ27G6l2G6cQaPEaajx/y/xJpgGmUi9lXt846M8WBU9wagjucMouKM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359551; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=hR3ECsJKkEo4FLgDKH90n4MEcYsCx9Eb7aAOoQorScU=; b=mZpB17jtzV5+hJSNvPdkxshOtamEKNJtAjr5MAasPi2fY3BshgLix6BPkjDX7wU/QpDBfDbNdscvOmdarJ2Et3EDn68x9MDT+0NvIBHrRJJPY3GiGaJJ9QWt/6ApluysMNOKt1NV25kXNG2zXmCewHck6A/Rx0+nKMvvIOOyn/k= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359551661298.63942740481343; Mon, 11 Jan 2021 02:05:51 -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-177-gzdeKNAbMOO6QhMRPVXp2A-1; Mon, 11 Jan 2021 05:05:48 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 2086E100C660; Mon, 11 Jan 2021 10:05:42 +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 E79285D9F4; Mon, 11 Jan 2021 10:05:41 +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 A8F7D4BB7B; Mon, 11 Jan 2021 10:05:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA5ekb016198 for ; Mon, 11 Jan 2021 05:05:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 299542026D5D; Mon, 11 Jan 2021 10:05:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 24BF62026D49 for ; Mon, 11 Jan 2021 10:05:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id AF226101A563 for ; Mon, 11 Jan 2021 10:05:37 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-134-6dLTivriNM2NPRpgrgv64w-1; Mon, 11 Jan 2021 05:05:35 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu3n-00GBOE-9R for libvir-list@redhat.com; Mon, 11 Jan 2021 13:04:27 +0300 X-MC-Unique: gzdeKNAbMOO6QhMRPVXp2A-1 X-MC-Unique: 6dLTivriNM2NPRpgrgv64w-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 14/23] qemu: remove qemuBlockIoTuneSetFlags usage in qemuDomainSetBlockIoTune Date: Mon, 11 Jan 2021 12:50:07 +0300 Message-Id: <1610358616-567804-15-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 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.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" I'm going to get rid of macros code in qemuDomainSetBlockIoTune that conver= ts virTypedParameter parameters into struct. In the scope of the overall effor= t to reduce/get rid of using macros when dealing with iotunes. And it will be mu= ch easier to use per field structure which hold whether field was set or not w= hen removing macros in this place. So let's use just another virDomainBlockIoTuneInfo for this purpose where fields will hold bool values set/unset. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 100 +++++++++++++++++++++++++++------------------= ---- 1 file changed, 55 insertions(+), 45 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 61be425..57d63b6 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15886,26 +15886,32 @@ typedef enum { static int qemuDomainSetBlockIoTuneDefaults(virDomainBlockIoTuneInfoPtr newinfo, virDomainBlockIoTuneInfoPtr oldinfo, - qemuBlockIoTuneSetFlags set_fields) + virDomainBlockIoTuneInfoPtr set_fields) { -#define SET_IOTUNE_DEFAULTS(BOOL, FIELD) \ +#define SET_IOTUNE_DEFAULTS(FIELD) \ do { \ - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) { \ + bool set =3D set_fields->total_##FIELD || \ + set_fields->read_##FIELD || \ + set_fields->write_##FIELD; \ + if (!set) { \ newinfo->total_##FIELD =3D oldinfo->total_##FIELD; \ newinfo->read_##FIELD =3D oldinfo->read_##FIELD; \ newinfo->write_##FIELD =3D oldinfo->write_##FIELD; \ } \ } while (0) =20 - SET_IOTUNE_DEFAULTS(BYTES, bytes_sec); - SET_IOTUNE_DEFAULTS(BYTES_MAX, bytes_sec_max); - SET_IOTUNE_DEFAULTS(IOPS, iops_sec); - SET_IOTUNE_DEFAULTS(IOPS_MAX, iops_sec_max); + SET_IOTUNE_DEFAULTS(bytes_sec); + SET_IOTUNE_DEFAULTS(bytes_sec_max); + SET_IOTUNE_DEFAULTS(iops_sec); + SET_IOTUNE_DEFAULTS(iops_sec_max); #undef SET_IOTUNE_DEFAULTS =20 -#define RESET_IOTUNE_MAX(BOOL, FIELD) \ +#define RESET_IOTUNE_MAX(FIELD) \ do { \ - if (set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) { \ + bool set =3D set_fields->total_##FIELD || \ + set_fields->read_##FIELD || \ + set_fields->write_##FIELD; \ + if (set) { \ if (!newinfo->total_##FIELD) \ newinfo->total_##FIELD##_max =3D 0; \ if (!newinfo->read_##FIELD) \ @@ -15915,11 +15921,11 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIo= TuneInfoPtr newinfo, } \ } while (0) =20 - RESET_IOTUNE_MAX(BYTES, bytes_sec); - RESET_IOTUNE_MAX(IOPS, iops_sec); + RESET_IOTUNE_MAX(bytes_sec); + RESET_IOTUNE_MAX(iops_sec); #undef RESET_IOTUNE_MAX =20 - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS)) + if (!set_fields->size_iops_sec) newinfo->size_iops_sec =3D oldinfo->size_iops_sec; if (!newinfo->group_name) newinfo->group_name =3D g_strdup(oldinfo->group_name); @@ -15936,23 +15942,26 @@ qemuDomainSetBlockIoTuneDefaults(virDomainBlockIo= TuneInfoPtr newinfo, * will cause an error. So, to mimic that, if our oldinfo was set and * our newinfo is clearing, then set max_length based on whether we * have a value in the family set/defined. */ -#define SET_MAX_LENGTH(BOOL, FIELD) \ +#define SET_MAX_LENGTH(MAX_LENGTH_FIELD, FIELD) \ do { \ - if (!(set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL)) \ + bool set =3D set_fields->total_##MAX_LENGTH_FIELD || \ + set_fields->read_##MAX_LENGTH_FIELD || \ + set_fields->write_##MAX_LENGTH_FIELD; \ + if (!set) \ newinfo->FIELD##_max_length =3D oldinfo->FIELD##_max_length; \ - else if ((set_fields & QEMU_BLOCK_IOTUNE_SET_##BOOL) && \ + else if (set && \ oldinfo->FIELD##_max_length && \ !newinfo->FIELD##_max_length) \ newinfo->FIELD##_max_length =3D (newinfo->FIELD || \ newinfo->FIELD##_max) ? 1 : 0; \ } while (0) =20 - SET_MAX_LENGTH(BYTES_MAX_LENGTH, total_bytes_sec); - SET_MAX_LENGTH(BYTES_MAX_LENGTH, read_bytes_sec); - SET_MAX_LENGTH(BYTES_MAX_LENGTH, write_bytes_sec); - SET_MAX_LENGTH(IOPS_MAX_LENGTH, total_iops_sec); - SET_MAX_LENGTH(IOPS_MAX_LENGTH, read_iops_sec); - SET_MAX_LENGTH(IOPS_MAX_LENGTH, write_iops_sec); + SET_MAX_LENGTH(bytes_sec_max_length, total_bytes_sec); + SET_MAX_LENGTH(bytes_sec_max_length, read_bytes_sec); + SET_MAX_LENGTH(bytes_sec_max_length, write_bytes_sec); + SET_MAX_LENGTH(iops_sec_max_length, total_iops_sec); + SET_MAX_LENGTH(iops_sec_max_length, read_iops_sec); + SET_MAX_LENGTH(iops_sec_max_length, write_iops_sec); =20 #undef SET_MAX_LENGTH =20 @@ -16044,7 +16053,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, size_t i; virDomainDiskDefPtr conf_disk =3D NULL; virDomainDiskDefPtr disk; - qemuBlockIoTuneSetFlags set_fields =3D 0; + virDomainBlockIoTuneInfo set_fields; bool supportMaxOptions =3D true; bool supportGroupNameOption =3D true; bool supportMaxLengthOptions =3D true; @@ -16105,6 +16114,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, =20 memset(&info, 0, sizeof(info)); memset(&conf_info, 0, sizeof(conf_info)); + memset(&set_fields, 0, sizeof(set_fields)); =20 if (!(vm =3D qemuDomainObjFromDomain(dom))) return -1; @@ -16126,10 +16136,10 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0) goto endjob; =20 -#define SET_IOTUNE_FIELD(FIELD, BOOL, CONST) \ +#define SET_IOTUNE_FIELD(FIELD, CONST) \ if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_##CONST)) { \ info.FIELD =3D param->value.ul; \ - set_fields |=3D QEMU_BLOCK_IOTUNE_SET_##BOOL; \ + set_fields.FIELD =3D 1; \ if (virTypedParamsAddULLong(&eventParams, &eventNparams, \ &eventMaxparams, \ VIR_DOMAIN_TUNABLE_BLKDEV_##CONST, \ @@ -16141,26 +16151,26 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, for (i =3D 0; i < nparams; i++) { virTypedParameterPtr param =3D ¶ms[i]; =20 - SET_IOTUNE_FIELD(total_bytes_sec, BYTES, TOTAL_BYTES_SEC); - SET_IOTUNE_FIELD(read_bytes_sec, BYTES, READ_BYTES_SEC); - SET_IOTUNE_FIELD(write_bytes_sec, BYTES, WRITE_BYTES_SEC); - SET_IOTUNE_FIELD(total_iops_sec, IOPS, TOTAL_IOPS_SEC); - SET_IOTUNE_FIELD(read_iops_sec, IOPS, READ_IOPS_SEC); - SET_IOTUNE_FIELD(write_iops_sec, IOPS, WRITE_IOPS_SEC); + SET_IOTUNE_FIELD(total_bytes_sec, TOTAL_BYTES_SEC); + SET_IOTUNE_FIELD(read_bytes_sec, READ_BYTES_SEC); + SET_IOTUNE_FIELD(write_bytes_sec, WRITE_BYTES_SEC); + SET_IOTUNE_FIELD(total_iops_sec, TOTAL_IOPS_SEC); + SET_IOTUNE_FIELD(read_iops_sec, READ_IOPS_SEC); + SET_IOTUNE_FIELD(write_iops_sec, WRITE_IOPS_SEC); =20 - SET_IOTUNE_FIELD(total_bytes_sec_max, BYTES_MAX, + SET_IOTUNE_FIELD(total_bytes_sec_max, TOTAL_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(read_bytes_sec_max, BYTES_MAX, + SET_IOTUNE_FIELD(read_bytes_sec_max, READ_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(write_bytes_sec_max, BYTES_MAX, + SET_IOTUNE_FIELD(write_bytes_sec_max, WRITE_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(total_iops_sec_max, IOPS_MAX, + SET_IOTUNE_FIELD(total_iops_sec_max, TOTAL_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(read_iops_sec_max, IOPS_MAX, + SET_IOTUNE_FIELD(read_iops_sec_max, READ_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(write_iops_sec_max, IOPS_MAX, + SET_IOTUNE_FIELD(write_iops_sec_max, WRITE_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(size_iops_sec, SIZE_IOPS, SIZE_IOPS_SEC); + SET_IOTUNE_FIELD(size_iops_sec, SIZE_IOPS_SEC); =20 /* NB: Cannot use macro since this is a value.s not a value.ul */ if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME)) { @@ -16173,17 +16183,17 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, continue; } =20 - SET_IOTUNE_FIELD(total_bytes_sec_max_length, BYTES_MAX_LENGTH, + SET_IOTUNE_FIELD(total_bytes_sec_max_length, TOTAL_BYTES_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(read_bytes_sec_max_length, BYTES_MAX_LENGTH, + SET_IOTUNE_FIELD(read_bytes_sec_max_length, READ_BYTES_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(write_bytes_sec_max_length, BYTES_MAX_LENGTH, + SET_IOTUNE_FIELD(write_bytes_sec_max_length, WRITE_BYTES_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(total_iops_sec_max_length, IOPS_MAX_LENGTH, + SET_IOTUNE_FIELD(total_iops_sec_max_length, TOTAL_IOPS_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(read_iops_sec_max_length, IOPS_MAX_LENGTH, + SET_IOTUNE_FIELD(read_iops_sec_max_length, READ_IOPS_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(write_iops_sec_max_length, IOPS_MAX_LENGTH, + SET_IOTUNE_FIELD(write_iops_sec_max_length, WRITE_IOPS_SEC_MAX_LENGTH); } =20 @@ -16219,7 +16229,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, cur_info =3D qemuDomainFindGroupBlockIoTune(def, disk, &info); =20 if (qemuDomainSetBlockIoTuneDefaults(&info, cur_info, - set_fields) < 0) + &set_fields) < 0) goto endjob; =20 if (qemuDomainCheckBlockIoTuneReset(disk, &info) < 0) @@ -16268,7 +16278,7 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, conf_cur_info =3D qemuDomainFindGroupBlockIoTune(persistentDef, co= nf_disk, &info); =20 if (qemuDomainSetBlockIoTuneDefaults(&conf_info, conf_cur_info, - set_fields) < 0) + &set_fields) < 0) goto endjob; =20 if (qemuDomainCheckBlockIoTuneReset(conf_disk, &conf_info) < 0) --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359609; cv=none; d=zohomail.com; s=zohoarc; b=KC/CI0rTZFftKRpZ5qoaEdGRxpvd4PEuJH9cTxyqLsWaepgQcbPKDLjqbRAYJIj7t6NYVhSoDpfgHkfonmZ1DoEhkhc1+0rLzWNxtHx2wtf6Dow623ngyqDYkcfKZIbm5oXky6ztKj0xjvC0DA6AWIefVYuXSpIK+HiKxHWjpyE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359609; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=CeLJoZW4iPsmw9hREi0YoWzDQoGmc7/JL52L6UaTzvc=; b=R4t264qz0GD1WIJpw9sDnlavilkgnTWkiM8AAD53+W971LQ3qxuKC9Gb5h4/aeyX/5AriKOBFi9UGDtRMdsK1luB/wg7sH/Ll8/dyvH+tuaVfoxMF+smj3Vcl8y1hrmN9WjJZTXmoQgCP6WtR7h3jJ8vFpqab+9S4uzjLHhEAi4= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610359609820113.12075305975065; Mon, 11 Jan 2021 02:06:49 -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-340-prL2g0M_Meqa1DlUphiUPg-1; Mon, 11 Jan 2021 05:06:46 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 47420805F0B; Mon, 11 Jan 2021 10:06:41 +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 24EDC72163; Mon, 11 Jan 2021 10:06:41 +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 DE7C65002C; Mon, 11 Jan 2021 10:06:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA6dCF016364 for ; Mon, 11 Jan 2021 05:06:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id 982C94E3CA; Mon, 11 Jan 2021 10:06:39 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9169C4E3C5 for ; Mon, 11 Jan 2021 10:06:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4ECF4101A563 for ; Mon, 11 Jan 2021 10:06:37 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-168-WuY-1ydGOzG2hTWTEHjfHQ-1; Mon, 11 Jan 2021 05:06:35 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu4k-00GBOE-OV for libvir-list@redhat.com; Mon, 11 Jan 2021 13:05:26 +0300 X-MC-Unique: prL2g0M_Meqa1DlUphiUPg-1 X-MC-Unique: WuY-1ydGOzG2hTWTEHjfHQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 15/23] qemu: remove qemuBlockIoTuneSetFlags enum completly Date: Mon, 11 Jan 2021 12:50:08 +0300 Message-Id: <1610358616-567804-16-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is not used anymore. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 57d63b6..29c93de 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -15869,17 +15869,6 @@ qemuDomainOpenGraphicsFD(virDomainPtr dom, return ret; } =20 -typedef enum { - QEMU_BLOCK_IOTUNE_SET_BYTES =3D 1 << 0, - QEMU_BLOCK_IOTUNE_SET_IOPS =3D 1 << 1, - QEMU_BLOCK_IOTUNE_SET_BYTES_MAX =3D 1 << 2, - QEMU_BLOCK_IOTUNE_SET_IOPS_MAX =3D 1 << 3, - QEMU_BLOCK_IOTUNE_SET_SIZE_IOPS =3D 1 << 4, - QEMU_BLOCK_IOTUNE_SET_GROUP_NAME =3D 1 << 5, - QEMU_BLOCK_IOTUNE_SET_BYTES_MAX_LENGTH =3D 1 << 6, - QEMU_BLOCK_IOTUNE_SET_IOPS_MAX_LENGTH =3D 1 << 7, -} qemuBlockIoTuneSetFlags; - =20 /* If the user didn't specify bytes limits, inherit previous values; * likewise if the user didn't specify iops limits. */ --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359671; cv=none; d=zohomail.com; s=zohoarc; b=jOtYV7/aeAVkPNpn8V8spocLdU+rYfpWkrd0+Zg2ZbPSxa8wsEAe4QIe8XxzMqSpybjv8Je/JGSEeaoDC07SwxCLZeLhSiAvbHYkE25wHTeTp28j1SGMEqkgabafpGBhmWq0oBwGMcUxMLctErq5RdI9ndn8C9xXPvlQaFIMXHY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359671; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=G3JsZ+6CZH0fkYLCSGn+uSePzkhlfAcIp1QHm5CUjqA=; b=WK3maaIlc9zFb7mXUBkc3AlWFmgCbYx3Te/S/SsTybtHtPq87sITJp13UkYhfYsSnjJe+LQ3uXkWwikAC7eYq3ogH7IvQg/pLq5vMpRUpo7jS2XWj+UkTCN7tkh0NtoSSSHlvxuOHw3VYfGQ+2oTM04yu11KgqoHhRTEW0LFSn0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359671469505.9833452462258; Mon, 11 Jan 2021 02:07:51 -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-293-4MXrPHsuO9at3qKkjJeR-w-1; Mon, 11 Jan 2021 05:07:48 -0500 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 43F2C10151EF; Mon, 11 Jan 2021 10:07:42 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 21E586EF65; Mon, 11 Jan 2021 10:07:42 +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 E10EE180954D; Mon, 11 Jan 2021 10:07:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA7eMd016442 for ; Mon, 11 Jan 2021 05:07:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id A5EBC112D43F; Mon, 11 Jan 2021 10:07:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A26B3112D439 for ; Mon, 11 Jan 2021 10:07:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E6ED1186E122 for ; Mon, 11 Jan 2021 10:07:36 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-373-fYhN-AKcOge3ykbSI_xR7g-1; Mon, 11 Jan 2021 05:07:34 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu5i-00GBOE-Hb for libvir-list@redhat.com; Mon, 11 Jan 2021 13:06:26 +0300 X-MC-Unique: 4MXrPHsuO9at3qKkjJeR-w-1 X-MC-Unique: fYhN-AKcOge3ykbSI_xR7g-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 16/23] conf: get rid of macros in virDomainDiskDefIotuneParse Date: Mon, 11 Jan 2021 12:50:09 +0300 Message-Id: <1610358616-567804-17-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" At first glance we don't get much win because of introduction of virDomainBlockIoTuneFieldNames and virDomainBlockIoTuneFields. But we are g= oing to use these two in other places to remove usage of macros too. Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 99 +++++++++++++++++++++++++++++++++++-----------= ---- 1 file changed, 69 insertions(+), 30 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 800bca5..024d0e3 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8695,40 +8695,80 @@ virDomainBlockIoTuneValidate(virDomainBlockIoTuneIn= foPtr iotune) return 0; } =20 -#define PARSE_IOTUNE(val) \ - if (virXPathULongLong("string(./iotune/" #val ")", \ - ctxt, &def->blkdeviotune.val) =3D=3D -2) { \ - virReportError(VIR_ERR_XML_ERROR, \ - _("disk iotune field '%s' must be an integer"), #va= l); \ - return -1; \ - } + +static const char* virDomainBlockIoTuneFieldNames[] =3D { + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, + VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, + VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, + VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, + VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, + VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH, + VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH, + VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH, + VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH, + VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH, +}; + + +static unsigned long long** +virDomainBlockIoTuneFields(virDomainBlockIoTuneInfoPtr iotune) +{ + unsigned long long **ret =3D g_new0(unsigned long long*, + G_N_ELEMENTS(virDomainBlockIoTuneFie= ldNames)); + size_t i =3D 0; + + ret[i++] =3D &iotune->total_bytes_sec; + ret[i++] =3D &iotune->read_bytes_sec; + ret[i++] =3D &iotune->write_bytes_sec; + ret[i++] =3D &iotune->total_iops_sec; + ret[i++] =3D &iotune->read_iops_sec; + ret[i++] =3D &iotune->write_iops_sec; + ret[i++] =3D &iotune->total_bytes_sec_max; + ret[i++] =3D &iotune->read_bytes_sec_max; + ret[i++] =3D &iotune->write_bytes_sec_max; + ret[i++] =3D &iotune->total_iops_sec_max; + ret[i++] =3D &iotune->read_iops_sec_max; + ret[i++] =3D &iotune->write_iops_sec_max; + ret[i++] =3D &iotune->size_iops_sec; + ret[i++] =3D &iotune->total_bytes_sec_max_length; + ret[i++] =3D &iotune->read_bytes_sec_max_length; + ret[i++] =3D &iotune->write_bytes_sec_max_length; + ret[i++] =3D &iotune->total_iops_sec_max_length; + ret[i++] =3D &iotune->read_iops_sec_max_length; + ret[i++] =3D &iotune->write_iops_sec_max_length; + + return ret; +} + =20 static int virDomainDiskDefIotuneParse(virDomainDiskDefPtr def, xmlXPathContextPtr ctxt) { - PARSE_IOTUNE(total_bytes_sec); - PARSE_IOTUNE(read_bytes_sec); - PARSE_IOTUNE(write_bytes_sec); - PARSE_IOTUNE(total_iops_sec); - PARSE_IOTUNE(read_iops_sec); - PARSE_IOTUNE(write_iops_sec); - - PARSE_IOTUNE(total_bytes_sec_max); - PARSE_IOTUNE(read_bytes_sec_max); - PARSE_IOTUNE(write_bytes_sec_max); - PARSE_IOTUNE(total_iops_sec_max); - PARSE_IOTUNE(read_iops_sec_max); - PARSE_IOTUNE(write_iops_sec_max); - - PARSE_IOTUNE(size_iops_sec); - - PARSE_IOTUNE(total_bytes_sec_max_length); - PARSE_IOTUNE(read_bytes_sec_max_length); - PARSE_IOTUNE(write_bytes_sec_max_length); - PARSE_IOTUNE(total_iops_sec_max_length); - PARSE_IOTUNE(read_iops_sec_max_length); - PARSE_IOTUNE(write_iops_sec_max_length); + g_autofree unsigned long long **fields =3D + virDomainBlockIoTuneFields(&def->blkdeviotune); + size_t i; + + for (i =3D 0; i < G_N_ELEMENTS(virDomainBlockIoTuneFieldNames); i++) { + const char *name =3D virDomainBlockIoTuneFieldNames[i]; + g_autofree char *sel =3D g_strdup_printf("string(./iotune/%s)", na= me); + + if (virXPathULongLong(sel, ctxt, fields[i]) =3D=3D -2) { + virReportError(VIR_ERR_XML_ERROR, + _("disk iotune field '%s' must be an integer"), + name); + return -1; + } + } =20 def->blkdeviotune.group_name =3D virXPathString("string(./iotune/group_name)", ctxt); @@ -8738,7 +8778,6 @@ virDomainDiskDefIotuneParse(virDomainDiskDefPtr def, =20 return 0; } -#undef PARSE_IOTUNE =20 =20 static int --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359733; cv=none; d=zohomail.com; s=zohoarc; b=bA2AkxclwlWfeMjDDnHk0NsSgwNulJY8dcoOJViN+BOh5tG/ET6bGo6YJVDXuMh1gQLdbnooW2uDRK3oYfp2HYNvdvviM8NwCpNhf8h2JQRuUEyNLlmu8Wh2qz0k3M8O21JxUUB5I23rnQ8g8zdmeqrJedaM3rXs4/Wjhe1KtTg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359733; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=L4trxg1OUj+86RjYVw/uhf8ppMYSLi8K5lJY+a/liy4=; b=kSF2HbaAxl5AK+EK7Jz8xk1oV5YoFIKKhBNNswZx5eLnPx5N2qUZw6zi2Mkz7Suu7qeJ/U2rKDrNtSmyqlnbOTBNUpQ51M0Z4YRXmSCOyF97WB6k+wOFhqFNo1XYm6GROq5eU1UNXLjn3HQdcH0UzHIctZLjzBcl8xQOmVtY8Z0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359733071944.9655435639559; Mon, 11 Jan 2021 02:08:53 -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-503-dypq_shPOqC6DZyKPhjpoA-1; Mon, 11 Jan 2021 05:08:49 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id A5E30CC629; Mon, 11 Jan 2021 10:08:43 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D522C19D9F; Mon, 11 Jan 2021 10:08:42 +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 148F21809C9F; Mon, 11 Jan 2021 10:08:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA8eqT016538 for ; Mon, 11 Jan 2021 05:08:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 03B622166B2B; Mon, 11 Jan 2021 10:08:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast02.extmail.prod.ext.rdu2.redhat.com [10.11.55.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id F0CD92166B2A for ; Mon, 11 Jan 2021 10:08:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0684A8007D9 for ; Mon, 11 Jan 2021 10:08:37 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-227-n0W0pxrQPiitZycQKL6HpQ-1; Mon, 11 Jan 2021 05:08:34 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu6g-00GBOE-7T for libvir-list@redhat.com; Mon, 11 Jan 2021 13:07:26 +0300 X-MC-Unique: dypq_shPOqC6DZyKPhjpoA-1 X-MC-Unique: n0W0pxrQPiitZycQKL6HpQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 17/23] conf: get rid of macros in virDomainDiskDefFormatIotune Date: Mon, 11 Jan 2021 12:50:10 +0300 Message-Id: <1610358616-567804-18-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 024d0e3..bbe6ae7 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -24225,54 +24225,30 @@ virDomainDiskBackingStoreFormat(virBufferPtr buf, } =20 =20 -#define FORMAT_IOTUNE(val) \ - if (disk->blkdeviotune.val) { \ - virBufferAsprintf(&childBuf, "<" #val ">%llu\n", \ - disk->blkdeviotune.val); \ - } - static void virDomainDiskDefFormatIotune(virBufferPtr buf, virDomainDiskDefPtr disk) { g_auto(virBuffer) childBuf =3D VIR_BUFFER_INIT_CHILD(buf); + g_autofree unsigned long long **fields =3D + virDomainBlockIoTuneFields(&disk->blkdeviotune= ); + size_t i; =20 - FORMAT_IOTUNE(total_bytes_sec); - FORMAT_IOTUNE(read_bytes_sec); - FORMAT_IOTUNE(write_bytes_sec); - FORMAT_IOTUNE(total_iops_sec); - FORMAT_IOTUNE(read_iops_sec); - FORMAT_IOTUNE(write_iops_sec); - - FORMAT_IOTUNE(total_bytes_sec_max); - FORMAT_IOTUNE(read_bytes_sec_max); - FORMAT_IOTUNE(write_bytes_sec_max); - FORMAT_IOTUNE(total_iops_sec_max); - FORMAT_IOTUNE(read_iops_sec_max); - FORMAT_IOTUNE(write_iops_sec_max); + for (i =3D 0; i < G_N_ELEMENTS(virDomainBlockIoTuneFieldNames); i++) { + const char *name =3D virDomainBlockIoTuneFieldNames[i]; =20 - if (disk->blkdeviotune.size_iops_sec) { - virBufferAsprintf(&childBuf, "%llu\= n", - disk->blkdeviotune.size_iops_sec); + if (*fields[i]) + virBufferAsprintf(&childBuf, "<%s>%llu\n", + name, *fields[i], name); } =20 - if (disk->blkdeviotune.group_name) { + if (disk->blkdeviotune.group_name) virBufferEscapeString(&childBuf, "%s\n", disk->blkdeviotune.group_name); - } - - FORMAT_IOTUNE(total_bytes_sec_max_length); - FORMAT_IOTUNE(read_bytes_sec_max_length); - FORMAT_IOTUNE(write_bytes_sec_max_length); - FORMAT_IOTUNE(total_iops_sec_max_length); - FORMAT_IOTUNE(read_iops_sec_max_length); - FORMAT_IOTUNE(write_iops_sec_max_length); =20 virXMLFormatElement(buf, "iotune", NULL, &childBuf); } =20 -#undef FORMAT_IOTUNE - =20 static void virDomainDiskDefFormatDriver(virBufferPtr buf, --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359793; cv=none; d=zohomail.com; s=zohoarc; b=kkHiWCpunHuZNMSipArKRDCevF5Eyfx4GMscuzw++0lLY5rMzv+hxq8MK+c+Mv8NUlSGQUcOxucXkUltLiPUKwfxx0EI+oF5VODAGJggmX871ylu2NIWzGrLqLQ7bf8iSz+UbUHyQ219+ushJpxRoVla2pxbBZOYOfKIJpPsqOg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359793; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=tzBcI2l32YPgjLOyFrnf3bWgtOM0qAymwpfEGMrp4hY=; b=dW2iY+D6rCdf6oSYhogsmkDDW77WHSzltKGa22Xm1mUyqPKY2Ll4SbHwinLI40Y/Po97eBzkPoWCNGKWp4Y24g+tnyNZr8Ad63iHD2i3lqzbe/vAzaw2Hq5bcUM2xZNxnb9Mg9HmLP4KoALwKwlSRjA2splBwVHkNkHbve9nP4w= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610359793171523.8452717562772; Mon, 11 Jan 2021 02:09:53 -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-418-mWDSys4dO6Ssx7xcu3fspw-1; Mon, 11 Jan 2021 05:09:49 -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 1895FCC62D; Mon, 11 Jan 2021 10:09:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3CAF210013BD; Mon, 11 Jan 2021 10:09:42 +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 4A9F9180954D; Mon, 11 Jan 2021 10:09:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BA9c7H016630 for ; Mon, 11 Jan 2021 05:09:39 -0500 Received: by smtp.corp.redhat.com (Postfix) id CABF44E3C5; Mon, 11 Jan 2021 10:09:38 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast01.extmail.prod.ext.rdu2.redhat.com [10.11.55.17]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C5B955AB7F for ; Mon, 11 Jan 2021 10:09:36 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A2D7C858281 for ; Mon, 11 Jan 2021 10:09:36 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-349-qtPogi65Mg6t3eygg8PEwQ-1; Mon, 11 Jan 2021 05:09:34 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu7d-00GBOE-KN for libvir-list@redhat.com; Mon, 11 Jan 2021 13:08:25 +0300 X-MC-Unique: mWDSys4dO6Ssx7xcu3fspw-1 X-MC-Unique: qtPogi65Mg6t3eygg8PEwQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 18/23] conf: add virDomainBlockIoTuneFromParams Date: Mon, 11 Jan 2021 12:50:11 +0300 Message-Id: <1610358616-567804-19-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It will be used as a replacement for macros code converting params to iotune structure. Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 32 ++++++++++++++++++++++++++++++++ src/conf/domain_conf.h | 6 ++++++ src/libvirt_private.syms | 1 + 3 files changed, 39 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index bbe6ae7..aa6a2a8 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31741,6 +31741,38 @@ virDomainBlockIoTuneInfoEqual(const virDomainBlock= IoTuneInfo *a, } =20 =20 +int +virDomainBlockIoTuneFromParams(virTypedParameterPtr params, + int nparams, + virDomainBlockIoTuneInfoPtr iotune, + virDomainBlockIoTuneInfoPtr set) +{ + g_autofree unsigned long long **fields =3D virDomainBlockIoTuneFields(= iotune); + g_autofree unsigned long long **set_fields =3D virDomainBlockIoTuneFie= lds(set); + const char *group_name =3D NULL; + size_t i; + + for (i =3D 0; i < G_N_ELEMENTS(virDomainBlockIoTuneFieldNames); i++) { + const char *name =3D virDomainBlockIoTuneFieldNames[i]; + int rc; + + rc =3D virTypedParamsGetULLong(params, nparams, name, fields[i]); + if (rc < 0) + return -1; + if (rc =3D=3D 1) + *set_fields[i] =3D 1; + } + + if (virTypedParamsGetString(params, nparams, + VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME, + &group_name) < 0) + return -1; + iotune->group_name =3D g_strdup(group_name); + + return 0; +} + + /** * virHostdevIsSCSIDevice: * @hostdev: host device to check diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 3c42313..e511939 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3949,6 +3949,12 @@ bool virDomainBlockIoTuneInfoEqual(const virDomainBlockIoTuneInfo *a, const virDomainBlockIoTuneInfo *b); =20 +int +virDomainBlockIoTuneFromParams(virTypedParameterPtr params, + int nparams, + virDomainBlockIoTuneInfoPtr iotune, + virDomainBlockIoTuneInfoPtr set); + bool virDomainDriveAddressIsUsedByDisk(const virDomainDef *def, virDomainDiskBus bus_type, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index bfe3ee7..bc42df0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -230,6 +230,7 @@ virDomainAudioTypeTypeFromString; virDomainAudioTypeTypeToString; virDomainBlockedReasonTypeFromString; virDomainBlockedReasonTypeToString; +virDomainBlockIoTuneFromParams; virDomainBlockIoTuneInfoCopy; virDomainBlockIoTuneInfoEqual; virDomainBlockIoTuneInfoHasAny; --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359849; cv=none; d=zohomail.com; s=zohoarc; b=JhN3iTDxbNZYTlRs5KciiLehBo8uThx8urlbvPorOO/iV1tCWS+uyUFcgQjZL3nWRaATR3P2nHgaOLvdFQvlb0oeJoWxsk1TlQpzraYQNBvPDpoh+9vPAJmKhdK6VKW8Um5rXc5OxEjEtHpMHrxC4UbxieQf8QdTX7/f34xlHpM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359849; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=qHqUAmHqX5yaBfRj3d4YYFcDTAdZ2BIbL3/OyfMULcg=; b=TsgcGeps1o9jGBnHafKM+M1fmR/AFq9Pusz4hIzmE9ckg2jjNHSpDMHkqmReGZ4U2nmJzVZLtXOUE7hD3D/7oL6iOuUOa/qov1S4/TjlBNFusCkg6QLgUx5+nDcLaYia9py5k6busi2zEvWdIFgxZ2anTRAQUcxqiyD4SfCkJyM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610359849733803.136701763502; Mon, 11 Jan 2021 02:10:49 -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-187-Iba8ffPOPhm67OwFxvJ3Ow-1; Mon, 11 Jan 2021 05:10:46 -0500 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id AACCE803635; Mon, 11 Jan 2021 10:10:39 +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 7496219D9D; Mon, 11 Jan 2021 10:10:39 +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 F23724BB7B; Mon, 11 Jan 2021 10:10:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BAAbZl016747 for ; Mon, 11 Jan 2021 05:10:37 -0500 Received: by smtp.corp.redhat.com (Postfix) id 906504E623; Mon, 11 Jan 2021 10:10:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast06.extmail.prod.ext.rdu2.redhat.com [10.11.55.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8B38F4E3C5 for ; Mon, 11 Jan 2021 10:10:35 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 63115185A7BC for ; Mon, 11 Jan 2021 10:10:35 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-206-b_X1GdHFMLmAr0fn12B1iQ-1; Mon, 11 Jan 2021 05:10:33 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu8a-00GBOE-VX for libvir-list@redhat.com; Mon, 11 Jan 2021 13:09:24 +0300 X-MC-Unique: Iba8ffPOPhm67OwFxvJ3Ow-1 X-MC-Unique: b_X1GdHFMLmAr0fn12B1iQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 19/23] conf: add virDomainBlockIoTuneToEventParams Date: Mon, 11 Jan 2021 12:50:12 +0300 Message-Id: <1610358616-567804-20-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It will be used as a replacement for macros code adding event params. Signed-off-by: Nikolay Shirokovskiy --- src/conf/domain_conf.c | 53 ++++++++++++++++++++++++++++++++++++++++++++= ++++ src/conf/domain_conf.h | 7 +++++++ src/libvirt_private.syms | 1 + 3 files changed, 61 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index aa6a2a8..7e91654 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -31773,6 +31773,59 @@ virDomainBlockIoTuneFromParams(virTypedParameterPt= r params, } =20 =20 +static const char* virDomainBlockIoTuneFieldEventNames[] =3D { + VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC, + VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC, + VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC, + VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC, + VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC, + VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC, + VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX, + VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX, + VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX, + VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX, + VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX, + VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX, + VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC, + VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH, + VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH, + VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH, + VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH, + VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH, + VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH, +}; + + +int +virDomainBlockIoTuneToEventParams(virDomainBlockIoTuneInfoPtr iotune, + virDomainBlockIoTuneInfoPtr set, + virTypedParameterPtr *params, + int *nparams, + int *maxparams) +{ + g_autofree unsigned long long **fields =3D virDomainBlockIoTuneFields(= iotune); + g_autofree unsigned long long **set_fields =3D virDomainBlockIoTuneFie= lds(set); + size_t i; + + for (i =3D 0; i < G_N_ELEMENTS(virDomainBlockIoTuneFieldEventNames); i= ++) { + const char *name =3D virDomainBlockIoTuneFieldEventNames[i]; + + if (*set_fields[i] && + virTypedParamsAddULLong(params, nparams, maxparams, + name, *fields[i]) < 0) + return -1; + } + + if (iotune->group_name && + virTypedParamsAddString(params, nparams, maxparams, + VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME, + iotune->group_name) < 0) + return -1; + + return 0; +} + + /** * virHostdevIsSCSIDevice: * @hostdev: host device to check diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e511939..ea18720 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3955,6 +3955,13 @@ virDomainBlockIoTuneFromParams(virTypedParameterPtr = params, virDomainBlockIoTuneInfoPtr iotune, virDomainBlockIoTuneInfoPtr set); =20 +int +virDomainBlockIoTuneToEventParams(virDomainBlockIoTuneInfoPtr iotune, + virDomainBlockIoTuneInfoPtr set, + virTypedParameterPtr *params, + int *nparams, + int *maxparams); + bool virDomainDriveAddressIsUsedByDisk(const virDomainDef *def, virDomainDiskBus bus_type, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index bc42df0..e71b580 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -237,6 +237,7 @@ virDomainBlockIoTuneInfoHasAny; virDomainBlockIoTuneInfoHasBasic; virDomainBlockIoTuneInfoHasMax; virDomainBlockIoTuneInfoHasMaxLength; +virDomainBlockIoTuneToEventParams; virDomainBlockIoTuneValidate; virDomainBootTypeFromString; virDomainBootTypeToString; --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359911; cv=none; d=zohomail.com; s=zohoarc; b=T22orsr9KUiLYtEAgS98Kbh4dgQBaL0WWK4t2+lI040JMt9qKvqZxIu80abvdUnbAOvmFlJ9c18q6LkI+/tll14fK4OO1nIDps3pKk+eaxBfgGlCc3NuS5HBMduRQDkSrzYzmBSPVBeDPbz9GhmvU4XWDp12+dPS8K3cndEATLI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359911; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=HFIs8TX32aPofBVGHCQq1p6zw7vAxMfAvrW5JqG2oG4=; b=fGKctNE2b5vX3ndjLQy4ZpvbwPRosUv+UC3YiD5StYqf8nUQZ7yroKRts2VFe++Qws0QlT3Wp5Yg1s1Sb/1rtSgTnGl9803WzyO8+x39iR2TCInqeLPLGSL1kXhE877qHYyPBiSd+y4qHrlBYpJM0r0UahLB0h63gvRTgi6yPsk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610359911360271.8956322524525; Mon, 11 Jan 2021 02:11:51 -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-426-C8OThLN1PPGHX_YmNf-1EA-1; Mon, 11 Jan 2021 05:11:48 -0500 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id CFDB1100F342; Mon, 11 Jan 2021 10:11:42 +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 ACAEB6F44B; Mon, 11 Jan 2021 10:11:42 +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 69EFF4BB7B; Mon, 11 Jan 2021 10:11:42 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BABexn016903 for ; Mon, 11 Jan 2021 05:11:40 -0500 Received: by smtp.corp.redhat.com (Postfix) id 5EC912166B2A; Mon, 11 Jan 2021 10:11:40 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 5895D2166B2E for ; Mon, 11 Jan 2021 10:11:37 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 82D1E811E78 for ; Mon, 11 Jan 2021 10:11:37 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-386-irDvsvZwNVGrIDxMcxwniw-1; Mon, 11 Jan 2021 05:11:32 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyu9Y-00GBOE-Dc for libvir-list@redhat.com; Mon, 11 Jan 2021 13:10:24 +0300 X-MC-Unique: C8OThLN1PPGHX_YmNf-1EA-1 X-MC-Unique: irDvsvZwNVGrIDxMcxwniw-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 20/23] qemu: qemuDomainSetBlockIoTune use functions to convert to/from params Date: Mon, 11 Jan 2021 12:50:13 +0300 Message-Id: <1610358616-567804-21-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Best viewed with --patience. Signed-off-by: Nikolay Shirokovskiy --- src/qemu/qemu_driver.c | 72 ++++++----------------------------------------= ---- 1 file changed, 8 insertions(+), 64 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 29c93de..8bcb876 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -16039,7 +16039,6 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, g_autofree char *drivealias =3D NULL; const char *qdevid =3D NULL; int ret =3D -1; - size_t i; virDomainDiskDefPtr conf_disk =3D NULL; virDomainDiskDefPtr disk; virDomainBlockIoTuneInfo set_fields; @@ -16121,72 +16120,17 @@ qemuDomainSetBlockIoTune(virDomainPtr dom, if (virDomainObjGetDefs(vm, flags, &def, &persistentDef) < 0) goto endjob; =20 - if (virTypedParamsAddString(&eventParams, &eventNparams, &eventMaxpara= ms, - VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0) + if (virDomainBlockIoTuneFromParams(params, nparams, &info, &set_fields= ) < 0) goto endjob; =20 -#define SET_IOTUNE_FIELD(FIELD, CONST) \ - if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_##CONST)) { \ - info.FIELD =3D param->value.ul; \ - set_fields.FIELD =3D 1; \ - if (virTypedParamsAddULLong(&eventParams, &eventNparams, \ - &eventMaxparams, \ - VIR_DOMAIN_TUNABLE_BLKDEV_##CONST, \ - param->value.ul) < 0) \ - goto endjob; \ - continue; \ - } - - for (i =3D 0; i < nparams; i++) { - virTypedParameterPtr param =3D ¶ms[i]; - - SET_IOTUNE_FIELD(total_bytes_sec, TOTAL_BYTES_SEC); - SET_IOTUNE_FIELD(read_bytes_sec, READ_BYTES_SEC); - SET_IOTUNE_FIELD(write_bytes_sec, WRITE_BYTES_SEC); - SET_IOTUNE_FIELD(total_iops_sec, TOTAL_IOPS_SEC); - SET_IOTUNE_FIELD(read_iops_sec, READ_IOPS_SEC); - SET_IOTUNE_FIELD(write_iops_sec, WRITE_IOPS_SEC); - - SET_IOTUNE_FIELD(total_bytes_sec_max, - TOTAL_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(read_bytes_sec_max, - READ_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(write_bytes_sec_max, - WRITE_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(total_iops_sec_max, - TOTAL_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(read_iops_sec_max, - READ_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(write_iops_sec_max, - WRITE_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(size_iops_sec, SIZE_IOPS_SEC); - - /* NB: Cannot use macro since this is a value.s not a value.ul */ - if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME)) { - info.group_name =3D g_strdup(param->value.s); - if (virTypedParamsAddString(&eventParams, &eventNparams, - &eventMaxparams, - VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NA= ME, - param->value.s) < 0) - goto endjob; - continue; - } - - SET_IOTUNE_FIELD(total_bytes_sec_max_length, - TOTAL_BYTES_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(read_bytes_sec_max_length, - READ_BYTES_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(write_bytes_sec_max_length, - WRITE_BYTES_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(total_iops_sec_max_length, - TOTAL_IOPS_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(read_iops_sec_max_length, - READ_IOPS_SEC_MAX_LENGTH); - SET_IOTUNE_FIELD(write_iops_sec_max_length, - WRITE_IOPS_SEC_MAX_LENGTH); - } + if (virDomainBlockIoTuneToEventParams(&info, &set_fields, + &eventParams, + &eventNparams, &eventMaxparams) = < 0) + goto endjob; =20 -#undef SET_IOTUNE_FIELD + if (virTypedParamsAddString(&eventParams, &eventNparams, &eventMaxpara= ms, + VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0) + goto endjob; =20 if (virDomainBlockIoTuneValidate(&info) < 0) goto endjob; --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) client-ip=63.128.21.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610359969; cv=none; d=zohomail.com; s=zohoarc; b=Vnz1tZ09QWcaiJ6rAT0V1o3gjZFbgKfFg5S9D5ikCmyCbbpb3Il+aOXH5dUsYdXq6XGCBk1gd93eC/jsrfL4v8uKxB9hlUasoctkkVg2NJ9oePpE/OmoAfr6mAXJjW54JSxDoIpOfRnNNZ+ibTcxXAe86nsL042oRHtLIcWkoww= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610359969; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=OSzSP9m3+8XHQJpK5xQdK9iuq43X55Dvdy0+IcPAim8=; b=cBRVxa0XZ+vWIb+qT85TbqOnqrvLdDm10ezOBrvWn0mUIk7rVFGKJJoet1qVOxGn4+lQvStrM1RamdrjQTdufAeAdHWu8BbEGUuvWc92WuqQtRjndeN/6wIfpWdgOSZXGtQSb9nXmOtE6IQH0wXJJcz/qD7jNYW+IG31sGGzeo0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 1610359968805101.03162601667134; Mon, 11 Jan 2021 02:12: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-550-W5QppzOvNk6vZHmsdvX_ZA-1; Mon, 11 Jan 2021 05:12:44 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0B28C190B2A2; Mon, 11 Jan 2021 10:12:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DA1094D740; Mon, 11 Jan 2021 10:12:38 +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 A4312180954D; Mon, 11 Jan 2021 10:12:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BACc5Q017029 for ; Mon, 11 Jan 2021 05:12:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id DEA53100405B; Mon, 11 Jan 2021 10:12:37 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DAE721004149 for ; Mon, 11 Jan 2021 10:12:34 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-2.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7CE6C811E78 for ; Mon, 11 Jan 2021 10:12:34 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-587-tGhXxbUCOh2Z-BvkzuWRDA-1; Mon, 11 Jan 2021 05:12:32 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyuAV-00GBOE-SZ for libvir-list@redhat.com; Mon, 11 Jan 2021 13:11:24 +0300 X-MC-Unique: W5QppzOvNk6vZHmsdvX_ZA-1 X-MC-Unique: tGhXxbUCOh2Z-BvkzuWRDA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 21/23] test driver: remove TEST_BLOCK_IOTUNE_MAX checks Date: Mon, 11 Jan 2021 12:50:14 +0300 Message-Id: <1610358616-567804-22-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.3 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" The check is copied from qemu driver I guess and does not make much sense f= or test driver. This patch is a preparation step to get rid of macros in this place. And I guess it make sence just to drop this check instead of moving= to some function. Signed-off-by: Nikolay Shirokovskiy Reviewed-by: Peter Krempa --- src/test/test_driver.c | 9 --------- 1 file changed, 9 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 299be2a..58d3d79 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3599,8 +3599,6 @@ testDomainGetInterfaceParameters(virDomainPtr dom, } =20 =20 -#define TEST_BLOCK_IOTUNE_MAX 1000000000000000LL - static int testDomainSetBlockIoTune(virDomainPtr dom, const char *path, @@ -3699,13 +3697,6 @@ testDomainSetBlockIoTune(virDomainPtr dom, for (i =3D 0; i < nparams; i++) { virTypedParameterPtr param =3D ¶ms[i]; =20 - if (param->value.ul > TEST_BLOCK_IOTUNE_MAX) { - virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED, - _("block I/O throttle limit value must" - " be no more than %llu"), TEST_BLOCK_IOTUNE_M= AX); - goto cleanup; - } - SET_IOTUNE_FIELD(total_bytes_sec, VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC); --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610360087; cv=none; d=zohomail.com; s=zohoarc; b=mkNuSAXdqRQmHSDEgILknEeELh4QFc0I5fNzwmxGV3YUFKtnouarkGa8hwIn5XfplQwZ2fuker8U2d2kFzeoqa1HZ3lPCGlJ8sDoIs1LvlW3ucyQ+YK7T1R+63wpQuWD1qYbkOc4FcZhM2lKbf3aTNIusZw8is4RweWj2oMeDHE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610360087; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=S3OoQ3C0KU0juWCRrSeygE7PW4wii0S2u2fw8OSJaqM=; b=oHqSBfeZtk/j2BwhvJDJnoRjtBBXSRiROppOa6u+gU4WY2D1YnsBc9uEtc0ACyLOss/tR11hE9lLYr3dlWOeGRV0tvU9/vSG728f0HaV8MN7WUpduqHpluxFJmS/1lmkVk6q2eWdmaDP3Zac+3bVTBLV89IGh3ueA6trSiYSKcE= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 161036008773950.869694597327225; Mon, 11 Jan 2021 02:14:47 -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-453-4U7T8Sr_OoSBNSU2f8DWVw-1; Mon, 11 Jan 2021 05:14:44 -0500 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CCC7CC626; Mon, 11 Jan 2021 10:13:38 +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 6D91974451; Mon, 11 Jan 2021 10:13:38 +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 2385B4BB7B; Mon, 11 Jan 2021 10:13:38 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BADafQ017092 for ; Mon, 11 Jan 2021 05:13:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 98AAE4E3CA; Mon, 11 Jan 2021 10:13:36 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 937EC4E3C5 for ; Mon, 11 Jan 2021 10:13:34 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 71EBA811E9F for ; Mon, 11 Jan 2021 10:13:34 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-181-7xGvXATvPAmZOZkB68iDwQ-1; Mon, 11 Jan 2021 05:13:31 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyuBT-00GBOE-22 for libvir-list@redhat.com; Mon, 11 Jan 2021 13:12:23 +0300 X-MC-Unique: 4U7T8Sr_OoSBNSU2f8DWVw-1 X-MC-Unique: 7xGvXATvPAmZOZkB68iDwQ-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 22/23] test driver: prepare to delete macros in testDomainSetBlockIoTune Date: Mon, 11 Jan 2021 12:50:15 +0300 Message-Id: <1610358616-567804-23-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 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.16 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" We are going to delete macros for converting from params/adding event param= s. Thus let's make macros conform to existing virDomainBlockIoTuneFromParams. Signed-off-by: Nikolay Shirokovskiy --- src/test/test_driver.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 58d3d79..fba94b9 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3677,7 +3677,6 @@ testDomainSetBlockIoTune(virDomainPtr dom, } =20 info =3D conf_disk->blkdeviotune; - info.group_name =3D g_strdup(conf_disk->blkdeviotune.group_name); =20 if (virTypedParamsAddString(&eventParams, &eventNparams, &eventMaxpara= ms, VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0) @@ -3739,7 +3738,6 @@ testDomainSetBlockIoTune(virDomainPtr dom, VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC); =20 if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME)) { - VIR_FREE(info.group_name); info.group_name =3D g_strdup(param->value.s); if (virTypedParamsAddString(&eventParams, &eventNparams, @@ -3771,6 +3769,9 @@ testDomainSetBlockIoTune(virDomainPtr dom, } #undef SET_IOTUNE_FIELD =20 + if (!info.group_name) + info.group_name =3D g_strdup(conf_disk->blkdeviotune.group_name); + if (virDomainBlockIoTuneValidate(&info) < 0) goto cleanup; =20 --=20 1.8.3.1 From nobody Thu Apr 25 23:33:02 2024 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; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=virtuozzo.com ARC-Seal: i=1; a=rsa-sha256; t=1610360148; cv=none; d=zohomail.com; s=zohoarc; b=RSAzo68bgOhmHqNIHzuhnwZRFGGOaqNeazzggEHNJxqRDgaH8EIf7DNfsyagGRZ6TM8sKjytGF1MQMqf54oUWgosf6gYKiYz0nEDT6h71M/XO7lsHkOO8REHTcRYtdPkbvFSCDke/sSBEEORVLXv892pmVxhP9jiid51qyHVoB4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610360148; h=Content-Type:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=O4Ol0t6sopwrqr5JtemJk9pFN5ZZ13Ge7WwEOkPP8sE=; b=C2KE3fA8ssvPKoI7rreYUk6nBUHsnwYGKlwse8uO82jr+Ac7z8m/HsL7AX2eKD0ZvFjNcbspWissqUKKTcjdVglmMCBPvxJEXk9t0JI9GEl/HR1WtRDV7otn+NCCGxe1/evZsLF/7otzQWmye6gaJ3YLp8QLA5IC8n0S503O3q0= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail header.from= (p=quarantine dis=quarantine) 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 1610360148449565.0764223431057; Mon, 11 Jan 2021 02:15: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-339-V0OpoAD4NdS3KPi0o6-XDw-1; Mon, 11 Jan 2021 05:15:45 -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 41F66CE642; Mon, 11 Jan 2021 10:14:39 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A98345D6D5; Mon, 11 Jan 2021 10:14:38 +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 DB5C1180954D; Mon, 11 Jan 2021 10:14:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 10BAEack017159 for ; Mon, 11 Jan 2021 05:14:36 -0500 Received: by smtp.corp.redhat.com (Postfix) id 987C92166B2E; Mon, 11 Jan 2021 10:14:36 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast04.extmail.prod.ext.rdu2.redhat.com [10.11.55.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 93A4A2166B2B for ; Mon, 11 Jan 2021 10:14:33 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B652F101A560 for ; Mon, 11 Jan 2021 10:14:33 +0000 (UTC) Received: from relay3.sw.ru (relay.sw.ru [185.231.240.75]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-547-Wt8o2QK1NneMoU0Rd4WHoA-1; Mon, 11 Jan 2021 05:14:30 -0500 Received: from [10.28.15.168] (helo=vz7.sw.ru.) by relay3.sw.ru with esmtp (Exim 4.94) (envelope-from ) id 1kyuCQ-00GBOE-7l for libvir-list@redhat.com; Mon, 11 Jan 2021 13:13:22 +0300 X-MC-Unique: V0OpoAD4NdS3KPi0o6-XDw-1 X-MC-Unique: Wt8o2QK1NneMoU0Rd4WHoA-1 From: Nikolay Shirokovskiy To: libvir-list@redhat.com Subject: [PATCH 23/23] test driver: testDomainSetBlockIoTune: use functions to convert to/from params Date: Mon, 11 Jan 2021 12:50:16 +0300 Message-Id: <1610358616-567804-24-git-send-email-nshirokovskiy@virtuozzo.com> In-Reply-To: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> References: <1610358616-567804-1-git-send-email-nshirokovskiy@virtuozzo.com> X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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: 2 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Nikolay Shirokovskiy --- src/test/test_driver.c | 97 +++++-----------------------------------------= ---- 1 file changed, 9 insertions(+), 88 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index fba94b9..d0a7040 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -3609,11 +3609,11 @@ testDomainSetBlockIoTune(virDomainPtr dom, virDomainObjPtr vm =3D NULL; virDomainDefPtr def =3D NULL; virDomainBlockIoTuneInfo info =3D {0}; + virDomainBlockIoTuneInfo set_fields =3D {0}; virDomainDiskDefPtr conf_disk =3D NULL; virTypedParameterPtr eventParams =3D NULL; int eventNparams =3D 0; int eventMaxparams =3D 0; - size_t i; int ret =3D -1; =20 virCheckFlags(VIR_DOMAIN_AFFECT_LIVE | @@ -3678,96 +3678,17 @@ testDomainSetBlockIoTune(virDomainPtr dom, =20 info =3D conf_disk->blkdeviotune; =20 - if (virTypedParamsAddString(&eventParams, &eventNparams, &eventMaxpara= ms, - VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0) + if (virDomainBlockIoTuneFromParams(params, nparams, &info, &set_fields= ) < 0) goto cleanup; =20 -#define SET_IOTUNE_FIELD(FIELD, STR, TUNABLE_STR) \ - if (STREQ(param->field, STR)) { \ - info.FIELD =3D param->value.ul; \ - if (virTypedParamsAddULLong(&eventParams, &eventNparams, \ - &eventMaxparams, \ - TUNABLE_STR, \ - param->value.ul) < 0) \ - goto cleanup; \ - continue; \ - } - - for (i =3D 0; i < nparams; i++) { - virTypedParameterPtr param =3D ¶ms[i]; - - SET_IOTUNE_FIELD(total_bytes_sec, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC, - VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC); - SET_IOTUNE_FIELD(read_bytes_sec, - VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC, - VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC); - SET_IOTUNE_FIELD(write_bytes_sec, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC, - VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC); - SET_IOTUNE_FIELD(total_iops_sec, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC, - VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC); - SET_IOTUNE_FIELD(read_iops_sec, - VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC, - VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC); - SET_IOTUNE_FIELD(write_iops_sec, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC, - VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC); - - SET_IOTUNE_FIELD(total_bytes_sec_max, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX, - VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(read_bytes_sec_max, - VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX, - VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(write_bytes_sec_max, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX, - VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX); - SET_IOTUNE_FIELD(total_iops_sec_max, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX, - VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(read_iops_sec_max, - VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX, - VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(write_iops_sec_max, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX, - VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX); - SET_IOTUNE_FIELD(size_iops_sec, - VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC, - VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC); - - if (STREQ(param->field, VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME)) { - info.group_name =3D g_strdup(param->value.s); - if (virTypedParamsAddString(&eventParams, - &eventNparams, - &eventMaxparams, - VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NA= ME, - param->value.s) < 0) - goto cleanup; - continue; - } + if (virDomainBlockIoTuneToEventParams(&info, &set_fields, + &eventParams, + &eventNparams, &eventMaxparams) = < 0) + goto cleanup; =20 - SET_IOTUNE_FIELD(total_bytes_sec_max_length, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGT= H, - VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LEN= GTH); - SET_IOTUNE_FIELD(read_bytes_sec_max_length, - VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH, - VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENG= TH); - SET_IOTUNE_FIELD(write_bytes_sec_max_length, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGT= H, - VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LEN= GTH); - SET_IOTUNE_FIELD(total_iops_sec_max_length, - VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH, - VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENG= TH); - SET_IOTUNE_FIELD(read_iops_sec_max_length, - VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH, - VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGT= H); - SET_IOTUNE_FIELD(write_iops_sec_max_length, - VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH, - VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENG= TH); - } -#undef SET_IOTUNE_FIELD + if (virTypedParamsAddString(&eventParams, &eventNparams, &eventMaxpara= ms, + VIR_DOMAIN_TUNABLE_BLKDEV_DISK, path) < 0) + goto cleanup; =20 if (!info.group_name) info.group_name =3D g_strdup(conf_disk->blkdeviotune.group_name); --=20 1.8.3.1