From nobody Sun Feb 8 07:08:03 2026 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=none dis=none) header.from=gmail.com ARC-Seal: i=1; a=rsa-sha256; t=1607349318; cv=none; d=zohomail.com; s=zohoarc; b=Ma/1eUyqwyT5BooPh/lfw0cKur/TrMXTTLN4FkU53/eRllubGZrM1O3KPe4dz/R/w7heQ2IjiNeFY+TC2LbcwbwqwWvPmszuFKbCQowb2+5/zz3Sme6YHbJxqbVFSklErC0x337rJ47ekjiyYw6EcBd/eAOEmT7oXMWJLwfO3lA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1607349318; h=Content-Type:Content-Transfer-Encoding:Cc: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=9LqT3t7tVjmiFvG4ttFJ0SFYL5+PW0BudKoWPdDtIpU=; b=HTCxuC7vekY999Fh9A2/rpNe0Vd0QOlWun7jj8Mp1u9HUovNfDQlZjhRVp0lSHqa35T9fMDx/PE/KJCOIVRiw3qx+oGVF4hJw8ZIE/BhqBeD3uavXdi1hYTAlJ0ixWFO27Y/89iQGNLqEelr83yEWj+qFCn8Pj5UGcjz/0WNayU= 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=none dis=none) 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 1607349318763157.7643640278145; Mon, 7 Dec 2020 05:55:18 -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-435-JFVJqdJvMvi1iZIXj2ZHww-1; Mon, 07 Dec 2020 08:55:13 -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 B3BBF1E7C2; Mon, 7 Dec 2020 13:55:06 +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 8D28D5C1A1; Mon, 7 Dec 2020 13:55:06 +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 4FC944EA6C; Mon, 7 Dec 2020 13:55:06 +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 0B7Dt3XA012984 for ; Mon, 7 Dec 2020 08:55:03 -0500 Received: by smtp.corp.redhat.com (Postfix) id 4C4C44405A; Mon, 7 Dec 2020 13:55:03 +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 467D463796 for ; Mon, 7 Dec 2020 13:55:03 +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 32AB6811E85 for ; Mon, 7 Dec 2020 13:55:03 +0000 (UTC) Received: from mail-qk1-f193.google.com (mail-qk1-f193.google.com [209.85.222.193]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-202-e9NtS89rPee0bKfXmrCAdA-1; Mon, 07 Dec 2020 08:55:01 -0500 Received: by mail-qk1-f193.google.com with SMTP id u4so12471084qkk.10 for ; Mon, 07 Dec 2020 05:55:01 -0800 (PST) Received: from rekt.redhat.com ([2804:431:c7c7:c1a:69c1:2b22:e880:fc49]) by smtp.gmail.com with ESMTPSA id n95sm12233701qte.43.2020.12.07.05.54.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 07 Dec 2020 05:54:59 -0800 (PST) X-MC-Unique: JFVJqdJvMvi1iZIXj2ZHww-1 X-MC-Unique: e9NtS89rPee0bKfXmrCAdA-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=9LqT3t7tVjmiFvG4ttFJ0SFYL5+PW0BudKoWPdDtIpU=; b=Mqkej9fD++fDq432quGpvPPvAyY9bkflYHpSVBMkw2Jb9DUgaO1RYUGRVeot3sz25o BiLYmvG+UbdrMMP5ARJUXwnHco+8TjzyFbn4Ng5687T24iB1+VV4z6Lob48j4waKuTbG TyWaw3G+nhz4kEsl9l8V1SwAHaV2QBawFPQcw6tr9Nhq631LuvSVB4+SZQBlfDvIuceK /fNuMLHkWdZHjOjcKzxw28dSxqMpeh8rI1C0tA9GIyYefLnK+PICPrOQ7n8BPTBynqQ0 jDHCSbPXZE2Hx0322LyWZgrqoRTpuxmPaaqS985VS+pee1Pys5byARPDMw2nLyG5D6KT A/cA== X-Gm-Message-State: AOAM533IrAiWiwqrV7msGBxlQkzUTEpJPbaQEBnDMgKdbm6xneqcbO9A 5Iodc+fO3unWYQl20gqi/6vO3uBckc8= X-Google-Smtp-Source: ABdhPJwsvmsfOHALG2iDykuLqGx/t6NW4LH0sy0OXeuNWKQbis9HITWf9M1qAi7dLqdm0Cv3gtjZJQ== X-Received: by 2002:a05:620a:569:: with SMTP id p9mr23874954qkp.119.1607349300372; Mon, 07 Dec 2020 05:55:00 -0800 (PST) From: Daniel Henrique Barboza To: libvir-list@redhat.com Subject: [PATCH v2 6/9] domain_conf.c: move blkio path check to validate callback Date: Mon, 7 Dec 2020 10:54:32 -0300 Message-Id: <20201207135435.884594-7-danielhb413@gmail.com> In-Reply-To: <20201207135435.884594-1-danielhb413@gmail.com> References: <20201207135435.884594-1-danielhb413@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.79 on 10.11.54.5 X-loop: libvir-list@redhat.com Cc: Daniel Henrique Barboza 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: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Move this check to a new virDomainDefTunablesValidate(), which is called by virDomainDefValidateInternal(). Signed-off-by: Daniel Henrique Barboza --- src/conf/domain_conf.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 230e89e786..290930cc85 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7397,6 +7397,27 @@ virDomainDefVideoValidate(const virDomainDef *def) } =20 =20 +static int +virDomainDefTunablesValidate(const virDomainDef *def) +{ + size_t i, j; + + for (i =3D 0; i < def->blkio.ndevices; i++) { + for (j =3D 0; j < i; j++) { + if (STREQ(def->blkio.devices[j].path, + def->blkio.devices[i].path)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("duplicate blkio device path '%s'"), + def->blkio.devices[i].path); + return -1; + } + } + } + + return 0; +} + + static int virDomainDefValidateInternal(const virDomainDef *def, virDomainXMLOptionPtr xmlopt) @@ -7448,6 +7469,9 @@ virDomainDefValidateInternal(const virDomainDef *def, if (virDomainDefVideoValidate(def) < 0) return -1; =20 + if (virDomainDefTunablesValidate(def) < 0) + return -1; + if (virDomainNumaDefValidate(def->numa) < 0) return -1; =20 @@ -21342,7 +21366,7 @@ virDomainDefTunablesParse(virDomainDefPtr def, unsigned int flags) { g_autofree xmlNodePtr *nodes =3D NULL; - size_t i, j; + size_t i; int n; =20 /* Extract blkio cgroup tunables */ @@ -21363,15 +21387,6 @@ virDomainDefTunablesParse(virDomainDefPtr def, &def->blkio.devices[i]) < 0) return -1; def->blkio.ndevices++; - for (j =3D 0; j < i; j++) { - if (STREQ(def->blkio.devices[j].path, - def->blkio.devices[i].path)) { - virReportError(VIR_ERR_XML_ERROR, - _("duplicate blkio device path '%s'"), - def->blkio.devices[i].path); - return -1; - } - } } VIR_FREE(nodes); =20 --=20 2.26.2