From nobody Wed Jul 16 05:01:37 2025 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 1499867056777446.55033679268524; Wed, 12 Jul 2017 06:44:16 -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 3BEF63A18D; Wed, 12 Jul 2017 13:44:15 +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 BC7E76E8DE; Wed, 12 Jul 2017 13:44:14 +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 4AD593FAE1; Wed, 12 Jul 2017 13:44:14 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6CDiC83032557 for ; Wed, 12 Jul 2017 09:44:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id CF8FE6DAD4; Wed, 12 Jul 2017 13:44:12 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 09A916DA86; Wed, 12 Jul 2017 13:44:11 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3BEF63A18D Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3BEF63A18D From: Peter Krempa To: libvir-list@redhat.com Date: Wed, 12 Jul 2017 15:44:04 +0200 Message-Id: <3603cbaad5f8d28600d8b6055c65d2daaea95544.1499866398.git.pkrempa@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Peter Krempa , Nitesh Konkar Subject: [libvirt] [PATCH 3/5] qemu: domain: Store and restore autoCpuset to status XML 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.38]); Wed, 12 Jul 2017 13:44:15 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Decouple them by storing them in the XML separately rather than regenerating them. This will simplify upcoming fixes. Reviewed-by: Andrea Bolognani --- src/qemu/qemu_domain.c | 32 +++++++++++++++++++++++++------- tests/qemuxml2xmltest.c | 2 +- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 92e5609ad..8c29db15f 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1765,20 +1765,30 @@ qemuDomainObjPtrivateXMLFormatAutomaticPlacement(vi= rBufferPtr buf, qemuDomainObjPrivatePtr p= riv) { char *nodeset =3D NULL; + char *cpuset =3D NULL; int ret =3D -1; - if (!priv->autoNodeset) + if (!priv->autoNodeset && !priv->autoCpuset) return 0; - if (!(nodeset =3D virBitmapFormat(priv->autoNodeset))) + if (priv->autoNodeset && + !((nodeset =3D virBitmapFormat(priv->autoNodeset)))) goto cleanup; - virBufferAsprintf(buf, "\n", nodeset); + if (priv->autoCpuset && + !((cpuset =3D virBitmapFormat(priv->autoCpuset)))) + goto cleanup; + + virBufferAddLit(buf, "\n"); ret =3D 0; cleanup: VIR_FREE(nodeset); + VIR_FREE(cpuset); return ret; } @@ -1958,11 +1968,13 @@ qemuDomainObjPrivateXMLParseAutomaticPlacement(virQ= EMUDriverPtr driver, { virCapsPtr caps =3D NULL; char *nodeset; + char *cpuset; int ret =3D -1; nodeset =3D virXPathString("string(./numad/@nodeset)", ctxt); + cpuset =3D virXPathString("string(./numad/@cpuset)", ctxt); - if (!nodeset) + if (!nodeset && !cpuset) return 0; if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) @@ -1971,15 +1983,21 @@ qemuDomainObjPrivateXMLParseAutomaticPlacement(virQ= EMUDriverPtr driver, if (virBitmapParse(nodeset, &priv->autoNodeset, caps->host.nnumaCell_m= ax) < 0) goto cleanup; - if (!(priv->autoCpuset =3D virCapabilitiesGetCpusForNodemask(caps, - priv->autoN= odeset))) - goto cleanup; + if (cpuset) { + if (virBitmapParse(cpuset, &priv->autoCpuset, VIR_DOMAIN_CPUMASK_L= EN) < 0) + goto cleanup; + } else { + if (!(priv->autoCpuset =3D virCapabilitiesGetCpusForNodemask(caps, + priv->a= utoNodeset))) + goto cleanup; + } ret =3D 0; cleanup: virObjectUnref(caps); VIR_FREE(nodeset); + VIR_FREE(cpuset); return ret; } diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index 79347671f..24d1eb33c 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -95,7 +95,7 @@ static const char testStatusXMLPrefixFooter[] =3D " \n" " \n" " \n" -" \n" +" \n" " \n" " \n"; --=20 2.12.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list