From nobody Fri Mar 29 06:19:47 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.zoho.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 1490983400376284.1785731377305; Fri, 31 Mar 2017 11:03:20 -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 4DED385543; Fri, 31 Mar 2017 18:03:18 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1C09953; Fri, 31 Mar 2017 18:03:18 +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 916B35EC63; Fri, 31 Mar 2017 18:03:17 +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 v2VHsCGI028383 for ; Fri, 31 Mar 2017 13:54:12 -0400 Received: by smtp.corp.redhat.com (Postfix) id BE08917103; Fri, 31 Mar 2017 17:54:12 +0000 (UTC) Received: from mamuti.net (unknown [10.40.205.34]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 472E85C890 for ; Fri, 31 Mar 2017 17:54:12 +0000 (UTC) Received: by mamuti.net (Postfix, from userid 500) id B0AC21008D7; Fri, 31 Mar 2017 19:54:05 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4DED385543 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=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 4DED385543 From: Jiri Denemark To: libvir-list@redhat.com Date: Fri, 31 Mar 2017 19:54:03 +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 6/7] qemu: Pass migratable host model to virCPUUpdate 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.28]); Fri, 31 Mar 2017 18:03:19 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" This will allow us to drop feature filtering from virCPUUpdate where it was just a hack. Signed-off-by: Jiri Denemark --- src/qemu/qemu_capabilities.c | 19 ++++++++++++++----- src/qemu/qemu_capabilities.h | 3 ++- src/qemu/qemu_command.c | 2 +- src/qemu/qemu_process.c | 4 ++-- tests/cputest.c | 7 ++++++- 5 files changed, 25 insertions(+), 10 deletions(-) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index b426a5abc..d4aace56d 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -2442,12 +2442,20 @@ virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCap= s, =20 virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type) + virDomainVirtType type, + bool migratable) { + virQEMUCapsCPUModelPtr model; + if (type =3D=3D VIR_DOMAIN_VIRT_KVM) - return qemuCaps->hostCPU.kvm.full; + model =3D &qemuCaps->hostCPU.kvm; else - return qemuCaps->hostCPU.tcg.full; + model =3D &qemuCaps->hostCPU.tcg; + + if (migratable) + return model->migratable; + else + return model->full; } =20 =20 @@ -2465,7 +2473,7 @@ virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virQEMUCapsGuestIsNative(caps->host.arch, qemuCaps->arch); =20 case VIR_CPU_MODE_HOST_MODEL: - return !!virQEMUCapsGetHostModel(qemuCaps, type); + return !!virQEMUCapsGetHostModel(qemuCaps, type, false); =20 case VIR_CPU_MODE_CUSTOM: if (type =3D=3D VIR_DOMAIN_VIRT_KVM) @@ -5500,7 +5508,8 @@ virQEMUCapsFillDomainCPUCaps(virCapsPtr caps, =20 if (virQEMUCapsIsCPUModeSupported(qemuCaps, caps, domCaps->virttype, VIR_CPU_MODE_HOST_MODEL)) { - virCPUDefPtr cpu =3D virQEMUCapsGetHostModel(qemuCaps, domCaps->vi= rttype); + virCPUDefPtr cpu =3D virQEMUCapsGetHostModel(qemuCaps, domCaps->vi= rttype, + false); domCaps->cpu.hostModel =3D virCPUDefCopy(cpu); } =20 diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index d44682f2a..410fa28b2 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -450,7 +450,8 @@ int virQEMUCapsGetCPUDefinitions(virQEMUCapsPtr qemuCap= s, char ***names, size_t *count); virCPUDefPtr virQEMUCapsGetHostModel(virQEMUCapsPtr qemuCaps, - virDomainVirtType type); + virDomainVirtType type, + bool migratable); bool virQEMUCapsIsCPUModeSupported(virQEMUCapsPtr qemuCaps, virCapsPtr caps, virDomainVirtType type, diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 64d2d7105..c1a8ba065 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -6886,7 +6886,7 @@ qemuBuildCpuCommandLine(virCommandPtr cmd, if (def->cpu->mode =3D=3D VIR_CPU_MODE_CUSTOM) cpuDef =3D def->cpu; else if (def->cpu->mode =3D=3D VIR_CPU_MODE_HOST_PASSTHROUGH) - cpuDef =3D virQEMUCapsGetHostModel(qemuCaps, def->virtType= ); + cpuDef =3D virQEMUCapsGetHostModel(qemuCaps, def->virtType= , false); =20 if (cpuDef) { int svm =3D virCPUCheckFeature(def->os.arch, cpuDef, "svm"= ); diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index a20beb13c..07d0883c3 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5300,12 +5300,12 @@ qemuProcessUpdateGuestCPU(virDomainDefPtr def, =20 if (def->cpu->check =3D=3D VIR_CPU_CHECK_PARTIAL && virCPUCompare(caps->host.arch, - virQEMUCapsGetHostModel(qemuCaps, def->virtType), + virQEMUCapsGetHostModel(qemuCaps, def->virtType, fal= se), def->cpu, true) < 0) return -1; =20 if (virCPUUpdate(def->os.arch, def->cpu, - virQEMUCapsGetHostModel(qemuCaps, def->virtType)) < 0) + virQEMUCapsGetHostModel(qemuCaps, def->virtType, true= )) < 0) goto cleanup; =20 if (virQEMUCapsGetCPUDefinitions(qemuCaps, def->virtType, diff --git a/tests/cputest.c b/tests/cputest.c index 8c07cf4f6..efa891dc1 100644 --- a/tests/cputest.c +++ b/tests/cputest.c @@ -393,6 +393,7 @@ cpuTestUpdate(const void *arg) const struct data *data =3D arg; int ret =3D -1; virCPUDefPtr host =3D NULL; + virCPUDefPtr migHost =3D NULL; virCPUDefPtr cpu =3D NULL; char *result =3D NULL; =20 @@ -400,7 +401,10 @@ cpuTestUpdate(const void *arg) !(cpu =3D cpuTestLoadXML(data->arch, data->name))) goto cleanup; =20 - if (virCPUUpdate(host->arch, cpu, host) < 0) + if (!(migHost =3D virCPUCopyMigratable(data->arch, host))) + goto cleanup; + + if (virCPUUpdate(host->arch, cpu, migHost) < 0) goto cleanup; =20 if (virAsprintf(&result, "%s+%s", data->host, data->name) < 0) @@ -411,6 +415,7 @@ cpuTestUpdate(const void *arg) cleanup: virCPUDefFree(host); virCPUDefFree(cpu); + virCPUDefFree(migHost); VIR_FREE(result); return ret; } --=20 2.12.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list