From nobody Wed May 8 16:37:19 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) client-ip=207.211.31.81; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 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=1599491526; cv=none; d=zohomail.com; s=zohoarc; b=Qw+cgQlVBWvvn4YP8EbKGXXRdfXvkZOfPoM3mqyVknRcsQ72CiHS76/FnIaLazjvJ3hQa/ub+SwVzw8L9ZWhJLZLLnSK4JwzM9oa8ueehaownK48T0sJAdov28xubJgeoTjGnlYvZQMXZETP/YN8OtgEtZntp/2WEeHZqZh4gHo= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1599491526; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=cxqh7lpcZ9nn5i7Ox5wgy4xfS1J5/zsJtAMoMXIYwcU=; b=Lle6RpTW9rQY2x62GITHdnNfRiJuOXtVniLfd0J2f3WKGTE5/vZMDvN6CSvmX69ULXw2J38TPP5Y9GHYvXKzDf3vrWKaRiKCLAC3NK51GKKhlbsMoJTXkAoU0q5cEgxvb4pf1M4HPWuQugp9uWBOWj9c4ipDY8wt4HP+Evw0AHI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 207.211.31.81 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [207.211.31.81]) by mx.zohomail.com with SMTPS id 1599491526152986.824388235521; Mon, 7 Sep 2020 08:12:06 -0700 (PDT) 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-569-9l41ovz4PzOGNCU1G2dONw-1; Mon, 07 Sep 2020 11:12:02 -0400 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 6171618B9ED9; Mon, 7 Sep 2020 15:11:57 +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 3F02F5C1BB; Mon, 7 Sep 2020 15:11:57 +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 0A37079FE6; Mon, 7 Sep 2020 15:11:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 087FBtVV000964 for ; Mon, 7 Sep 2020 11:11:55 -0400 Received: by smtp.corp.redhat.com (Postfix) id A46F41A8EC; Mon, 7 Sep 2020 15:11:55 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.135]) by smtp.corp.redhat.com (Postfix) with ESMTP id 265B427BD8 for ; Mon, 7 Sep 2020 15:11:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1599491524; 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:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=cxqh7lpcZ9nn5i7Ox5wgy4xfS1J5/zsJtAMoMXIYwcU=; b=Ws3TFGJk3tO9cpdZaU7Y0bCeLfRmzw1efu5/X0IjWgyGA1or1Eah8zy8xRJfU0kor7g13R 9EiyVrrp0k1h5v+CYDRxy4JWyx75U+GYV7dsSCQ5BF8HWIgWP4NsPF6o2AnUvgo/PSolq2 +3q568rPMnXOoZvZpwYzXB/aZskQ1pQ= X-MC-Unique: 9l41ovz4PzOGNCU1G2dONw-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH] virnuma: Report error when NUMA -> CPUs translation fails Date: Mon, 7 Sep 2020 17:11:50 +0200 Message-Id: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-loop: libvir-list@redhat.com 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.001 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" When starting a domain with set libvirt translates given NUMA nodes into a set of host CPUs which is then used to QEMU process affinity. But, if the numatune contains a non-existent NUMA node then the translation fails with no error reported. This is because virNumaNodesetToCPUset() calls virNumaGetNodeCPUs() and expects it to report an error on failure. Well, it does except for non-existent NUMA nodes. While this behaviour might look strange it is actually desired because of how we construct host capabilities. The virNumaGetNodeCPUs() is called from virCapabilitiesHostNUMAInitReal() where we do not want any error reported for non-existent NUMA nodes. Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=3D1724866 Signed-off-by: Michal Privoznik Reviewed-by: Martin Kletzander --- src/util/virnuma.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/util/virnuma.c b/src/util/virnuma.c index ba1e4363d6..2872ce3c5e 100644 --- a/src/util/virnuma.c +++ b/src/util/virnuma.c @@ -316,12 +316,21 @@ virNumaNodesetToCPUset(virBitmapPtr nodeset, =20 for (i =3D 0; i < nodesetSize; i++) { g_autoptr(virBitmap) nodeCPUs =3D NULL; + int rc; =20 if (!virBitmapIsBitSet(nodeset, i)) continue; =20 - if (virNumaGetNodeCPUs(i, &nodeCPUs) < 0) + rc =3D virNumaGetNodeCPUs(i, &nodeCPUs); + if (rc < 0) { + /* Error is reported for cases other than non-existent NUMA no= de. */ + if (rc =3D=3D -2) { + virReportError(VIR_ERR_OPERATION_FAILED, + _("NUMA node %zu is not available"), + i); + } return -1; + } =20 if (virBitmapUnion(allNodesCPUs, nodeCPUs) < 0) return -1; --=20 2.26.2