From nobody Sun Feb 8 11:06:37 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; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.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=1621255486; cv=none; d=zohomail.com; s=zohoarc; b=LwJjGQeehnCpcn4RBHpmsrdH8MSzwOldJIz/kfXo1JFaAGH6+fVkfmp4G0V+Qh/IafkL19hlF9mb1xTXHEH6Jb9L3118o/xN8LPQqYtK42N2rVv1Yad2ait49zpOUXT6DI1tgFSjJc0GxAs2XwV45iJA9gh7Nc58IJ/eeO/N7fI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1621255486; 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=JxyPsMvBqisOlGiMAsYCZMntBNpU+UrPBIj409tYMN0=; b=JdxFDkNptAz9QT55oUq2iEcgtaA2vuozMxjhbKn8ZXA2Aa5auUeMOsOJq7qxioOjYI5/+BrvkAK/6sKixR4/miG17sA0aFmuO+ApG59dieHUxtgrJe1bVsjVWHBBSfUa83glfdFR/gIRGNfi8iVcqtzgEbB9ByXkTST2QejIP8c= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 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-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1621255486334254.0821690034311; Mon, 17 May 2021 05:44:46 -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-105-JuyO_00jNCiusTA2xrd6pA-1; Mon, 17 May 2021 08:44:43 -0400 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 8A66B107ACE6; Mon, 17 May 2021 12:44:36 +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 6289219704; Mon, 17 May 2021 12:44:36 +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 0A7895535C; Mon, 17 May 2021 12:44:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 14HCiQQ6015628 for ; Mon, 17 May 2021 08:44:26 -0400 Received: by smtp.corp.redhat.com (Postfix) id B03391899A; Mon, 17 May 2021 12:44:26 +0000 (UTC) Received: from localhost.localdomain (unknown [10.40.193.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 319B6179B3 for ; Mon, 17 May 2021 12:44:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1621255485; 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=JxyPsMvBqisOlGiMAsYCZMntBNpU+UrPBIj409tYMN0=; b=TeEShXVkjlpKQ1R+zwCP79jAVXWTvlWWmYwPd7RpSsBgSxyiAFjKMtDoR214ZvTxJMXaQd LpOBR/RLfQykAo0OUDTixSuAERfByOZZjwh2Kch+cCavbV8a2FV8unpgUqXKauRmKakex/ rUkI+igUiScieKQNGXHSxJmWgM/5CQw= X-MC-Unique: JuyO_00jNCiusTA2xrd6pA-1 From: Michal Privoznik To: libvir-list@redhat.com Subject: [PATCH 3/4] virnumamock: Allow CPU-less NUMA nodes Date: Mon, 17 May 2021 14:44:17 +0200 Message-Id: <47598e6441bd2d973ddc60fe1053ffe08efa3883.1621255232.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.84 on 10.5.11.23 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" The original virNumaGetNodeCPUs() returns an empty virBitmap if given NUMA node has no CPUs. But that's not how our mock behaves - it looks under $fakesysfs/node/node$N/cpulist only to find an empty file which is then passed to virBitmapParseUnlimited() which threats such input as error. Fortunately, we don't have any fake sysfs data where this path is hit, but we might soon. Signed-off-by: Michal Privoznik --- tests/virnumamock.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/virnumamock.c b/tests/virnumamock.c index 3a203ded77..ff9c6e951d 100644 --- a/tests/virnumamock.c +++ b/tests/virnumamock.c @@ -172,7 +172,12 @@ virNumaGetNodeCPUs(int node, virBitmap **cpus) SYSFS_SYSTEM_PATH, node) < 0) return -1; =20 - *cpus =3D virBitmapParseUnlimited(cpulist); + if (STREQ(cpulist, "")) { + unsigned int max_n_cpus =3D virNumaGetMaxCPUs(); + *cpus =3D virBitmapNew(max_n_cpus); + } else { + *cpus =3D virBitmapParseUnlimited(cpulist); + } if (!*cpus) goto cleanup; =20 --=20 2.26.3