From nobody Mon Sep 16 18:56:35 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 --- 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 + +
+ + + + +