From nobody Sun May 12 15:55:36 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 1649680729065309.3092121662181; Mon, 11 Apr 2022 05:38:49 -0700 (PDT) Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-410-c9ICERJ9OLu4z5vU4VFyuw-1; Mon, 11 Apr 2022 08:38:42 -0400 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B257C85A5BE; Mon, 11 Apr 2022 12:38:40 +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 2273B432475; Mon, 11 Apr 2022 12:38:40 +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 DE77019451F2; Mon, 11 Apr 2022 12:38:39 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id A49B619466DF for ; Mon, 11 Apr 2022 12:38:38 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 86D51145B993; Mon, 11 Apr 2022 12:38:38 +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 82686145B991 for ; Mon, 11 Apr 2022 12:38:38 +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-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 67F6A80159B for ; Mon, 11 Apr 2022 12:38:38 +0000 (UTC) Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-19-cCwNuJ9rOdS34E9xLYw6OQ-1; Mon, 11 Apr 2022 08:38:36 -0400 Received: by mail-pf1-f175.google.com with SMTP id s8so14448757pfk.12 for ; Mon, 11 Apr 2022 05:38:36 -0700 (PDT) Received: from localhost.localdomain ([103.199.136.213]) by smtp.gmail.com with ESMTPSA id u25-20020a62ed19000000b004f140515d56sm35763404pfh.46.2022.04.11.05.38.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Apr 2022 05:38:34 -0700 (PDT) X-MC-Unique: c9ICERJ9OLu4z5vU4VFyuw-1 X-Original-To: libvir-list@listman.corp.redhat.com X-MC-Unique: cCwNuJ9rOdS34E9xLYw6OQ-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=xZfvOtl2b0Y3U0Y3vFnLZQwfs/LndjgFrWrrHzcg3PY=; b=JnPHlpycYA6jnMxkwJVEhj+cchUg0twVxQHUC+AKcIahNGkl9qDQFO/8szS7TWMCqJ Yep25H5BgLU2Ti5HpkEiP/0TxJV9dOJyUN/k+ymhqSUyw9UqAaBAN0fBJS65fmq/TbnR tQvz4AapKjxEQ1E3Spv8dByLzp3O1gC1Zd1jcHlxb/Nm2FcS+xpz4nnzTYZzxJoJb9VE c9Magnvet/ot7UvbUlk4xRbMgUUNRGjQNezvYHouvoFTjzZPuzE4dXY12gBv9IRJ85Dz bzwttJj9t+OD3/qw5JL+PyKNNxKeHILQsYebPXYWPvunS7eAY/+ZKsWxw834kcyyVjnF eH9Q== X-Gm-Message-State: AOAM533aQWGtLY+hKGmKKqc+8qtMC0Tkfn9f/vjGNsPJYrLazA3CqNNV mfcwowS13qgmRwMU96Plr5qcxuJjlJut9Q== X-Google-Smtp-Source: ABdhPJysfMNvBCbsPvw4tcGwK/hWS4X8yfIutwVWWI65jsYc0C0WQShASSb7MMbyngA6QwlbnZ/NIA== X-Received: by 2002:a65:4108:0:b0:399:1f0e:50da with SMTP id w8-20020a654108000000b003991f0e50damr26900972pgp.2.1649680715323; Mon, 11 Apr 2022 05:38:35 -0700 (PDT) From: Moteen Shah X-Google-Original-From: Moteen Shah To: libvir-list@redhat.com Subject: [PATCH v3] conf: Move validation checks from virDomainDiskDefIotuneParse into domain_validate.c Date: Mon, 11 Apr 2022 18:08:15 +0530 Message-Id: <20220411123815.98205-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.85 on 10.11.54.7 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.85 on 10.11.54.9 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: 1649680730332100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Move validation from virDomainDiskDefIotuneParse into the validation callba= ck Signed-off-by: Moteen Shah --- src/conf/domain_conf.c | 40 -------------------------------------- src/conf/domain_validate.c | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 5dd269b283..bd2884088c 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -8790,46 +8790,6 @@ 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; } #undef PARSE_IOTUNE diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c index d6869e8fd8..68190fc3e2 100644 --- a/src/conf/domain_validate.c +++ b/src/conf/domain_validate.c @@ -651,6 +651,43 @@ virDomainDiskDefValidate(const virDomainDef *def, } } =20 + /* Validate IotuneParse */ + if ((disk->blkdeviotune.total_bytes_sec && + disk->blkdeviotune.read_bytes_sec) || + (disk->blkdeviotune.total_bytes_sec && + disk->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 ((disk->blkdeviotune.total_iops_sec && + disk->blkdeviotune.read_iops_sec) || + (disk->blkdeviotune.total_iops_sec && + disk->blkdeviotune.write_iops_sec)) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("total and read/write iops_sec cannot be set at t= he same time")); + return -1; + } + + if ((disk->blkdeviotune.total_bytes_sec_max && + disk->blkdeviotune.read_bytes_sec_max) || + (disk->blkdeviotune.total_bytes_sec_max && + disk->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 ((disk->blkdeviotune.total_iops_sec_max && + disk->blkdeviotune.read_iops_sec_max) || + (disk->blkdeviotune.total_iops_sec_max && + disk->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; + } + /* Reject disks with a bus type that is not compatible with the * given address type. The function considers only buses that are * handled in common code. For other bus types it's not possible --=20 2.35.1