From nobody Thu May 2 02:22:02 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 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=1556197047; cv=none; d=zoho.com; s=zohoarc; b=kmJumEHVqFPcmfXon649KOXSSyhsvRYTr2GR/h+WBNhid6F+PoithU8v+X0u1mWOQDsXY6ELO39Wc+Q5M7rDUf9Y6NYXYZnZ1VP3Aalnlwxcmu6Ky4ddgjNEfwQF1KVGUdafVFznukDs9WJbeUeYzCXSOnttd1mUPAA3La0OfzI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1556197047; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=WMJe8Lten28yqendo8jb+rF0Ay6qMnJ+wf7ydUNR/xw=; b=N9ar3GjYC9/6sN/+OL2mOLMP1SkhhO6UAj3bPkaI8ioA7NaPxdex9awZ4mM7YXdd49D/WxGl8Wf5pNIZxgIoU6eC8jIHAkqSEiPbO0nxhNEt6gglnOOARw1QJmrYZxeN1PefO2QZjdZpmIpk8a3EjKjOGMgyxT+LCUFFK9UUjBs= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1556197047973360.8792409483094; Thu, 25 Apr 2019 05:57:27 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 32E53A146A; Thu, 25 Apr 2019 12:57:26 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 8AA356683B; Thu, 25 Apr 2019 12:57:24 +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 8DC96181AC90; Thu, 25 Apr 2019 12:57:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3PCvMnQ005064 for ; Thu, 25 Apr 2019 08:57:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id DCA8966D2D; Thu, 25 Apr 2019 12:57:21 +0000 (UTC) Received: from worklaptop.redhat.com (ovpn-122-101.rdu2.redhat.com [10.10.122.101]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2B40566841; Thu, 25 Apr 2019 12:57:21 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Thu, 25 Apr 2019 08:57:11 -0400 Message-Id: <407cb2b56fea2a9621e5dbabe38fdb45764eb691.1556196423.git.crobinso@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: John.Allen@amd.com Subject: [libvirt] [PATCH] test: Use nodeInfo content for virNodeGetCPUMap 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Thu, 25 Apr 2019 12:57:27 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Right now the test driver implementation of virNodeGetCPUMap uses hardcoded data. Instead use cpu data from our nodeInfo, which can be overridden with input test XML. This helps to emulate some virsh commands (vcpupin, hostcpumap) with a large number of host cpus. [1] The content reported for test:///default is now slightly different: previously it would report 8 total cpus with 0,2,4 online. Now it reports 16 cpus with all online, which is the pre-existing nodeInfo default. [1] https://www.redhat.com/archives/libvir-list/2019-March/msg02042.html Signed-off-by: Cole Robinson --- John, in trying to understand and test your bitmap patch, I added this to the test driver. I think there's a bigger issue at play but I'm still trying to work it out, I'll send a follow up email when I've collected my thoughts src/test/test_driver.c | 35 +++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index d5eecf4b7f..f00b6eb1c8 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5811,23 +5811,46 @@ static int testConnectListAllDomains(virConnectPtr = conn, } =20 static int -testNodeGetCPUMap(virConnectPtr conn ATTRIBUTE_UNUSED, +testNodeGetCPUMap(virConnectPtr conn, unsigned char **cpumap, unsigned int *online, unsigned int flags) { + testDriverPtr privconn =3D conn->privateData; + int maxcpus =3D VIR_NODEINFO_MAXCPUS(privconn->nodeInfo); + virBitmapPtr cpus =3D NULL; + int ret =3D -1; + int dummy; + size_t i; + virCheckFlags(0, -1); =20 + if (!cpumap && !online) + return maxcpus; + + if (!(cpus =3D virBitmapNew(maxcpus))) + goto cleanup; + if (cpumap) { - if (VIR_ALLOC_N(*cpumap, 1) < 0) - return -1; - *cpumap[0] =3D 0x15; + for (i =3D 0; i < privconn->nodeInfo.cpus; i++) { + if (virBitmapSetBit(cpus, i) < 0) + goto cleanup; + } + + if (virBitmapToData(cpus, cpumap, &dummy) < 0) + goto cleanup; } =20 if (online) - *online =3D 3; + *online =3D privconn->nodeInfo.cpus; =20 - return 8; + ret =3D maxcpus; + + cleanup: + if (ret < 0 && cpumap) + VIR_FREE(*cpumap); + VIR_FREE(cpus); + return ret; } =20 static char * --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list