From nobody Wed May 15 14:37:52 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) client-ip=170.10.133.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 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=none dis=none) header.from=gmail.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.zohomail.com with SMTPS id 1648138221592259.63824953688993; Thu, 24 Mar 2022 09:10:21 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-548-rfwn6zXnP5aeZAr_f1xdCg-1; Thu, 24 Mar 2022 12:10:18 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id F0E283C16413; Thu, 24 Mar 2022 16:10:12 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id AA58040CFD18; Thu, 24 Mar 2022 16:10:11 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (localhost [IPv6:::1]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 5D177194034B; Thu, 24 Mar 2022 16:10:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 4E53E1940341 for ; Thu, 24 Mar 2022 16:10:10 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 1F9EF112132C; Thu, 24 Mar 2022 16:10:10 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast10.extmail.prod.ext.rdu2.redhat.com [10.11.55.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1B48D112131E for ; Thu, 24 Mar 2022 16:10:10 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 04A1D1C09048 for ; Thu, 24 Mar 2022 16:10:10 +0000 (UTC) Received: from mail-pj1-f51.google.com (mail-pj1-f51.google.com [209.85.216.51]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-114-1Y5dNN83NQCCQ_TUFa9EAQ-1; Thu, 24 Mar 2022 12:10:05 -0400 Received: by mail-pj1-f51.google.com with SMTP id o6-20020a17090a9f8600b001c6562049d9so5558196pjp.3 for ; Thu, 24 Mar 2022 09:10:05 -0700 (PDT) Received: from localhost.localdomain ([103.204.135.198]) by smtp.gmail.com with ESMTPSA id o17-20020a639a11000000b0038160e4a2f7sm3311916pge.48.2022.03.24.09.10.02 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 24 Mar 2022 09:10:03 -0700 (PDT) X-MC-Unique: rfwn6zXnP5aeZAr_f1xdCg-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: 1Y5dNN83NQCCQ_TUFa9EAQ-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=zajWR/0VP/5Gk6A0xiECH+TZdS0Bss1nTvGfaPA+300=; b=SrdR0TjvEkEntMkg4I3txKU3g398KiLWGyCFh5odOIPIDqPspD6fWcrFbLFXSsOFEz EkqIb5h3DtxTFM315z/0dGu128nV6FoAA67k6X/lxRMyqS3pd+Wj3OsEhdd45Dx3YUsH o8+d16gjdCwtDV3PMus7T04fpaAC0ZJSURqykjPwtxFTO0l7s9NRFYp70qLCPgFYXI/l RUGXHJ5CfXjzUYu08qT+4SXW+zNFnxoq6YFWOWqELK8Wm4gpIUGBzIotwL5xALjl3mv9 s1rNK3owUMvRraTJQZm+O+uaUDwLiDBSouhu/2UbB5Vt5RPG88bNQPEjpPor2Dg9sJYF WWKA== X-Gm-Message-State: AOAM530w8aOEu/qzaKULPldtQeGj4GdQqW/xXwfcxhUjDZv3XHYVPBCf ix4c7S27CEzwXr9YS4aQQmFUCOhfGkCYME2p X-Google-Smtp-Source: ABdhPJwr7Yfo2sYqf+D4103CehvHxmlYRdc1Go8Sg1cz9+1wxF9V1P86vfAx+pRuYJCbZhrdtyyfkg== X-Received: by 2002:a17:902:ba83:b0:154:727e:5fc5 with SMTP id k3-20020a170902ba8300b00154727e5fc5mr6851319pls.55.1648138204080; Thu, 24 Mar 2022 09:10:04 -0700 (PDT) From: Jamm02 X-Google-Original-From: Jamm02 To: libvir-list@redhat.com Subject: [PATCH] error message in virDomainDiskDefIotuneParse shifted to virDomainDefPostParseCheck Date: Thu, 24 Mar 2022 21:39:56 +0530 Message-Id: <20220324160956.41293-1-codeguy.moteen@gmail.com> MIME-Version: 1.0 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-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Moteen Shah Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 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-ZM-MESSAGEID: 1648138223933100001 Content-Type: text/plain; charset="utf-8"; x-default="true" From: Moteen Shah domain_conf.c: all the option collision total and... error messages in virDomainDiskDefIotuneParse shifted to new function virDomainDefPostParseCh= eck --- src/conf/domain_conf.c | 86 ++++++++++++++++++++++-------------------- 1 file changed, 45 insertions(+), 41 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 153954a0b0..f2480f37f6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -6229,6 +6229,50 @@ virDomainDefPostParseCheckFailure(virDomainDef *def, return 0; } =20 +static int +virDomainDefPostParseCheck(virDomainDiskDef *def) +{ + 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")); + 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; + } + return 0; +} =20 int virDomainDefPostParse(virDomainDef *def, @@ -8784,47 +8828,7 @@ virDomainDiskDefIotuneParse(virDomainDiskDef *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")); - 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; - } - - return 0; + return virDomainDefPostParseCheck(def); } #undef PARSE_IOTUNE =20 --=20 2.35.1