From nobody Mon Apr 29 14:05:34 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15057425778451012.1153213414935; Mon, 18 Sep 2017 06:49:37 -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 54A5D267FC; Mon, 18 Sep 2017 13:49:36 +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 16D395D6A8; Mon, 18 Sep 2017 13:49: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 1C1501864DCA; Mon, 18 Sep 2017 13:49:35 +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 v8IDZp9F008640 for ; Mon, 18 Sep 2017 09:35:51 -0400 Received: by smtp.corp.redhat.com (Postfix) id 209011851B; Mon, 18 Sep 2017 13:35:51 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C3BBF5D722 for ; Mon, 18 Sep 2017 13:35:47 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7784F1000FE; Mon, 18 Sep 2017 15:35:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 54A5D267FC Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.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:40 +0200 Message-Id: <6563833e62b1b1d98abdab469c8900940a3feaf7.1505740922.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.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/6] qemuxml2xmltest: Add tests for Power CPUs 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.30]); Mon, 18 Sep 2017 13:49:37 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- .../qemuxml2xmlout-pseries-cpu-compat-power9.xml | 38 ++++++++++++++++++= +++ .../qemuxml2xmlout-pseries-cpu-compat.xml | 38 ++++++++++++++++++= +++ .../qemuxml2xmlout-pseries-cpu-exact.xml | 39 ++++++++++++++++++= ++++ tests/qemuxml2xmltest.c | 4 +++ 4 files changed, 119 insertions(+) create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-com= pat-power9.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-com= pat.xml create mode 100644 tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exa= ct.xml diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-pow= er9.xml b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9= .xml new file mode 100644 index 0000000000..f020056219 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat-power9.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 4 + + hvm + + + + power9 + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + +
+ + + +
+ + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml= b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml new file mode 100644 index 0000000000..3cbce9fe6a --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-compat.xml @@ -0,0 +1,38 @@ + + QEMUGuest1 + c7a5fdbd-edaf-9455-926a-d65c16db1809 + 219100 + 219100 + 4 + + hvm + + + + power7 + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + +
+ + + +
+ + + + + diff --git a/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml = b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml new file mode 100644 index 0000000000..d69b387686 --- /dev/null +++ b/tests/qemuxml2xmloutdata/qemuxml2xmlout-pseries-cpu-exact.xml @@ -0,0 +1,39 @@ + + QEMUGuest1 + 1ccfd97d-5eb4-478a-bbe6-88d254c16db7 + 524288 + 524288 + 1 + + hvm + + + + POWER7 + IBM + + + destroy + restart + destroy + + /usr/bin/qemu-system-ppc64 + +
+ + + + + + + +
+ + + +
+ + + + + diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index efac9e8286..d15ea93b19 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1216,6 +1216,10 @@ mymain(void) DO_TEST("smartcard-passthrough-spicevmc", NONE); DO_TEST("smartcard-controller", NONE); =20 + DO_TEST("pseries-cpu-compat-power9", NONE); + DO_TEST("pseries-cpu-compat", NONE); + DO_TEST("pseries-cpu-exact", NONE); + if (getenv("LIBVIRT_SKIP_CLEANUP") =3D=3D NULL) virFileDeleteTree(fakerootdir); =20 --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 14:05:34 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 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 From nobody Mon Apr 29 14:05:34 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505744023738860.9364408818393; Mon, 18 Sep 2017 07:13:43 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id ABDEBC00DB86; Mon, 18 Sep 2017 14:13:42 +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 8A2E561B66; Mon, 18 Sep 2017 14:13:42 +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 4E6E3410B3; Mon, 18 Sep 2017 14:13:42 +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 v8IDZrhA008678 for ; Mon, 18 Sep 2017 09:35:53 -0400 Received: by smtp.corp.redhat.com (Postfix) id CADD518670; 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 9ECAC1866D for ; Mon, 18 Sep 2017 13:35:47 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7CC531003E3; Mon, 18 Sep 2017 15:35:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com ABDEBC00DB86 Authentication-Results: ext-mx07.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx07.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:42 +0200 Message-Id: <170967e795f68e64641879c67debaf4e36bb5f4a.1505740922.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.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/6] cpu_conf: Simplify formatting of guest CPU attributes 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Mon, 18 Sep 2017 14:13:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Jiri Denemark --- src/conf/cpu_conf.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/conf/cpu_conf.c b/src/conf/cpu_conf.c index 6058d26fa5..02506c020b 100644 --- a/src/conf/cpu_conf.c +++ b/src/conf/cpu_conf.c @@ -604,20 +604,20 @@ virCPUDefFormatBufFull(virBufferPtr buf, if (!def) return 0; =20 - /* Format attributes */ - if (def->type =3D=3D VIR_CPU_TYPE_GUEST) { + /* Format attributes for guest CPUs unless they only specify + * topology or cache. */ + if (def->type =3D=3D VIR_CPU_TYPE_GUEST && + (def->mode !=3D VIR_CPU_MODE_CUSTOM || def->model)) { const char *tmp; =20 - if (def->mode !=3D VIR_CPU_MODE_CUSTOM || def->model) { - if (!(tmp =3D virCPUModeTypeToString(def->mode))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unexpected CPU mode %d"), def->mode); - goto cleanup; - } - virBufferAsprintf(&attributeBuf, " mode=3D'%s'", tmp); + if (!(tmp =3D virCPUModeTypeToString(def->mode))) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Unexpected CPU mode %d"), def->mode); + goto cleanup; } + virBufferAsprintf(&attributeBuf, " mode=3D'%s'", tmp); =20 - if (def->model && def->mode =3D=3D VIR_CPU_MODE_CUSTOM) { + if (def->mode =3D=3D VIR_CPU_MODE_CUSTOM) { if (!(tmp =3D virCPUMatchTypeToString(def->match))) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Unexpected CPU match policy %d"), --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 14:05:34 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505743962558473.7928789272763; Mon, 18 Sep 2017 07:12:42 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F3CE81E0A; Mon, 18 Sep 2017 14:12:41 +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 02A966BF85; Mon, 18 Sep 2017 14:12:41 +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 4BC55410B5; Mon, 18 Sep 2017 14:12:40 +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 v8IDZoYt008635 for ; Mon, 18 Sep 2017 09:35:50 -0400 Received: by smtp.corp.redhat.com (Postfix) id A4ECE171D9; Mon, 18 Sep 2017 13:35:50 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 7A47D5C88F for ; Mon, 18 Sep 2017 13:35:47 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 7EAAC1003E4; Mon, 18 Sep 2017 15:35:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F3CE81E0A Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.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:43 +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.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/6] conf: Drop unused VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 18 Sep 2017 14:12:41 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The only real usage of this flag was removed by "cpu_conf: Drop updateCPU from virCPUDefFormat". Signed-off-by: Jiri Denemark --- src/conf/domain_conf.c | 3 --- src/conf/domain_conf.h | 1 - src/conf/snapshot_conf.c | 3 +-- 3 files changed, 1 insertion(+), 6 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 35adce95b5..984db98107 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -87,7 +87,6 @@ struct _virDomainXMLOption { #define VIR_DOMAIN_DEF_FORMAT_COMMON_FLAGS \ (VIR_DOMAIN_DEF_FORMAT_SECURE | \ VIR_DOMAIN_DEF_FORMAT_INACTIVE | \ - VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU | \ VIR_DOMAIN_DEF_FORMAT_MIGRATABLE) =20 VIR_ENUM_IMPL(virDomainTaint, VIR_DOMAIN_TAINT_LAST, @@ -25974,8 +25973,6 @@ unsigned int virDomainDefFormatConvertXMLFlags(unsi= gned int flags) formatFlags |=3D VIR_DOMAIN_DEF_FORMAT_SECURE; if (flags & VIR_DOMAIN_XML_INACTIVE) formatFlags |=3D VIR_DOMAIN_DEF_FORMAT_INACTIVE; - if (flags & VIR_DOMAIN_XML_UPDATE_CPU) - formatFlags |=3D VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU; if (flags & VIR_DOMAIN_XML_MIGRATABLE) formatFlags |=3D VIR_DOMAIN_DEF_FORMAT_MIGRATABLE; =20 diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index bb3b6f0c3c..4603e4f97e 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2857,7 +2857,6 @@ typedef enum { typedef enum { VIR_DOMAIN_DEF_FORMAT_SECURE =3D 1 << 0, VIR_DOMAIN_DEF_FORMAT_INACTIVE =3D 1 << 1, - VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU =3D 1 << 2, VIR_DOMAIN_DEF_FORMAT_MIGRATABLE =3D 1 << 3, /* format internal domain status information */ VIR_DOMAIN_DEF_FORMAT_STATUS =3D 1 << 4, diff --git a/src/conf/snapshot_conf.c b/src/conf/snapshot_conf.c index 5a07d3734a..07706e0b26 100644 --- a/src/conf/snapshot_conf.c +++ b/src/conf/snapshot_conf.c @@ -703,8 +703,7 @@ virDomainSnapshotDefFormat(const char *domain_uuid, virBuffer buf =3D VIR_BUFFER_INITIALIZER; size_t i; =20 - virCheckFlags(VIR_DOMAIN_DEF_FORMAT_SECURE | - VIR_DOMAIN_DEF_FORMAT_UPDATE_CPU, NULL); + virCheckFlags(VIR_DOMAIN_DEF_FORMAT_SECURE, NULL); =20 flags |=3D VIR_DOMAIN_DEF_FORMAT_INACTIVE; =20 --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 14:05:34 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505743133131371.2867902135936; Mon, 18 Sep 2017 06:58:53 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1462B267CA; Mon, 18 Sep 2017 13:58:52 +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 7CB6B60466; Mon, 18 Sep 2017 13:58:51 +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 109E33FAD0; Mon, 18 Sep 2017 13:58:50 +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 v8IDZqTA008655 for ; Mon, 18 Sep 2017 09:35:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6EFAA5C670; Mon, 18 Sep 2017 13:35:52 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41D6F5167E for ; Mon, 18 Sep 2017 13:35:52 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 80DA81003E5; Mon, 18 Sep 2017 15:35:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1462B267CA Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx06.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:44 +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.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 5/6] qemu: Use correct host model for updating guest cpu 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.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Mon, 18 Sep 2017 13:58:52 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" when a user requested a domain xml description with vir_domain_xml_update_cpu flag, libvirt would use the host cpu definition from host capabilities rather than the one which will actually be used once the domain is started. https://bugzilla.redhat.com/show_bug.cgi?id=3D1481309 Signed-off-by: Jiri Denemark --- src/qemu/qemu_domain.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index aba4111ba2..74284f40c1 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4553,6 +4553,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr drive= r, int ret =3D -1; virDomainDefPtr copy =3D NULL; virCapsPtr caps =3D NULL; + virQEMUCapsPtr qemuCaps =3D NULL; =20 if (!(caps =3D virQEMUDriverGetCapabilities(driver, false))) goto cleanup; @@ -4571,7 +4572,14 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr driv= er, def->cpu && (def->cpu->mode !=3D VIR_CPU_MODE_CUSTOM || def->cpu->model)) { - if (virCPUUpdate(def->os.arch, def->cpu, caps->host.cpu) < 0) + if (!(qemuCaps =3D virQEMUCapsCacheLookupCopy(driver->qemuCapsCach= e, + def->emulator, + def->os.machine))) + goto cleanup; + + if (virCPUUpdate(def->os.arch, def->cpu, + virQEMUCapsGetHostModel(qemuCaps, def->virtType, + VIR_QEMU_CAPS_HOST_CPU_MI= GRATABLE)) < 0) goto cleanup; } =20 @@ -4689,6 +4697,7 @@ qemuDomainDefFormatBufInternal(virQEMUDriverPtr drive= r, cleanup: virDomainDefFree(copy); virObjectUnref(caps); + virObjectUnref(qemuCaps); return ret; } =20 --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Mon Apr 29 14:05:34 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1505742603099660.2274725676228; Mon, 18 Sep 2017 06:50:03 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A5F1B85376; Mon, 18 Sep 2017 13:50:01 +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 7159218ECD; Mon, 18 Sep 2017 13:50:01 +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 E4E471864DC9; Mon, 18 Sep 2017 13:50:00 +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 v8IDZqAB008656 for ; Mon, 18 Sep 2017 09:35:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6EAB6171D9; Mon, 18 Sep 2017 13:35:52 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.105]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 41FD75C88D for ; Mon, 18 Sep 2017 13:35:52 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id 82CB61003E6; Mon, 18 Sep 2017 15:35:46 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com A5F1B85376 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.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:45 +0200 Message-Id: <5f69bd145f04c9a7bc7e0ae8b71ef1cad450f799.1505740922.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 6/6] qemu: Don't update CPU when formatting live def 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 18 Sep 2017 13:50:02 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Since commit v2.2.0-199-g7ce711a30e libvirt stores an updated guest CPU in domain's live definition and there's no need to update it every time we want to format the definition. The commit itself tried to address this in qemuDomainFormatXML, but forgot to fix qemuDomainDefFormatLive. Not to mention that masking a previously set flag is only acceptable if the flag was set by a public API user. Internally, libvirt should have never set the flag in the first place. https://bugzilla.redhat.com/show_bug.cgi?id=3D1485022 Signed-off-by: Jiri Denemark --- src/qemu/qemu_domain.c | 2 -- src/qemu/qemu_domain.h | 3 +-- src/qemu/qemu_driver.c | 7 +++++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 74284f40c1..5ef98911dc 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -4757,8 +4757,6 @@ char *qemuDomainFormatXML(virQEMUDriverPtr driver, } else { def =3D vm->def; origCPU =3D priv->origCPU; - if (virDomainObjIsActive(vm)) - flags &=3D ~VIR_DOMAIN_XML_UPDATE_CPU; } =20 return qemuDomainDefFormatXMLInternal(driver, def, origCPU, flags); diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index b291dc3082..09201b1a40 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -40,8 +40,7 @@ # include "logging/log_manager.h" =20 # define QEMU_DOMAIN_FORMAT_LIVE_FLAGS \ - (VIR_DOMAIN_XML_SECURE | \ - VIR_DOMAIN_XML_UPDATE_CPU) + (VIR_DOMAIN_XML_SECURE) =20 # if ULONG_MAX =3D=3D 4294967295 /* QEMU has a 64-bit limit, but we are limited by our historical choice of diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 77308d547e..a29bbea55d 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -6997,6 +6997,13 @@ static char if ((flags & VIR_DOMAIN_XML_MIGRATABLE)) flags |=3D QEMU_DOMAIN_FORMAT_LIVE_FLAGS; =20 + /* The CPU is already updated in the domain's live definition, we need= to + * ignore the VIR_DOMAIN_XML_UPDATE_CPU flag. + */ + if (virDomainObjIsActive(vm) && + !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) + flags &=3D ~VIR_DOMAIN_XML_UPDATE_CPU; + ret =3D qemuDomainFormatXML(driver, vm, flags); =20 cleanup: --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list