From nobody Tue Dec 16 08:36:06 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 1499864223263850.7166411362136; Wed, 12 Jul 2017 05:57:03 -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 CE911C0587D4; Wed, 12 Jul 2017 12:57: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 AAEB560466; Wed, 12 Jul 2017 12:57: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 5707A1800C94; Wed, 12 Jul 2017 12:56:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v6CCuvLW022833 for ; Wed, 12 Jul 2017 08:56:57 -0400 Received: by smtp.corp.redhat.com (Postfix) id EBECF60E3A; Wed, 12 Jul 2017 12:56:57 +0000 (UTC) Received: from virval.usersys.redhat.com (unknown [10.43.2.187]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BF2A870BA0 for ; Wed, 12 Jul 2017 12:56:55 +0000 (UTC) Received: by virval.usersys.redhat.com (Postfix, from userid 500) id AA767100869; Wed, 12 Jul 2017 14:56:54 +0200 (CEST) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com CE911C0587D4 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.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 CE911C0587D4 From: Jiri Denemark To: libvir-list@redhat.com Date: Wed, 12 Jul 2017 14:56:48 +0200 Message-Id: <27d5ad1f9893c7330c235fdcd266f9805bdeb72a.1499864108.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.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/7] qemu: Add qemuProcessVerifyCPU 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.32]); Wed, 12 Jul 2017 12:57:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Separated from qemuProcessUpdateLiveGuestCPU. The function makes sure a guest CPU provides all features required by a domain definition. Signed-off-by: Jiri Denemark --- src/qemu/qemu_process.c | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index b2d27b6be..198f68d93 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -3986,6 +3986,31 @@ qemuProcessFetchGuestCPU(virQEMUDriverPtr driver, =20 =20 static int +qemuProcessVerifyCPU(virDomainObjPtr vm, + virCPUDataPtr cpu) +{ + virDomainDefPtr def =3D vm->def; + + if (!cpu) + return 0; + + if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 || + qemuProcessVerifyHypervFeatures(def, cpu) < 0) + return -1; + + if (!def->cpu || + (def->cpu->mode =3D=3D VIR_CPU_MODE_CUSTOM && + !def->cpu->model)) + return 0; + + if (qemuProcessVerifyCPUFeatures(def, cpu) < 0) + return -1; + + return 0; +} + + +static int qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, virDomainObjPtr vm, qemuDomainAsyncJob asyncJob) @@ -4001,11 +4026,10 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driv= er, if (qemuProcessFetchGuestCPU(driver, vm, asyncJob, &cpu, &disabled) < = 0) goto cleanup; =20 - if (cpu) { - if (qemuProcessVerifyKVMFeatures(def, cpu) < 0 || - qemuProcessVerifyHypervFeatures(def, cpu) < 0) - goto cleanup; + if (qemuProcessVerifyCPU(vm, cpu) < 0) + goto cleanup; =20 + if (cpu) { if (!def->cpu || (def->cpu->mode =3D=3D VIR_CPU_MODE_CUSTOM && !def->cpu->model)) { @@ -4013,9 +4037,6 @@ qemuProcessUpdateLiveGuestCPU(virQEMUDriverPtr driver, goto cleanup; } =20 - if (qemuProcessVerifyCPUFeatures(def, cpu) < 0) - goto cleanup; - if (!(orig =3D virCPUDefCopy(def->cpu))) goto cleanup; =20 --=20 2.13.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list