From nobody Sun Feb 8 12:13: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 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