From nobody Tue Dec 16 10:58:07 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 1505743981987442.75375279687887; Mon, 18 Sep 2017 07:13:01 -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 D7A997E443; Mon, 18 Sep 2017 14:13:00 +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 AB9CC5C552; Mon, 18 Sep 2017 14:13:00 +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 728A31843762; Mon, 18 Sep 2017 14:13:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8IDZrXm008667 for ; Mon, 18 Sep 2017 09:35:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id 5BAA160627; Mon, 18 Sep 2017 13:35:53 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id D7A336062B for ; Mon, 18 Sep 2017 13:35:47 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7AD091003E2; Mon, 18 Sep 2017 15:35:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D7A997E443 Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx03.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com From: Jiri Denemark To: libvir-list@redhat.com Date: Mon, 18 Sep 2017 15:35:41 +0200 Message-Id: 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.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/6] cpu_conf: Drop updateCPU from virCPUDefFormat 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.27]); Mon, 18 Sep 2017 14:13:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" In the past we updated host-model CPUs with host CPU data by adding a model and features, but keeping the host-model mode. And since the CPU model is not normally formatted for host-model CPU defs, we had to pass the updateCPU flag to the formatting code to be able to properly output updated host-model CPUs. Libvirt doesn't do this anymore, host-model CPUs are turned into custom mode CPUs once updated with host CPU data and thus there's no reason for keeping the hacks inside CPU XML formatters. Signed-off-by: Jiri Denemark --- src/bhyve/bhyve_driver.c | 2 +- src/conf/capabilities.c | 2 +- src/conf/cpu_conf.c | 20 +++++++---------= ---- src/conf/cpu_conf.h | 9 +++------ src/conf/domain_capabilities.c | 2 +- src/conf/domain_conf.c | 3 +-- src/libxl/libxl_driver.c | 2 +- src/qemu/qemu_domain.c | 4 ++-- src/qemu/qemu_driver.c | 2 +- src/qemu/qemu_migration_cookie.c | 2 +- src/test/test_driver.c | 2 +- src/vz/vz_driver.c | 2 +- tests/cputest.c | 15 +++++++-------- .../ppc64-host+guest-compat-incompatible.xml | 2 +- .../cputestdata/ppc64-host+guest-compat-invalid.xml | 2 +- tests/cputestdata/ppc64-host+guest-compat-valid.xml | 2 +- 16 files changed, 31 insertions(+), 42 deletions(-) diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index e8241f39ff..c096b5562f 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1441,7 +1441,7 @@ bhyveConnectBaselineCPU(virConnectPtr conn, virCPUExpandFeatures(cpus[0]->arch, cpu) < 0) goto cleanup; =20 - cpustr =3D virCPUDefFormat(cpu, NULL, false); + cpustr =3D virCPUDefFormat(cpu, NULL); =20 cleanup: virCPUDefListFree(cpus); diff --git a/src/conf/capabilities.c b/src/conf/capabilities.c index ba554535ae..9920a675ac 100644 --- a/src/conf/capabilities.c +++ b/src/conf/capabilities.c @@ -984,7 +984,7 @@ virCapabilitiesFormatXML(virCapsPtr caps) virBufferAdjustIndent(&buf, -2); virBufferAddLit(&buf, "\n"); } - virCPUDefFormatBuf(&buf, caps->host.cpu, false); + virCPUDefFormatBuf(&buf, caps->host.cpu); =20 for (i =3D 0; i < caps->host.nPagesSize; i++) { virBufferAsprintf(&buf, "\n", diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 0bd56c9d28..6058d26fa5 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -574,12 +574,11 @@ virCPUDefParseXML(xmlXPathContextPtr ctxt, =20 char * virCPUDefFormat(virCPUDefPtr def, - virDomainNumaPtr numa, - bool updateCPU) + virDomainNumaPtr numa) { virBuffer buf =3D VIR_BUFFER_INITIALIZER; =20 - if (virCPUDefFormatBufFull(&buf, def, numa, updateCPU) < 0) + if (virCPUDefFormatBufFull(&buf, def, numa) < 0) goto cleanup; =20 if (virBufferCheckError(&buf) < 0) @@ -596,8 +595,7 @@ virCPUDefFormat(virCPUDefPtr def, int virCPUDefFormatBufFull(virBufferPtr buf, virCPUDefPtr def, - virDomainNumaPtr numa, - bool updateCPU) + virDomainNumaPtr numa) { int ret =3D -1; virBuffer attributeBuf =3D VIR_BUFFER_INITIALIZER; @@ -619,9 +617,7 @@ virCPUDefFormatBufFull(virBufferPtr buf, virBufferAsprintf(&attributeBuf, " mode=3D'%s'", tmp); } =20 - if (def->model && - (def->mode =3D=3D VIR_CPU_MODE_CUSTOM || - updateCPU)) { + if (def->model && def->mode =3D=3D VIR_CPU_MODE_CUSTOM) { if (!(tmp =3D virCPUMatchTypeToString(def->match))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected CPU match policy %d"), @@ -642,7 +638,7 @@ virCPUDefFormatBufFull(virBufferPtr buf, if (def->type =3D=3D VIR_CPU_TYPE_HOST && def->arch) virBufferAsprintf(&childrenBuf, "%s\n", virArchToString(def->arch)); - if (virCPUDefFormatBuf(&childrenBuf, def, updateCPU) < 0) + if (virCPUDefFormatBuf(&childrenBuf, def) < 0) goto cleanup; =20 if (virDomainNumaDefCPUFormat(&childrenBuf, numa) < 0) @@ -677,8 +673,7 @@ virCPUDefFormatBufFull(virBufferPtr buf, =20 int virCPUDefFormatBuf(virBufferPtr buf, - virCPUDefPtr def, - bool updateCPU) + virCPUDefPtr def) { size_t i; bool formatModel; @@ -688,8 +683,7 @@ virCPUDefFormatBuf(virBufferPtr buf, return 0; =20 formatModel =3D (def->mode =3D=3D VIR_CPU_MODE_CUSTOM || - def->mode =3D=3D VIR_CPU_MODE_HOST_MODEL || - updateCPU); + def->mode =3D=3D VIR_CPU_MODE_HOST_MODEL); formatFallback =3D (def->type =3D=3D VIR_CPU_TYPE_GUEST && (def->mode =3D=3D VIR_CPU_MODE_HOST_MODEL || (def->mode =3D=3D VIR_CPU_MODE_CUSTOM && def->model= ))); diff --git a/src/conf/cpu_conf.h b/src/conf/cpu_conf.h index d3e2c84102..b1a512b19a 100644 --- a/src/conf/cpu_conf.h +++ b/src/conf/cpu_conf.h @@ -195,18 +195,15 @@ virCPUDefIsEqual(virCPUDefPtr src, =20 char * virCPUDefFormat(virCPUDefPtr def, - virDomainNumaPtr numa, - bool updateCPU); + virDomainNumaPtr numa); =20 int virCPUDefFormatBuf(virBufferPtr buf, - virCPUDefPtr def, - bool updateCPU); + virCPUDefPtr def); int virCPUDefFormatBufFull(virBufferPtr buf, virCPUDefPtr def, - virDomainNumaPtr numa, - bool updateCPU); + virDomainNumaPtr numa); =20 int virCPUDefAddFeature(virCPUDefPtr cpu, diff --git a/src/conf/domain_capabilities.c b/src/conf/domain_capabilities.c index 35f8128e70..f62038b96c 100644 --- a/src/conf/domain_capabilities.c +++ b/src/conf/domain_capabilities.c @@ -413,7 +413,7 @@ virDomainCapsCPUFormat(virBufferPtr buf, virBufferAddLit(buf, "supported=3D'yes'>\n"); virBufferAdjustIndent(buf, 2); =20 - virCPUDefFormatBuf(buf, cpu->hostModel, false); + virCPUDefFormatBuf(buf, cpu->hostModel); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index cc5e79b70b..35adce95b5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -25720,8 +25720,7 @@ virDomainDefFormatInternal(virDomainDefPtr def, virBufferAddLit(buf, "\n"); } =20 - if (virCPUDefFormatBufFull(buf, def->cpu, def->numa, - !!(flags & VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU= )) < 0) + if (virCPUDefFormatBufFull(buf, def->cpu, def->numa) < 0) goto error; =20 virBufferAsprintf(buf, "arch, cpu) < 0) goto cleanup; =20 - cpustr =3D virCPUDefFormat(cpu, NULL, false); + cpustr =3D virCPUDefFormat(cpu, NULL); =20 cleanup: virCPUDefListFree(cpus); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 50b536eec7..aba4111ba2 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -1945,7 +1945,7 @@ qemuDomainObjPrivateXMLFormat(virBufferPtr buf, virBufferEscapeString(buf, "\n", priv->channelTargetDir); =20 - virCPUDefFormatBufFull(buf, priv->origCPU, NULL, false); + virCPUDefFormatBufFull(buf, priv->origCPU, NULL); =20 if (priv->chardevStdioLogd) virBufferAddLit(buf, "\n"); @@ -9803,7 +9803,7 @@ qemuDomainSaveCookieFormat(virBufferPtr buf, qemuDomainSaveCookiePtr cookie =3D (qemuDomainSaveCookiePtr) obj; =20 if (cookie->cpu && - virCPUDefFormatBufFull(buf, cookie->cpu, NULL, false) < 0) + virCPUDefFormatBufFull(buf, cookie->cpu, NULL) < 0) return -1; =20 return 0; diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index e1a0dd553e..77308d547e 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -13019,7 +13019,7 @@ qemuConnectBaselineCPU(virConnectPtr conn ATTRIBUTE= _UNUSED, virCPUExpandFeatures(cpus[0]->arch, cpu) < 0) goto cleanup; =20 - cpustr =3D virCPUDefFormat(cpu, NULL, false); + cpustr =3D virCPUDefFormat(cpu, NULL); =20 cleanup: virCPUDefListFree(cpus); diff --git a/src/qemu/qemu_migration_cookie.c b/src/qemu/qemu_migration_coo= kie.c index 4914c77ef0..eef40a6cd0 100644 --- a/src/qemu/qemu_migration_cookie.c +++ b/src/qemu/qemu_migration_cookie.c @@ -771,7 +771,7 @@ qemuMigrationCookieXMLFormat(virQEMUDriverPtr driver, qemuMigrationCookieStatisticsXMLFormat(buf, mig->jobInfo); =20 if (mig->flags & QEMU_MIGRATION_COOKIE_CPU && mig->cpu) - virCPUDefFormatBufFull(buf, mig->cpu, NULL, false); + virCPUDefFormatBufFull(buf, mig->cpu, NULL); =20 virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 6e8a4b5782..599c5ed545 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -1551,7 +1551,7 @@ testConnectBaselineCPU(virConnectPtr conn ATTRIBUTE_U= NUSED, virCPUExpandFeatures(cpus[0]->arch, cpu) < 0) goto cleanup; =20 - cpustr =3D virCPUDefFormat(cpu, NULL, false); + cpustr =3D virCPUDefFormat(cpu, NULL); =20 cleanup: virCPUDefListFree(cpus); diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index daeed5f114..9ebb51d60a 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -964,7 +964,7 @@ vzConnectBaselineCPU(virConnectPtr conn, virCPUExpandFeatures(cpus[0]->arch, cpu) < 0) goto cleanup; =20 - cpustr =3D virCPUDefFormat(cpu, NULL, false); + cpustr =3D virCPUDefFormat(cpu, NULL); =20 cleanup: virCPUDefListFree(cpus); diff --git a/tests/cputest.c b/tests/cputest.c index d325b5315c..913ca77231 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -150,8 +150,7 @@ cpuTestLoadMultiXML(virArch arch, static int cpuTestCompareXML(virArch arch, virCPUDef *cpu, - const char *name, - bool updateCPU) + const char *name) { char *xml =3D NULL; char *actual =3D NULL; @@ -161,7 +160,7 @@ cpuTestCompareXML(virArch arch, abs_srcdir, virArchToString(arch), name) < 0) goto cleanup; =20 - if (!(actual =3D virCPUDefFormat(cpu, NULL, updateCPU))) + if (!(actual =3D virCPUDefFormat(cpu, NULL))) goto cleanup; =20 if (virTestCompareToFile(actual, xml) < 0) @@ -281,7 +280,7 @@ cpuTestGuestCPU(const void *arg) } result =3D virBufferContentAndReset(&buf); =20 - if (cpuTestCompareXML(data->arch, cpu, result, false) < 0) + if (cpuTestCompareXML(data->arch, cpu, result) < 0) goto cleanup; =20 ret =3D 0; @@ -355,7 +354,7 @@ cpuTestBaseline(const void *arg) if (virAsprintf(&result, "%s-%s", data->name, suffix) < 0) goto cleanup; =20 - if (cpuTestCompareXML(data->arch, baseline, result, false) < 0) + if (cpuTestCompareXML(data->arch, baseline, result) < 0) goto cleanup; =20 for (i =3D 0; i < ncpus; i++) { @@ -409,7 +408,7 @@ cpuTestUpdate(const void *arg) if (virAsprintf(&result, "%s+%s", data->host, data->name) < 0) goto cleanup; =20 - ret =3D cpuTestCompareXML(data->arch, cpu, result, true); + ret =3D cpuTestCompareXML(data->arch, cpu, result); =20 cleanup: virCPUDefFree(host); @@ -501,7 +500,7 @@ cpuTestCPUID(bool guest, const void *arg) guest ? "guest" : "host") < 0) goto cleanup; =20 - ret =3D cpuTestCompareXML(data->arch, cpu, result, false); + ret =3D cpuTestCompareXML(data->arch, cpu, result); =20 cleanup: VIR_FREE(hostFile); @@ -716,7 +715,7 @@ cpuTestJSONCPUID(const void *arg) if (virQEMUCapsInitCPUModel(qemuCaps, VIR_DOMAIN_VIRT_KVM, cpu, false)= !=3D 0) goto cleanup; =20 - ret =3D cpuTestCompareXML(data->arch, cpu, result, false); + ret =3D cpuTestCompareXML(data->arch, cpu, result); =20 cleanup: qemuMonitorCPUModelInfoFree(model); diff --git a/tests/cputestdata/ppc64-host+guest-compat-incompatible.xml b/t= ests/cputestdata/ppc64-host+guest-compat-incompatible.xml index 1fab751ada..0595ba0efd 100644 --- a/tests/cputestdata/ppc64-host+guest-compat-incompatible.xml +++ b/tests/cputestdata/ppc64-host+guest-compat-incompatible.xml @@ -1,3 +1,3 @@ - + power8 diff --git a/tests/cputestdata/ppc64-host+guest-compat-invalid.xml b/tests/= cputestdata/ppc64-host+guest-compat-invalid.xml index bc0d829673..edf874f4f4 100644 --- a/tests/cputestdata/ppc64-host+guest-compat-invalid.xml +++ b/tests/cputestdata/ppc64-host+guest-compat-invalid.xml @@ -1,3 +1,3 @@ - + power7+ diff --git a/tests/cputestdata/ppc64-host+guest-compat-valid.xml b/tests/cp= utestdata/ppc64-host+guest-compat-valid.xml index da9cc91885..f32cd93093 100644 --- a/tests/cputestdata/ppc64-host+guest-compat-valid.xml +++ b/tests/cputestdata/ppc64-host+guest-compat-valid.xml @@ -1,3 +1,3 @@ - + power6 --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list