From nobody Mon Feb 9 16:32:41 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; dmarc=pass(p=none dis=none) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1517935404954732.0819267504362; Tue, 6 Feb 2018 08:43:24 -0800 (PST) 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 D14A6272C2; Tue, 6 Feb 2018 16:43:23 +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 996526445E; Tue, 6 Feb 2018 16:43:23 +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 6070118033E0; Tue, 6 Feb 2018 16:43:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w16GhGAA008416 for ; Tue, 6 Feb 2018 11:43:16 -0500 Received: by smtp.corp.redhat.com (Postfix) id A43CC6046C; Tue, 6 Feb 2018 16:43:16 +0000 (UTC) Received: from inaba.usersys.redhat.com (unknown [10.43.2.98]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 29CA264452 for ; Tue, 6 Feb 2018 16:43:15 +0000 (UTC) From: Andrea Bolognani To: libvir-list@redhat.com Date: Tue, 6 Feb 2018 17:42:50 +0100 Message-Id: <20180206164300.13450-2-abologna@redhat.com> In-Reply-To: <20180206164300.13450-1-abologna@redhat.com> References: <20180206164300.13450-1-abologna@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/11] qemu: Move feature verification from PostParse() to Validate() 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.39]); Tue, 06 Feb 2018 16:43:24 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" We want to perform all feature verification in a single spot, but some of it (eg. GIC) is currently being performed at command line generation time, and moving it to PostParse() would cause guests to disappear. Moving verification to Validate() allows us to side-step the issue. Signed-off-by: Andrea Bolognani Reviewed-by: John Ferlan --- src/qemu/qemu_domain.c | 54 +++++++++++++++++++++++++---------------------= ---- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index df433c2f0..27a4751e9 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3113,30 +3113,6 @@ qemuDomainDefCPUPostParse(virDomainDefPtr def) } =20 =20 -static int -qemuDomainDefVerifyFeatures(const virDomainDef *def) -{ - if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] =3D=3D VIR_TRISTATE_SWITC= H_ON && - !ARCH_IS_X86(def->os.arch)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("I/O APIC tuning is not supported " - "for '%s' architecture"), - virArchToString(def->os.arch)); - return -1; - } - - if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N && - !qemuDomainIsPSeries(def)) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - "%s", - _("HPT tuning is only supported for pSeries guests"= )); - return -1; - } - - return 0; -} - - static int qemuDomainDefPostParseBasic(virDomainDefPtr def, virCapsPtr caps, @@ -3195,9 +3171,6 @@ qemuDomainDefPostParse(virDomainDefPtr def, =20 qemuDomainDefEnableDefaultFeatures(def, qemuCaps); =20 - if (qemuDomainDefVerifyFeatures(def) < 0) - goto cleanup; - if (qemuDomainRecheckInternalPaths(def, cfg, parseFlags) < 0) goto cleanup; =20 @@ -3250,6 +3223,30 @@ qemuDomainDefGetVcpuHotplugGranularity(const virDoma= inDef *def) #define QEMU_MAX_VCPUS_WITHOUT_EIM 255 =20 =20 +static int +qemuDomainDefValidateFeatures(const virDomainDef *def) +{ + if (def->features[VIR_DOMAIN_FEATURE_IOAPIC] =3D=3D VIR_TRISTATE_SWITC= H_ON && + !ARCH_IS_X86(def->os.arch)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("I/O APIC tuning is not supported " + "for '%s' architecture"), + virArchToString(def->os.arch)); + return -1; + } + + if (def->features[VIR_DOMAIN_FEATURE_HPT] =3D=3D VIR_TRISTATE_SWITCH_O= N && + !qemuDomainIsPSeries(def)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + "%s", + _("HPT tuning is only supported for pSeries guests"= )); + return -1; + } + + return 0; +} + + static int qemuDomainDefValidate(const virDomainDef *def, virCapsPtr caps ATTRIBUTE_UNUSED, @@ -3362,6 +3359,9 @@ qemuDomainDefValidate(const virDomainDef *def, } } =20 + if (qemuDomainDefValidateFeatures(def) < 0) + goto cleanup; + ret =3D 0; =20 cleanup: --=20 2.14.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list