From nobody Mon Feb 9 17:22:47 2026 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