From nobody Sun Feb 8 15:07:46 2026 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1507130319042840.2832300367168; Wed, 4 Oct 2017 08:18:39 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 151BD7EAA1; Wed, 4 Oct 2017 15:18:38 +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 E1C2A6362E; Wed, 4 Oct 2017 15:18:37 +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 9A0D73FAD1; Wed, 4 Oct 2017 15:18:37 +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 v94EwrTU006797 for ; Wed, 4 Oct 2017 10:58:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id DA0F75C8B2; Wed, 4 Oct 2017 14:58:53 +0000 (UTC) Received: from mamuti.net (unknown [10.34.246.102]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEF5D5C8B5 for ; Wed, 4 Oct 2017 14:58:51 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id 30F28101D39; Wed, 4 Oct 2017 16:58:50 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 151BD7EAA1 Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx04.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 4 Oct 2017 16:58:27 +0200 Message-Id: <804fa566c0a9b07f01b5b51bac1273cf77b03360.1507128897.git.jdenemar@redhat.com> In-Reply-To: References: In-Reply-To: References: Mail-Followup-To: libvir-list@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/23] qemu: Store CPU usability blockers in caps cache 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: , MIME-Version: 1.0 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.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 04 Oct 2017 15:18:38 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark Reviewed-by: John Ferlan --- src/qemu/qemu_capabilities.c | 51 ++++++++++++++++++++++++++++++++++++++++= ++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b20dd6ec32..1ce2aa375f 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -3727,6 +3727,10 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, size_t i; int n; int ret =3D -1; + xmlNodePtr node; + xmlNodePtr *blockerNodes =3D NULL; + char **blockers =3D NULL; + int nblockers; =20 if (type =3D=3D VIR_DOMAIN_VIRT_KVM) n =3D virXPathNodeSet("./cpu[@type=3D'kvm']", ctxt, &nodes); @@ -3769,7 +3773,34 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, goto cleanup; } =20 - if (virDomainCapsCPUModelsAddSteal(cpus, &str, usable, NULL) < 0) + node =3D ctxt->node; + ctxt->node =3D nodes[i]; + nblockers =3D virXPathNodeSet("./blocker", ctxt, &blockerNodes); + ctxt->node =3D node; + + if (nblockers < 0) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("failed to parse qemu capabilities cpus")); + goto cleanup; + } + + if (nblockers > 0) { + size_t j; + + if (VIR_ALLOC_N(blockers, nblockers + 1) < 0) + goto cleanup; + + for (j =3D 0; j < nblockers; j++) { + if (!(blockers[j] =3D virXMLPropString(blockerNodes[j], "n= ame"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("missing blocker name in QEMU " + "capabilities cache")); + goto cleanup; + } + } + } + + if (virDomainCapsCPUModelsAddSteal(cpus, &str, usable, &blockers) = < 0) goto cleanup; } =20 @@ -3778,6 +3809,8 @@ virQEMUCapsLoadCPUModels(virQEMUCapsPtr qemuCaps, cleanup: VIR_FREE(nodes); VIR_FREE(str); + VIR_FREE(blockerNodes); + virStringListFree(blockers); return ret; } =20 @@ -4135,7 +4168,21 @@ virQEMUCapsFormatCPUModels(virQEMUCapsPtr qemuCaps, virBufferAsprintf(buf, " usable=3D'%s'", virDomainCapsCPUUsableTypeToString(cpu->usab= le)); } - virBufferAddLit(buf, "/>\n"); + + if (cpu->blockers) { + size_t j; + + virBufferAddLit(buf, ">\n"); + virBufferAdjustIndent(buf, 2); + + for (j =3D 0; cpu->blockers[j]; j++) + virBufferAsprintf(buf, "\n", cpu->bl= ockers[j]); + + virBufferAdjustIndent(buf, -2); + virBufferAddLit(buf, "\n"); + } else { + virBufferAddLit(buf, "/>\n"); + } } } =20 --=20 2.14.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list