From nobody Sat May 4 16:23:57 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com 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 1613760946907474.9103822236506; Fri, 19 Feb 2021 10:55:46 -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-416-IEwsjfNyOHm3NjhHRKBUXA-1; Fri, 19 Feb 2021 13:55:43 -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 C83F1804036; Fri, 19 Feb 2021 18:55:37 +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 A4AB75D9C2; Fri, 19 Feb 2021 18:55:37 +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 2738E18095CE; Fri, 19 Feb 2021 18:55:37 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11JItYF9030340 for ; Fri, 19 Feb 2021 13:55:34 -0500 Received: by smtp.corp.redhat.com (Postfix) id DEE4960918; Fri, 19 Feb 2021 18:55:34 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5DBF86085D for ; Fri, 19 Feb 2021 18:55:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613760945; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=knIDWfNvFWfSJ3ha84qrkpv820UUcTFKnpt66ldvtzQ=; b=JD5pVKlr2rKd+LE/jTuhQouMip7DKykWjSO2O0f0UpGp/tnl7mPoZ6d99+70REqj50llbs xhm0o7afk9vzXV0fe9TF0xbCRM0RKCcgBYqO56PNZmuqOs7dh2k3RoqQ9tmSeAWKnn7GaQ H0tifrLslU2LFIu/zUREUF/5swgunWw= X-MC-Unique: IEwsjfNyOHm3NjhHRKBUXA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 1/2] domain_validate: use defines for cpu period and quota limits Date: Fri, 19 Feb 2021 19:55:28 +0100 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 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: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commints and <98a09ca48ed4fc011abf2aa290e02ce1b8f1bb5f> fixed the code to use defines instead of magic numbers but missed this place. Following commit changed the cpu quota limit to reflect what kernel actually allows so using the defines fixes XML validations as well. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- src/conf/domain_validate.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index b47ecba86b..b4e09e21fe 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -23,6 +23,7 @@ #include "domain_validate.h" #include "domain_conf.h" #include "snapshot_conf.h" +#include "vircgroup.h" #include "virconftypes.h" #include "virlog.h" #include "virutil.h" @@ -1200,10 +1201,13 @@ virDomainDefOSValidate(const virDomainDef *def, #define CPUTUNE_VALIDATE_PERIOD(name) \ do { \ if (def->cputune.name > 0 && \ - (def->cputune.name < 1000 || def->cputune.name > 1000000)) { \ + (def->cputune.name < VIR_CGROUP_CPU_PERIOD_MIN || \ + def->cputune.name > VIR_CGROUP_CPU_PERIOD_MAX)) { \ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ - _("Value of cputune '%s' must be in range " \ - "[1000, 1000000]"), #name); \ + _("Value of cputune '%s' must be in range [%llu= , %llu]"), \ + #name, \ + VIR_CGROUP_CPU_PERIOD_MIN, \ + VIR_CGROUP_CPU_PERIOD_MAX); \ return -1; \ } \ } while (0) @@ -1211,11 +1215,13 @@ virDomainDefOSValidate(const virDomainDef *def, #define CPUTUNE_VALIDATE_QUOTA(name) \ do { \ if (def->cputune.name > 0 && \ - (def->cputune.name < 1000 || \ - def->cputune.name > 18446744073709551LL)) { \ + (def->cputune.name < VIR_CGROUP_CPU_QUOTA_MIN || \ + def->cputune.name > VIR_CGROUP_CPU_QUOTA_MAX)) { \ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, \ - _("Value of cputune '%s' must be in range " \ - "[1000, 18446744073709551]"), #name); \ + _("Value of cputune '%s' must be in range [%llu= , %llu]"), \ + #name, \ + VIR_CGROUP_CPU_QUOTA_MIN, \ + VIR_CGROUP_CPU_QUOTA_MAX); \ return -1; \ } \ } while (0) --=20 2.29.2 From nobody Sat May 4 16:23:57 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1613760950; cv=none; d=zohomail.com; s=zohoarc; b=CXZDbCHoHS0YX4PU/HxrvUiqRedI4Hrq6HGC4I3F4Qwfq9ptEmRwC6+OfeEqOPNRjg3w1prtD3tkThrCo2j97zXDOKzN1r5NGxxiMe4J8JiyPzuJLq3yN3q/D9rRLD2KMEaQB5GQU84fuMvKIfVGIvphaEbzJot2POS4ppTe8Bs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1613760950; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=o+wdeKAr4JN40Gyw7ZwfakES9XozHdiKNMXCcJcmvwo=; b=OGUkTxo1PE86kq2ABgBaa1Oapx/N/dGTB5U4ZGMLxveODlKRsoCOnA0KY+XtqvYxmZnnn2o5XSDb9OKrlJbAYDRYqZ9lbtJaFANw2HP0gNjMvNPlNSJ1EuiP1JijA/EzNApBBvpisDgbrp4lcahVonuHX/rbDiepELTbxagHrf4= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 63.128.21.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by mx.zohomail.com with SMTPS id 161376095040817.584408282208756; Fri, 19 Feb 2021 10:55:50 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-194-OPRgcqQwM1u0J0A5CWOLBA-1; Fri, 19 Feb 2021 13:55:47 -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 E6D0D1E56A; Fri, 19 Feb 2021 18:55: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 BF6815D720; Fri, 19 Feb 2021 18:55: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 87CE657DFA; Fri, 19 Feb 2021 18:55:41 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 11JItcxX030357 for ; Fri, 19 Feb 2021 13:55:38 -0500 Received: by smtp.corp.redhat.com (Postfix) id 08D7317DC3; Fri, 19 Feb 2021 18:55:38 +0000 (UTC) Received: from antique-work.lan (unknown [10.40.192.13]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7B4CE6085D for ; Fri, 19 Feb 2021 18:55:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1613760949; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=o+wdeKAr4JN40Gyw7ZwfakES9XozHdiKNMXCcJcmvwo=; b=f4ONu/3RhirD15zA9PAR71gemGbVTU8wiouoMx1zaUO42IGwQ5mw8Pmsy3kWdYYdwGOXh6 wkP1E4VH0Zp78tD0hJlUFugve3EBi5jsaJ8D5ldsjqsBdpm9GIxlQBMU+ApGtA/MXbv78k jR4L5a6tBwb3VYMiMuTSldDnqnNoksg= X-MC-Unique: OPRgcqQwM1u0J0A5CWOLBA-1 From: Pavel Hrdina To: libvir-list@redhat.com Subject: [libvirt PATCH 2/2] docs: use proper cpu quota value in our documentation Date: Fri, 19 Feb 2021 19:55:29 +0100 Message-Id: <8f3f6a1a05220319ded0d33084c908b45537fae8.1613760868.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" Commit changed the cpu quota value that reflects what kernel allows but did not update our documentation. Signed-off-by: Pavel Hrdina Reviewed-by: Michal Privoznik --- docs/formatdomain.rst | 8 ++++---- docs/manpages/virsh.rst | 2 +- docs/schemas/domaincommon.rng | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst index 2587106191..e23bcc3e5a 100644 --- a/docs/formatdomain.rst +++ b/docs/formatdomain.rst @@ -754,7 +754,7 @@ CPU Tuning microseconds). A domain with ``quota`` as any negative value indicates = that the domain has infinite bandwidth for vCPU threads, which means that it= is not bandwidth controlled. The value should be in range [1000, - 18446744073709551] or less than 0. A quota with value 0 means no value.= You + 17592186044415] or less than 0. A quota with value 0 means no value. You can use this feature to ensure that all vCPUs run at the same speed. :since:`Only QEMU driver support since 0.9.4, LXC since 0.9.10` ``global_period`` @@ -768,7 +768,7 @@ CPU Tuning (unit: microseconds) within a period for the whole domain. A domain with ``global_quota`` as any negative value indicates that the domain has in= finite bandwidth, which means that it is not bandwidth controlled. The value s= hould - be in range [1000, 18446744073709551] or less than 0. A ``global_quota`= ` with + be in range [1000, 17592186044415] or less than 0. A ``global_quota`` w= ith value 0 means no value. :since:`Only QEMU driver support since 1.3.3` ``emulator_period`` The optional ``emulator_period`` element specifies the enforcement inte= rval @@ -783,7 +783,7 @@ CPU Tuning vCPUs). A domain with ``emulator_quota`` as any negative value indicate= s that the domain has infinite bandwidth for emulator threads (those excluding vCPUs), which means that it is not bandwidth controlled. The value shou= ld be - in range [1000, 18446744073709551] or less than 0. A quota with value 0= means + in range [1000, 17592186044415] or less than 0. A quota with value 0 me= ans no value. :since:`Only QEMU driver support since 0.10.0` ``iothread_period`` The optional ``iothread_period`` element specifies the enforcement inte= rval @@ -797,7 +797,7 @@ CPU Tuning bandwidth (unit: microseconds) for IOThreads. A domain with ``iothread_quota`` as any negative value indicates that the domain IOTh= reads have infinite bandwidth, which means that it is not bandwidth controlle= d. The - value should be in range [1000, 18446744073709551] or less than 0. An + value should be in range [1000, 17592186044415] or less than 0. An ``iothread_quota`` with value 0 means no value. You can use this featur= e to ensure that all IOThreads run at the same speed. :since:`Only QEMU driv= er support since 2.1.0` diff --git a/docs/manpages/virsh.rst b/docs/manpages/virsh.rst index e3afa48f7b..8a4328faa0 100644 --- a/docs/manpages/virsh.rst +++ b/docs/manpages/virsh.rst @@ -3818,7 +3818,7 @@ XEN_CREDIT scheduler. ``Note``: The vcpu_period, emulator_period, and iothread_period parameters have a valid value range of 1000-1000000 or 0, and the vcpu_quota, emulator_quota, and iothread_quota parameters have a valid value range of -1000-18446744073709551 or less than 0. The value 0 for +1000-17592186044415 or less than 0. The value 0 for either parameter is the same as not specifying that parameter. =20 =20 diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index e6de934456..d73db65742 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -7010,7 +7010,7 @@ -?[0-9]+ - 18446744073709551 + 17592186044415 -1 --=20 2.29.2