From nobody Fri Apr 19 22:17:30 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.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=1684749243; cv=none; d=zohomail.com; s=zohoarc; b=KGj1bJUfKnHmCklxlUYUrJnwVaJ0zBR/i9zuvrWA3ckgK2P56hKtpIZ4vmwHv8TcWQgrr6mjcFCM6xvGA7p8y6U5omhi1nixxy3u7QHD9t+/2Lyvx5WNlqKaMwyxqtkIAs0MYX8t5Z4RtFGRJrSke9+91GVCPeWhzux/GggUWX4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684749243; 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=BFcYlRgnRNvRhmJV3Hx+vjjDlqzwjI9qOi5an/4DKn4=; b=G27RuYF2AkqyC+cuzF+k/QJFtJOqFXr235WhCnB07GQ2+pm7luziz49XBubCnCZEYklHkh+FzNImz7bBtpzxtYVyZ/6ATKZxc2dhUA4LWx4FTO13/yn3S+8zB4og/3Bd57Bfetm3JanJg3qZmIh16lmifozBXL24gb1h62SWe9Y= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) 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 1684749243303123.06563356144716; Mon, 22 May 2023 02:54:03 -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-42-khYKRkieNM-kc1eZfwxwSg-1; Mon, 22 May 2023 05:53:54 -0400 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 2468C3C0CEE2; Mon, 22 May 2023 09:53:52 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0D8692166B25; Mon, 22 May 2023 09:53:52 +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 CB54C1946595; Mon, 22 May 2023 09:53:51 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id B80CF194658C for ; Mon, 22 May 2023 09:53:50 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id A9B9720296C6; Mon, 22 May 2023 09:53:50 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5101A200AE6F for ; Mon, 22 May 2023 09:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684749241; 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=BFcYlRgnRNvRhmJV3Hx+vjjDlqzwjI9qOi5an/4DKn4=; b=Z2m5N/GMlFgPS63IOQt+zecD9KQdHGaSbXk4smZrlgzWEX/2j3bIAD7foHsZkcTeLFWXmQ gGUxNDsO3jUAVgncF+qE7ScDI9Zf94X8ofaBD9hmsRYydbS0s0N7ZKayVeE7hw62tCPDB2 E9QtCRMspi9HXC2zyDCg7gclqsAzruo= X-MC-Unique: khYKRkieNM-kc1eZfwxwSg-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 1/3] virDomainNumatuneNodeSpecified: Fix const correctness Date: Mon, 22 May 2023 11:53:46 +0200 Message-Id: <0994ef545d78caa0777c7810ed2cc386566f4805.1684749027.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684749244859100001 Content-Type: text/plain; charset="utf-8"; x-default="true" The virDomainNumatuneNodeSpecified() function does not write into passed @numatune pointer, it just reads from it. Therefore, the argument should be const, which allows this function to be called from places where virDomainNuma is already const (e.g. domain validation code). Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/conf/numa_conf.c | 2 +- src/conf/numa_conf.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index be0c4572c5..dd4997c759 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -116,7 +116,7 @@ struct _virDomainNuma { =20 =20 bool -virDomainNumatuneNodeSpecified(virDomainNuma *numatune, +virDomainNumatuneNodeSpecified(const virDomainNuma *numatune, int cellid) { if (numatune && diff --git a/src/conf/numa_conf.h b/src/conf/numa_conf.h index bbb928abb2..f5a20315b6 100644 --- a/src/conf/numa_conf.h +++ b/src/conf/numa_conf.h @@ -210,7 +210,7 @@ int virDomainNumatuneSpecifiedMaxNode(virDomainNuma *nu= matune); bool virDomainNumatuneNodesetIsAvailable(virDomainNuma *numatune, virBitmap *auto_nodeset); =20 -bool virDomainNumatuneNodeSpecified(virDomainNuma *numatune, +bool virDomainNumatuneNodeSpecified(const virDomainNuma *numatune, int cellid); =20 int virDomainNumaDefParseXML(virDomainNuma *def, xmlXPathContextPtr ctxt); --=20 2.39.3 From nobody Fri Apr 19 22:17:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1684749247; cv=none; d=zohomail.com; s=zohoarc; b=n8Fv718g1cD1HgohHiXnIxnpX1ITRx3fTXNORcV2aiZXmpY3CTM8kO18aeJpOAFNnsjnJDqUSJW424Tl2pJSAHlN8el3OLtUErKoBYVfuMOCcc7tdrmCZ7x/Mw8VR8u6AJ/iWi9s5KkEoZBet1gn62x7j3b1HL/ZsvbZEyKACTA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684749247; 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=v9aZU5lQ4rNBBnMcVWZJrYIfHc1DEls0ranzvz6mdug=; b=StA8wU4uviXQpXVhUzq4IFSpLfE7dqwPBRJy5h/17QUkr7pJ70MFiHtGQcJChVCTaa2yQCgOi+wfOr2zO7tDSbETA2yQp2JO0bfdZ6SEHznT6htgBH8xDaWXT+m4up+2M3DFiJcjeVA2G9c5JtpLCK1UXLBnPiBO3YGR/Axm+KQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1684749247200616.0490806109805; Mon, 22 May 2023 02:54:07 -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-53-XCN6I23RNU2JLY9oLYDsyw-1; Mon, 22 May 2023 05:54:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E2B0380120A; Mon, 22 May 2023 09:53:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id CE8A12029F6D; Mon, 22 May 2023 09:53:58 +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 0A56A19465BB; Mon, 22 May 2023 09:53:54 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 64907194658C for ; Mon, 22 May 2023 09:53:51 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id 43F442029F6D; Mon, 22 May 2023 09:53:51 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id E005920296C6 for ; Mon, 22 May 2023 09:53:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684749246; 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=v9aZU5lQ4rNBBnMcVWZJrYIfHc1DEls0ranzvz6mdug=; b=b8zy6Ae4PozIzsWK+StgoNuZUTsSk8m4gShYKkTIvKPzRQdFuZN716CP/V8TWkcoyrnIpM EfHvn8R9s9PB3twDD0sdbrvct2SZUs5OMwWEYSlUfb8S4E1Wqn4P2tpJ0mc8y0f36HlUYv eR7uJ8zxVM4zq31DfVfRoP8h3UsqiiA= X-MC-Unique: XCN6I23RNU2JLY9oLYDsyw-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 2/3] numa_conf: Move memnode mode validation into virDomainNumaDefValidate() Date: Mon, 22 May 2023 11:53:47 +0200 Message-Id: <2a81e63a31e27cf9c6fab223e72789fee8141c12.1684749027.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684749249213100003 Content-Type: text/plain; charset="utf-8"; x-default="true" When parsing a we also check whether the @mode argument fulfills some requirements wrt 'restrictive' mode. This is not the right place though. There's virDomainNumaDefValidate() which contains other checks. Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/conf/numa_conf.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index dd4997c759..6095139385 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -191,14 +191,6 @@ virDomainNumatuneNodeParseXML(virDomainNuma *numa, VIR_DOMAIN_NUMATUNE_MEM_STRICT) < 0) return -1; =20 - if (numa->memory.mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE && - mem_node->mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'restrictive' mode is required in memnode el= ement " - "when mode is 'restrictive' in memory element= ")); - return -1; - } - tmp =3D virXMLPropString(cur_node, "nodeset"); if (!tmp) { virReportError(VIR_ERR_XML_ERROR, "%s", @@ -1083,6 +1075,14 @@ virDomainNumaDefValidate(const virDomainNuma *def) const virDomainNumaNode *node =3D &def->mem_nodes[i]; g_autoptr(virBitmap) levelsSeen =3D virBitmapNew(0); =20 + if (virDomainNumatuneNodeSpecified(def, i) && + def->memory.mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE && + node->mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'restrictive' mode is required in memnode el= ement when mode is 'restrictive' in memory element")); + return -1; + } + for (j =3D 0; j < node->ncaches; j++) { const virNumaCache *cache =3D &node->caches[j]; =20 --=20 2.39.3 From nobody Fri Apr 19 22:17:30 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.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 170.10.129.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=1684749246; cv=none; d=zohomail.com; s=zohoarc; b=Bl04Mz2ME8mqDnbut209wKZqsqvRIPv4eNDfFkXKXnHQf7TOwJiolrDj9k5h9kj+/XCkENXCfMM3OwThw4ruGxCWEHt/fx+TNERLGs7kKnpagfLK6ZEO09i/+iwHsY+wzBfOA5NrZdA0ieL0p+thWjL4FiBXptLasWLtMKOwcJA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1684749246; 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=ReaASN1mLhQTlDdKCkuEBR7dpxUbYAFQ+mPPMcjEQEQ=; b=Oe8sZan1uTJKZ+TZufJ3E5YqHrze86VexAjS+3sgTe4Jb9LvOf5tyG6hhV7FkxnfO250XKANzfSupAjo0Mhfo5lm+ct73sqxS5PyT2KfBwT3ZSEhW76unS4iZaYKtVX9EG4YXwyOusG4EmoYW7/aS0iwGR+r3W3tvnbBRAU3SBI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1684749246373754.286459439944; Mon, 22 May 2023 02:54:06 -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-172-kiUs4vMNOdSOEdzv8APT_Q-1; Mon, 22 May 2023 05:54:01 -0400 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B9DDF800141; Mon, 22 May 2023 09:53:58 +0000 (UTC) Received: from mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (unknown [10.30.29.100]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9E8AE20296C8; Mon, 22 May 2023 09:53:58 +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 554681946595; Mon, 22 May 2023 09:53:53 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) by mm-prod-listman-01.mail-001.prod.us-east-1.aws.redhat.com (Postfix) with ESMTP id 0510E19466DF for ; Mon, 22 May 2023 09:53:52 +0000 (UTC) Received: by smtp.corp.redhat.com (Postfix) id ED0FC2029F6E; Mon, 22 May 2023 09:53:51 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.2.39]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7A51D2029F6D for ; Mon, 22 May 2023 09:53:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1684749245; 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=ReaASN1mLhQTlDdKCkuEBR7dpxUbYAFQ+mPPMcjEQEQ=; b=ODGr5+6VrFocAHeaENZoQeaMmlMVKQtCj7U5u0+IU1v5HnRostc7zmrgtNRyGXBOCPWZlR k1qMx3BU7YeBaIf0q1Tf2Ng77Bq4xQ8DZcizCYDdnWkB2DwRbi8a/C8/9UoKB3YfsNBLzN XKDYiRdphvDseAJnhDgDWAjtHLGr46M= X-MC-Unique: kiUs4vMNOdSOEdzv8APT_Q-1 X-Original-To: libvir-list@listman.corp.redhat.com From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/3] numa_conf: Deny other memory modes than 'restrictive' if a memnode is 'restrictive' Date: Mon, 22 May 2023 11:53:48 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 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: , Errors-To: libvir-list-bounces@redhat.com Sender: "libvir-list" X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1684749247218100001 Content-Type: text/plain; charset="utf-8"; x-default="true" We already do check that if there's then all have to be of 'restrictive' mode too. But what we are missing the reverse: if there is with 'restrictive' mode, then the has to be of the same mode too. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D2208946 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/conf/numa_conf.c | 20 ++++++--- ...strictive-mode-err-mixed.x86_64-latest.err | 1 + ...une-memnode-restrictive-mode-err-mixed.xml | 41 +++++++++++++++++++ tests/qemuxml2argvtest.c | 1 + 4 files changed, 57 insertions(+), 6 deletions(-) create mode 100644 tests/qemuxml2argvdata/numatune-memnode-restrictive-mod= e-err-mixed.x86_64-latest.err create mode 100644 tests/qemuxml2argvdata/numatune-memnode-restrictive-mod= e-err-mixed.xml diff --git a/src/conf/numa_conf.c b/src/conf/numa_conf.c index 6095139385..a616521763 100644 --- a/src/conf/numa_conf.c +++ b/src/conf/numa_conf.c @@ -1075,12 +1075,20 @@ virDomainNumaDefValidate(const virDomainNuma *def) const virDomainNumaNode *node =3D &def->mem_nodes[i]; g_autoptr(virBitmap) levelsSeen =3D virBitmapNew(0); =20 - if (virDomainNumatuneNodeSpecified(def, i) && - def->memory.mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE && - node->mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { - virReportError(VIR_ERR_XML_ERROR, "%s", - _("'restrictive' mode is required in memnode el= ement when mode is 'restrictive' in memory element")); - return -1; + if (virDomainNumatuneNodeSpecified(def, i)) { + if (def->memory.mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIV= E && + node->mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'restrictive' mode is required in memnod= e element when mode is 'restrictive' in memory element")); + return -1; + } + + if (node->mode =3D=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE && + def->memory.mode !=3D VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE)= { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("'restrictive' mode is required in memory= element when mode is 'restrictive' in memnode element")); + return -1; + } } =20 for (j =3D 0; j < node->ncaches; j++) { diff --git a/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode-err-m= ixed.x86_64-latest.err b/tests/qemuxml2argvdata/numatune-memnode-restrictiv= e-mode-err-mixed.x86_64-latest.err new file mode 100644 index 0000000000..88f02ee70e --- /dev/null +++ b/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode-err-mixed.x8= 6_64-latest.err @@ -0,0 +1 @@ +XML error: 'restrictive' mode is required in memory element when mode is '= restrictive' in memnode element diff --git a/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode-err-m= ixed.xml b/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode-err-mix= ed.xml new file mode 100644 index 0000000000..0304dec8ef --- /dev/null +++ b/tests/qemuxml2argvdata/numatune-memnode-restrictive-mode-err-mixed.xml @@ -0,0 +1,41 @@ + + QEMUGuest + 9f4b6512-e73a-4a25-93e8-5307802821ce + 24682468 + 24682468 + 32 + + + + + + + hvm + + + + qemu64 + + + + + + + + destroy + restart + destroy + + /usr/bin/qemu-system-x86_64 + +
+ + + + +